Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On 05/12/2014 11:53 PM, Mike Stump wrote: I put in one small fix: Doing diffs in testsuite/objc.dg/ivar-visibility-4.m.~1~: --- testsuite/objc.dg/ivar-visibility-4.m.~1~ 2014-05-12 12:04:16.0 -0700 +++ testsuite/objc.dg/ivar-visibility-4.m 2014-05-12 13:50:53.0 -0700 @@ -29,7 +29,7 @@ { int a; - /* someivar is public so we shoudn't get any errors here. */ + /* someivar is public so we shouldn't get any errors here. */ a = object-someivar; } ——— Ok, thanks for that and for all your help in general. I tried checking out the current master branch and running objective-c and objective-c++ related tests and everything seems to be in order so hopefully that concludes the business with this patch. Dimitris
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Ping! On 05/05/2014 10:35 AM, Dimitris Papavasiliou wrote: Ping! On 04/28/2014 01:35 PM, Dimitris Papavasiliou wrote: On 04/25/2014 07:50 PM, Mike Stump wrote: On Apr 25, 2014, at 9:34 AM, Dimitris Papavasilioudpapa...@gmail.com wrote: --Wreturn-type -Wsequence-point -Wshadow @gol +-Wreturn-type -Wsequence-point -Wshadow -Wshadow-ivar @gol This has to be -Wno-shadow-ivar, we document the non-default… +@item -Wshadow-ivar @r{(Objective-C only)} Likewise. + /* Check wheter the local variable hides the instance variable. */ spelling, whether... Fixed these. + a = private; /* { dg-warning hides instance variable { xfail *-*-* } } */ + a = protected; /* { dg-warning hides instance variable { xfail *-*-* } } */ + a = public; /* { dg-warning hides instance variable { xfail *-*-* } } */ No, we don’t expect failures. We makes the compiler do what we wants or it gets the hose again. Then, we expect it to be perfect. If you won’t want warning, and non are produces, then just remove the /* … */, or write /* no warning */. I've fixed these as per your request. For the record though, this form of test seems to be fairly common in the test suites as this output indicates: dimitris@debian:~/sandbox/gcc-build$ find ../gcc-source/gcc/testsuite/ -name *.c -o -name *.C -o -name *.m | xargs grep xfail \*-\*-\* | wc -l 354 Many of these seem to be in error or warning messages which are expected not to show up. In any case if the messages do show up they'll trigger the excessive messages test so I suppose that's enough. Also, synth up the ChnageLogs… :-), they are trivial enough. Done. And, just pop them all into one patch (cd ..; svn diff), 3 is 3x the work for me. Attached. Once we resolve the 3 warning tests above, this will be ok. Actually, there were a few more { xfail *-*-* } in the other test cases. I've removed these as well. Dimitris
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On Apr 28, 2014, at 3:35 AM, Dimitris Papavasiliou dpapa...@gmail.com wrote: + a = private;/* { dg-warning hides instance variable { xfail *-*-* } } */ + a = protected; /* { dg-warning hides instance variable { xfail *-*-* } } */ + a = public; /* { dg-warning hides instance variable { xfail *-*-* } } */ No, we don’t expect failures. We makes the compiler do what we wants or it gets the hose again. Then, we expect it to be perfect. If you won’t want warning, and non are produces, then just remove the /* … */, or write /* no warning */. I've fixed these as per your request. For the record though, this form of test seems to be fairly common in the test suites as this output indicates: dimitris@debian:~/sandbox/gcc-build$ find ../gcc-source/gcc/testsuite/ -name *.c -o -name *.C -o -name *.m | xargs grep xfail \*-\*-\* | wc -l 354 Many of these seem to be in error or warning messages which are expected not to show up. In any case if the messages do show up they'll trigger the excessive messages test so I suppose that's enough. Once we resolve the 3 warning tests above, this will be ok. Actually, there were a few more { xfail *-*-* } in the other test cases. I've removed these as well. So, let’s make sure we’re on the same page… Take shadow-2.m for example, before you said: + a = private;/* { dg-warning hides instance variable { xfail *-*-* } } */ and now you say: + a = private;/* No warning. */ So, the first question is, what do we _want_ in the end here? Warning or no warning? And what do we actually do now, warn or not? If in the end, we want a warning, then the previous form is the right eventually form. If we don’t want a warning, then the second is correct, though, there is another form that is not unreasonable: i += [Base class_func1]; /* { dg-bogus invalid receiver type } */ this says that we used to generate a warning (or an error message), but that was wrong, and we no longer want to expect a warning, and that the bug has been fixed and that no warning is generated. I think we are on the same page, just wanted to make sure...
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On 05/12/2014 07:24 PM, Mike Stump wrote: On Apr 28, 2014, at 3:35 AM, Dimitris Papavasiliou dpapa...@gmail.com wrote: + a = private;/* { dg-warning hides instance variable { xfail *-*-* } } */ + a = protected; /* { dg-warning hides instance variable { xfail *-*-* } } */ + a = public; /* { dg-warning hides instance variable { xfail *-*-* } } */ No, we don’t expect failures. We makes the compiler do what we wants or it gets the hose again. Then, we expect it to be perfect. If you won’t want warning, and non are produces, then just remove the /* … */, or write /* no warning */. I've fixed these as per your request. For the record though, this form of test seems to be fairly common in the test suites as this output indicates: dimitris@debian:~/sandbox/gcc-build$ find ../gcc-source/gcc/testsuite/ -name *.c -o -name *.C -o -name *.m | xargs grep xfail \*-\*-\* | wc -l 354 Many of these seem to be in error or warning messages which are expected not to show up. In any case if the messages do show up they'll trigger the excessive messages test so I suppose that's enough. Once we resolve the 3 warning tests above, this will be ok. Actually, there were a few more { xfail *-*-* } in the other test cases. I've removed these as well. So, let’s make sure we’re on the same page… Take shadow-2.m for example, before you said: + a = private;/* { dg-warning hides instance variable { xfail *-*-* } } */ and now you say: + a = private;/* No warning. */ So, the first question is, what do we _want_ in the end here? Warning or no warning? And what do we actually do now, warn or not? If in the end, we want a warning, then the previous form is the right eventually form. If we don’t want a warning, then the second is correct, though, there is another form that is not unreasonable: i += [Base class_func1]; /* { dg-bogus invalid receiver type } */ this says that we used to generate a warning (or an error message), but that was wrong, and we no longer want to expect a warning, and that the bug has been fixed and that no warning is generated. I think we are on the same page, just wanted to make sure... Well the point of this test is to make sure that the introduced -Wshadow also controls the warnings related to the shadowing of instance variables which was not the case in the past. So we declare a couple of local variables of the same name and expect that they silently shadow the instance variables, that is that warnings are _not_ generated. So I take it that I should change these to dg-bogus since this is behavior expected in the past but not now, as well as any other expected non-warnings in the other test cases? Is it important in some way that dg-bogus makes no distinction between warning and error messages?
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On May 12, 2014, at 11:56 AM, Dimitris Papavasiliou dpapa...@gmail.com wrote: So we [ .. ] expect that they silently shadow the instance variables, that is that warnings are _not_ generated. Perfect, thanks. I’ve checked it in: Committed revision 210333. Thanks for all your hard work. So I take it that I should change these to dg-bogus since this is behavior expected in the past but not now, as well as any other expected non-warnings in the other test cases? Is it important in some way that dg-bogus makes no distinction between warning and error messages? No. One could, but, not necessary.
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
I put in one small fix: Doing diffs in testsuite/objc.dg/ivar-visibility-4.m.~1~: --- testsuite/objc.dg/ivar-visibility-4.m.~1~ 2014-05-12 12:04:16.0 -0700 +++ testsuite/objc.dg/ivar-visibility-4.m 2014-05-12 13:50:53.0 -0700 @@ -29,7 +29,7 @@ { int a; - /* someivar is public so we shoudn't get any errors here. */ + /* someivar is public so we shouldn't get any errors here. */ a = object-someivar; } ———
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Ping! On 04/28/2014 01:35 PM, Dimitris Papavasiliou wrote: On 04/25/2014 07:50 PM, Mike Stump wrote: On Apr 25, 2014, at 9:34 AM, Dimitris Papavasilioudpapa...@gmail.com wrote: --Wreturn-type -Wsequence-point -Wshadow @gol +-Wreturn-type -Wsequence-point -Wshadow -Wshadow-ivar @gol This has to be -Wno-shadow-ivar, we document the non-default… +@item -Wshadow-ivar @r{(Objective-C only)} Likewise. + /* Check wheter the local variable hides the instance variable. */ spelling, whether... Fixed these. + a = private; /* { dg-warning hides instance variable { xfail *-*-* } } */ + a = protected; /* { dg-warning hides instance variable { xfail *-*-* } } */ + a = public; /* { dg-warning hides instance variable { xfail *-*-* } } */ No, we don’t expect failures. We makes the compiler do what we wants or it gets the hose again. Then, we expect it to be perfect. If you won’t want warning, and non are produces, then just remove the /* … */, or write /* no warning */. I've fixed these as per your request. For the record though, this form of test seems to be fairly common in the test suites as this output indicates: dimitris@debian:~/sandbox/gcc-build$ find ../gcc-source/gcc/testsuite/ -name *.c -o -name *.C -o -name *.m | xargs grep xfail \*-\*-\* | wc -l 354 Many of these seem to be in error or warning messages which are expected not to show up. In any case if the messages do show up they'll trigger the excessive messages test so I suppose that's enough. Also, synth up the ChnageLogs… :-), they are trivial enough. Done. And, just pop them all into one patch (cd ..; svn diff), 3 is 3x the work for me. Attached. Once we resolve the 3 warning tests above, this will be ok. Actually, there were a few more { xfail *-*-* } in the other test cases. I've removed these as well. Dimitris
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On 04/25/2014 07:50 PM, Mike Stump wrote: On Apr 25, 2014, at 9:34 AM, Dimitris Papavasilioudpapa...@gmail.com wrote: --Wreturn-type -Wsequence-point -Wshadow @gol +-Wreturn-type -Wsequence-point -Wshadow -Wshadow-ivar @gol This has to be -Wno-shadow-ivar, we document the non-default… +@item -Wshadow-ivar @r{(Objective-C only)} Likewise. + /* Check wheter the local variable hides the instance variable. */ spelling, whether... Fixed these. + a = private;/* { dg-warning hides instance variable { xfail *-*-* } } */ + a = protected; /* { dg-warning hides instance variable { xfail *-*-* } } */ + a = public; /* { dg-warning hides instance variable { xfail *-*-* } } */ No, we don’t expect failures. We makes the compiler do what we wants or it gets the hose again. Then, we expect it to be perfect. If you won’t want warning, and non are produces, then just remove the /* … */, or write /* no warning */. I've fixed these as per your request. For the record though, this form of test seems to be fairly common in the test suites as this output indicates: dimitris@debian:~/sandbox/gcc-build$ find ../gcc-source/gcc/testsuite/ -name *.c -o -name *.C -o -name *.m | xargs grep xfail \*-\*-\* | wc -l 354 Many of these seem to be in error or warning messages which are expected not to show up. In any case if the messages do show up they'll trigger the excessive messages test so I suppose that's enough. Also, synth up the ChnageLogs… :-), they are trivial enough. Done. And, just pop them all into one patch (cd ..; svn diff), 3 is 3x the work for me. Attached. Once we resolve the 3 warning tests above, this will be ok. Actually, there were a few more { xfail *-*-* } in the other test cases. I've removed these as well. Dimitris Index: gcc/c-family/c.opt === --- gcc/c-family/c.opt (revision 209852) +++ gcc/c-family/c.opt (working copy) @@ -685,7 +685,7 @@ Warn if a selector has multiple methods Wshadow-ivar -ObjC ObjC++ Var(warn_shadow_ivar) Init(1) Warning +ObjC ObjC++ Var(warn_shadow_ivar) EnabledBy(Wshadow) Init(1) Warning Warn if a local declaration hides an instance variable Wsequence-point Index: gcc/doc/invoke.texi === --- gcc/doc/invoke.texi (revision 209852) +++ gcc/doc/invoke.texi (working copy) @@ -216,6 +216,8 @@ -fobjc-gc @gol -fobjc-nilcheck @gol -fobjc-std=objc1 @gol +-fno-local-ivars @gol +-fivar-visibility=@var{public|protected|private|package} @gol -freplace-objc-classes @gol -fzero-link @gol -gen-decls @gol @@ -261,7 +263,7 @@ -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol -Wpointer-arith -Wno-pointer-to-int-cast @gol -Wredundant-decls -Wno-return-local-addr @gol --Wreturn-type -Wsequence-point -Wshadow @gol +-Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol -Wsizeof-pointer-memaccess @gol -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol @@ -2976,6 +2978,22 @@ The GNU runtime currently always retains calls to @code{objc_get_class(@dots{})} regardless of command-line options. +@item -fno-local-ivars +@opindex fno-local-ivars +@opindex flocal-ivars +By default instance variables in Objective-C can be accessed as if +they were local variables from within the methods of the class they're +declared in. This can lead to shadowing between instance variables +and other variables declared either locally inside a class method or +globally with the same name. Specifying the @option{-fno-local-ivars} +flag disables this behavior thus avoiding variable shadowing issues. + +@item -fivar-visibility=@var{public|protected|private|package} +@opindex fivar-visibility +Set the default instance variable visibility to the specified option +so that instance variables declared outside the scope of any access +modifier directives default to the specified visibility. + @item -gen-decls @opindex gen-decls Dump interface declarations for all classes seen in the source file to a @@ -4350,11 +4368,18 @@ @item -Wshadow @opindex Wshadow @opindex Wno-shadow -Warn whenever a local variable or type declaration shadows another variable, -parameter, type, or class member (in C++), or whenever a built-in function -is shadowed. Note that in C++, the compiler warns if a local variable -shadows an explicit typedef, but not if it shadows a struct/class/enum. +Warn whenever a local variable or type declaration shadows another +variable, parameter, type, class member (in C++), or instance variable +(in Objective-C) or whenever a built-in function is shadowed. Note +that in C++, the compiler warns if a local variable shadows an +explicit typedef, but not if it shadows a struct/class/enum. +@item -Wno-shadow-ivar @r{(Objective-C only)} +@opindex Wno-shadow-ivar +@opindex Wshadow-ivar +Do not warn whenever a
Re: [PING^8][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On 04/25/2014 03:54 AM, Mike Stump wrote: On Apr 24, 2014, at 4:16 PM, Dimitris Papavasilioudpapa...@gmail.com wrote: On 04/24/2014 11:17 PM, Jakub Jelinek wrote: How has this been tested? I'm seeing: +FAIL: obj-c++.dg/local-decl-1.mm -fgnu-runtime (test for warnings, line 39) +FAIL: obj-c++.dg/local-decl-1.mm -fgnu-runtime (test for warnings, line 41) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 32) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 33) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 34) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 53) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 54) +FAIL: objc.dg/local-decl-1.m -fgnu-runtime (test for warnings, line 23) +FAIL: objc.dg/local-decl-2.m -fgnu-runtime (test for warnings, line 37) +FAIL: objc.dg/local-decl-2.m -fgnu-runtime (test for warnings, line 39) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 30) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 31) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 32) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 51) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 52) regressions compared to a bootstrap/regtest from a few hours ago on i686-linux (x86_64-linux still regtesting, but the objc.dg/ failures can be seen in the logs already). Jakub These failures are due to the fact that the patch made -Wshadow control the warnings related to instance variable hiding. These were before enabled by default although they were clearly cases of variable shadowing. So, in general, to contribute patches, you will want to run the test suite to ensure quality. We don’t want to remove warnings without good reason… so I’m defaulting them back to on. In your text, you didn’t seem to cover this, other than to note what we do and to say some might want to turn them off. Now, if clang turned them off by default, we can go that way, but I’d like to maintain users expectations of those on. I’m anticipating they have them on by default still. I tried to implement all changes in such a way that the default behavior of GCC wouldn't be changed but this side-effect slipped my attention. I also tried to run the test suite but, as I recall, I was getting errors even on the freshly checked out sources, so I got lazy and gave up on that until the proposed changes were actually approved for merging. Sorry about that. Index: gcc/c-family/c.opt === --- gcc/c-family/c.opt (revision 209755) +++ gcc/c-family/c.opt (working copy) @@ -685,7 +685,7 @@ ObjC ObjC++ Var(warn_selector) Warning Warn if a selector has multiple methods Wshadow-ivar -ObjC ObjC++ Var(warn_shadow_ivar) Init(-1) Warning +ObjC ObjC++ Var(warn_shadow_ivar) Init(1) Warning Warn if a local declaration hides an instance variable Wsequence-point Committed revision 209774. Thanks Jakub for pointing it out. Although this will work to get the expected behavior back it has the slightly annoying side-effect that specifying -Wno-shadow explicitly will *not* turn this particular form of variable shadowing warning off. Might I suggest the following change? Index: gcc/c-family/c.opt === --- gcc/c-family/c.opt (revision 209787) +++ gcc/c-family/c.opt (working copy) @@ -685,7 +685,7 @@ Warn if a selector has multiple methods Wshadow-ivar -ObjC ObjC++ Var(warn_shadow_ivar) Init(1) Warning +ObjC ObjC++ Var(warn_shadow_ivar) EnabledBy(Wshadow) Init(1) Warning Warn if a local declaration hides an instance variable Wsequence-point The GCC Internals documentation is a little vague as to what the value of warn_shadow_ivar will be if Init and EnabledBy are both specified, and -Wshadow is *not* explicitly specified, but tests indicate that we get the desired behavior. That is, the warning is enabled by default but can be disabled both by -Wno-shadow and by -Wno-shadow-ivar. If you adopt this change, let me know so that I can add a testcase for -Wno-shadow as well. Dimitris
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On 04/25/2014 04:07 AM, Mike Stump wrote: On Apr 24, 2014, at 4:09 PM, Dimitris Papavasilioudpapa...@gmail.com wrote: On 04/24/2014 07:00 PM, Mike Stump wrote: On Feb 6, 2014, at 1:25 AM, Dimitris Papavasilioudpapa...@gmail.com wrote: This is a patch regarding a couple of Objective-C related dialect options and warning switches. Ok. Committed revision 209753. If you could, please add documentation and a test case. Thanks for taking the time to look at this, although to be honest I didn't expect a straight merge into the trunk. Don’t submit changes you don’t want! :-) I'll add documentation and test cases as soon as I figure out how. Just copy testsuite/objc.dg/private-2.m into shadow-1.m and then `fix’ it to test what you want. If you need one with and one without a flag, copy it twice and use something like: // { dg-options -Wshadow } on it. Type make RUNTESTFLAGS=dg.exp=shadow-1.m check-objc to test it. For the doc, just find a simple option in the part of the manual you want to put it in, and copy it. We document the non-default, (Wno-shadow-ivar for example) options. I'm attaching three additional patches: documentation.patch: This adds documentation for the three additional switches plus a small change to reflect the fact that -Wshadow now controls instance variable shadowing as well. tests.patch: This adds 9 test cases that test both the intended behavior of the added switches as well as the default behavior in their absence. enabledby_wshadow.patch: This adds the proposed change to allow specifying -Wno-shadow to turn off -Wshadow-ivar as well plus one more test to make sure that it happens. I've run make check-objc with all these changes and everything seems to be fine. Let me know if you need anything else and thanks again for your time. Dimitris Index: gcc/doc/invoke.texi === --- gcc/doc/invoke.texi (revision 209787) +++ gcc/doc/invoke.texi (working copy) @@ -216,6 +216,8 @@ -fobjc-gc @gol -fobjc-nilcheck @gol -fobjc-std=objc1 @gol +-fno-local-ivars @gol +-fivar-visibility=@var{public|protected|private|package} @gol -freplace-objc-classes @gol -fzero-link @gol -gen-decls @gol @@ -261,7 +263,7 @@ -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol -Wpointer-arith -Wno-pointer-to-int-cast @gol -Wredundant-decls -Wno-return-local-addr @gol --Wreturn-type -Wsequence-point -Wshadow @gol +-Wreturn-type -Wsequence-point -Wshadow -Wshadow-ivar @gol -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol -Wsizeof-pointer-memaccess @gol -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol @@ -2975,6 +2977,21 @@ The GNU runtime currently always retains calls to @code{objc_get_class(@dots{})} regardless of command-line options. +@item -fno-local-ivars +@opindex fno-local-ivars +By default instance variables in Objective-C can be accessed as if +they were local variables from within the methods of the class they're +declared in. This can lead to shadowing between instance variables +and other variables declared either locally inside a class method or +globally with the same name. Specifying the @option{-fno-local-ivars} +flag disables this behavior thus avoiding variable shadowing issues. + +@item -fivar-visibility=@var{public|protected|private|package} +@opindex fivar-visibility +Set the default instance variable visibility to the specified option +so that instance variables declared outside the scope of any access +modifier directives default to the specified visibility. + @item -gen-decls @opindex gen-decls Dump interface declarations for all classes seen in the source file to a @@ -4349,11 +4366,18 @@ @item -Wshadow @opindex Wshadow @opindex Wno-shadow -Warn whenever a local variable or type declaration shadows another variable, -parameter, type, or class member (in C++), or whenever a built-in function -is shadowed. Note that in C++, the compiler warns if a local variable -shadows an explicit typedef, but not if it shadows a struct/class/enum. +Warn whenever a local variable or type declaration shadows another +variable, parameter, type, class member (in C++), or instance variable +(in Objective-C) or whenever a built-in function is shadowed. Note +that in C++, the compiler warns if a local variable shadows an +explicit typedef, but not if it shadows a struct/class/enum. +@item -Wshadow-ivar @r{(Objective-C only)} +@opindex Wshadow-ivar +@opindex Wno-shadow-ivar +Warn whenever a local variable shadows an instance variable in an +Objective-C method. + @item -Wlarger-than=@var{len} @opindex Wlarger-than=@var{len} @opindex Wlarger-than-@var{len} Index: gcc/testsuite/objc.dg/shadow-2.m === --- gcc/testsuite/objc.dg/shadow-2.m (revision 0) +++ gcc/testsuite/objc.dg/shadow-2.m (revision 0) @@ -0,0 +1,33 @@ +/* Test disabling of warnings for shadowing instance
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On Apr 25, 2014, at 9:34 AM, Dimitris Papavasiliou dpapa...@gmail.com wrote: --Wreturn-type -Wsequence-point -Wshadow @gol +-Wreturn-type -Wsequence-point -Wshadow -Wshadow-ivar @gol This has to be -Wno-shadow-ivar, we document the non-default… +@item -Wshadow-ivar @r{(Objective-C only)} Likewise. + /* Check wheter the local variable hides the instance variable. */ spelling, whether... + a = private;/* { dg-warning hides instance variable { xfail *-*-* } } */ + a = protected; /* { dg-warning hides instance variable { xfail *-*-* } } */ + a = public; /* { dg-warning hides instance variable { xfail *-*-* } } */ No, we don’t expect failures. We makes the compiler do what we wants or it gets the hose again. Then, we expect it to be perfect. If you won’t want warning, and non are produces, then just remove the /* … */, or write /* no warning */. Also, synth up the ChnageLogs… :-), they are trivial enough. And, just pop them all into one patch (cd ..; svn diff), 3 is 3x the work for me. Once we resolve the 3 warning tests above, this will be ok.
Re: [PING^8][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Ping! Does anybody know the current record of longest ping? I'd like to at least break it before giving up. On 04/03/2014 06:32 PM, Dimitris Papavasiliou wrote: Still pinging. On 03/28/2014 11:58 AM, Dimitris Papavasiliou wrote: Ping! On 03/23/2014 03:20 AM, Dimitris Papavasiliou wrote: Ping! On 03/13/2014 11:54 AM, Dimitris Papavasiliou wrote: Ping! On 03/06/2014 07:44 PM, Dimitris Papavasiliou wrote: Ping! On 02/27/2014 11:44 AM, Dimitris Papavasiliou wrote: Ping! On 02/20/2014 12:11 PM, Dimitris Papavasiliou wrote: Hello all, Pinging this patch review request again. See previous messages quoted below for details. Regards, Dimitris On 02/13/2014 04:22 PM, Dimitris Papavasiliou wrote: Hello, Pinging this patch review request. Can someone involved in the Objective-C language frontend have a quick look at the description of the proposed features and tell me if it'd be ok to have them in the trunk so I can go ahead and create proper patches? Thanks, Dimitris On 02/06/2014 11:25 AM, Dimitris Papavasiliou wrote: Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On Feb 6, 2014, at 1:25 AM, Dimitris Papavasiliou dpapa...@gmail.com wrote: This is a patch regarding a couple of Objective-C related dialect options and warning switches. Ok. Committed revision 209753. If you could, please add documentation and a test case.
Re: [PING^8][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On Thu, Apr 24, 2014 at 01:12:02PM +0300, Dimitris Papavasiliou wrote: Ping! Does anybody know the current record of longest ping? I'd like to at least break it before giving up. How has this been tested? I'm seeing: +FAIL: obj-c++.dg/local-decl-1.mm -fgnu-runtime (test for warnings, line 39) +FAIL: obj-c++.dg/local-decl-1.mm -fgnu-runtime (test for warnings, line 41) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 32) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 33) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 34) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 53) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 54) +FAIL: objc.dg/local-decl-1.m -fgnu-runtime (test for warnings, line 23) +FAIL: objc.dg/local-decl-2.m -fgnu-runtime (test for warnings, line 37) +FAIL: objc.dg/local-decl-2.m -fgnu-runtime (test for warnings, line 39) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 30) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 31) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 32) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 51) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 52) regressions compared to a bootstrap/regtest from a few hours ago on i686-linux (x86_64-linux still regtesting, but the objc.dg/ failures can be seen in the logs already). Jakub
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On 04/24/2014 07:00 PM, Mike Stump wrote: On Feb 6, 2014, at 1:25 AM, Dimitris Papavasiliou dpapa...@gmail.com wrote: This is a patch regarding a couple of Objective-C related dialect options and warning switches. Ok. Committed revision 209753. If you could, please add documentation and a test case. Thanks for taking the time to look at this, although to be honest I didn't expect a straight merge into the trunk. This patch was made quite a few months ago but since your were able to apply it without problems I suppose it was still up-to-date. I took a look at the applied changes and everything seems to be ok. I'll add documentation and test cases as soon as I figure out how. Dimitris
Re: [PING^8][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On 04/24/2014 11:17 PM, Jakub Jelinek wrote: How has this been tested? I'm seeing: +FAIL: obj-c++.dg/local-decl-1.mm -fgnu-runtime (test for warnings, line 39) +FAIL: obj-c++.dg/local-decl-1.mm -fgnu-runtime (test for warnings, line 41) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 32) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 33) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 34) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 53) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 54) +FAIL: objc.dg/local-decl-1.m -fgnu-runtime (test for warnings, line 23) +FAIL: objc.dg/local-decl-2.m -fgnu-runtime (test for warnings, line 37) +FAIL: objc.dg/local-decl-2.m -fgnu-runtime (test for warnings, line 39) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 30) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 31) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 32) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 51) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 52) regressions compared to a bootstrap/regtest from a few hours ago on i686-linux (x86_64-linux still regtesting, but the objc.dg/ failures can be seen in the logs already). Jakub These failures are due to the fact that the patch made -Wshadow control the warnings related to instance variable hiding. These were before enabled by default although they were clearly cases of variable shadowing. If the old behavior is considered preferable I can easily make a patch to revert to it. Otherwise I can try to update these tests by getting them to run with -Wshadow. Dimitris
Re: [PING^8][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On Apr 24, 2014, at 4:16 PM, Dimitris Papavasiliou dpapa...@gmail.com wrote: On 04/24/2014 11:17 PM, Jakub Jelinek wrote: How has this been tested? I'm seeing: +FAIL: obj-c++.dg/local-decl-1.mm -fgnu-runtime (test for warnings, line 39) +FAIL: obj-c++.dg/local-decl-1.mm -fgnu-runtime (test for warnings, line 41) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 32) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 33) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 34) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 53) +FAIL: obj-c++.dg/private-2.mm -fgnu-runtime (test for warnings, line 54) +FAIL: objc.dg/local-decl-1.m -fgnu-runtime (test for warnings, line 23) +FAIL: objc.dg/local-decl-2.m -fgnu-runtime (test for warnings, line 37) +FAIL: objc.dg/local-decl-2.m -fgnu-runtime (test for warnings, line 39) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 30) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 31) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 32) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 51) +FAIL: objc.dg/private-2.m -fgnu-runtime (test for warnings, line 52) regressions compared to a bootstrap/regtest from a few hours ago on i686-linux (x86_64-linux still regtesting, but the objc.dg/ failures can be seen in the logs already). Jakub These failures are due to the fact that the patch made -Wshadow control the warnings related to instance variable hiding. These were before enabled by default although they were clearly cases of variable shadowing. So, in general, to contribute patches, you will want to run the test suite to ensure quality. We don’t want to remove warnings without good reason… so I’m defaulting them back to on. In your text, you didn’t seem to cover this, other than to note what we do and to say some might want to turn them off. Now, if clang turned them off by default, we can go that way, but I’d like to maintain users expectations of those on. I’m anticipating they have them on by default still. Index: gcc/c-family/c.opt === --- gcc/c-family/c.opt (revision 209755) +++ gcc/c-family/c.opt (working copy) @@ -685,7 +685,7 @@ ObjC ObjC++ Var(warn_selector) Warning Warn if a selector has multiple methods Wshadow-ivar -ObjC ObjC++ Var(warn_shadow_ivar) Init(-1) Warning +ObjC ObjC++ Var(warn_shadow_ivar) Init(1) Warning Warn if a local declaration hides an instance variable Wsequence-point Committed revision 209774. Thanks Jakub for pointing it out.
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
On Apr 24, 2014, at 4:09 PM, Dimitris Papavasiliou dpapa...@gmail.com wrote: On 04/24/2014 07:00 PM, Mike Stump wrote: On Feb 6, 2014, at 1:25 AM, Dimitris Papavasiliou dpapa...@gmail.com wrote: This is a patch regarding a couple of Objective-C related dialect options and warning switches. Ok. Committed revision 209753. If you could, please add documentation and a test case. Thanks for taking the time to look at this, although to be honest I didn't expect a straight merge into the trunk. Don’t submit changes you don’t want! :-) I'll add documentation and test cases as soon as I figure out how. Just copy testsuite/objc.dg/private-2.m into shadow-1.m and then `fix’ it to test what you want. If you need one with and one without a flag, copy it twice and use something like: // { dg-options -Wshadow } on it. Type make RUNTESTFLAGS=dg.exp=shadow-1.m check-objc to test it. For the doc, just find a simple option in the part of the manual you want to put it in, and copy it. We document the non-default, (Wno-shadow-ivar for example) options.
Re: [PING^8][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Still pinging. On 03/28/2014 11:58 AM, Dimitris Papavasiliou wrote: Ping! On 03/23/2014 03:20 AM, Dimitris Papavasiliou wrote: Ping! On 03/13/2014 11:54 AM, Dimitris Papavasiliou wrote: Ping! On 03/06/2014 07:44 PM, Dimitris Papavasiliou wrote: Ping! On 02/27/2014 11:44 AM, Dimitris Papavasiliou wrote: Ping! On 02/20/2014 12:11 PM, Dimitris Papavasiliou wrote: Hello all, Pinging this patch review request again. See previous messages quoted below for details. Regards, Dimitris On 02/13/2014 04:22 PM, Dimitris Papavasiliou wrote: Hello, Pinging this patch review request. Can someone involved in the Objective-C language frontend have a quick look at the description of the proposed features and tell me if it'd be ok to have them in the trunk so I can go ahead and create proper patches? Thanks, Dimitris On 02/06/2014 11:25 AM, Dimitris Papavasiliou wrote: Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
Re: [PING^7][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Ping! On 03/23/2014 03:20 AM, Dimitris Papavasiliou wrote: Ping! On 03/13/2014 11:54 AM, Dimitris Papavasiliou wrote: Ping! On 03/06/2014 07:44 PM, Dimitris Papavasiliou wrote: Ping! On 02/27/2014 11:44 AM, Dimitris Papavasiliou wrote: Ping! On 02/20/2014 12:11 PM, Dimitris Papavasiliou wrote: Hello all, Pinging this patch review request again. See previous messages quoted below for details. Regards, Dimitris On 02/13/2014 04:22 PM, Dimitris Papavasiliou wrote: Hello, Pinging this patch review request. Can someone involved in the Objective-C language frontend have a quick look at the description of the proposed features and tell me if it'd be ok to have them in the trunk so I can go ahead and create proper patches? Thanks, Dimitris On 02/06/2014 11:25 AM, Dimitris Papavasiliou wrote: Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
Re: [PING^6][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Ping! On 03/13/2014 11:54 AM, Dimitris Papavasiliou wrote: Ping! On 03/06/2014 07:44 PM, Dimitris Papavasiliou wrote: Ping! On 02/27/2014 11:44 AM, Dimitris Papavasiliou wrote: Ping! On 02/20/2014 12:11 PM, Dimitris Papavasiliou wrote: Hello all, Pinging this patch review request again. See previous messages quoted below for details. Regards, Dimitris On 02/13/2014 04:22 PM, Dimitris Papavasiliou wrote: Hello, Pinging this patch review request. Can someone involved in the Objective-C language frontend have a quick look at the description of the proposed features and tell me if it'd be ok to have them in the trunk so I can go ahead and create proper patches? Thanks, Dimitris On 02/06/2014 11:25 AM, Dimitris Papavasiliou wrote: Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
Re: [PING^4][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Ping! On 03/06/2014 07:44 PM, Dimitris Papavasiliou wrote: Ping! On 02/27/2014 11:44 AM, Dimitris Papavasiliou wrote: Ping! On 02/20/2014 12:11 PM, Dimitris Papavasiliou wrote: Hello all, Pinging this patch review request again. See previous messages quoted below for details. Regards, Dimitris On 02/13/2014 04:22 PM, Dimitris Papavasiliou wrote: Hello, Pinging this patch review request. Can someone involved in the Objective-C language frontend have a quick look at the description of the proposed features and tell me if it'd be ok to have them in the trunk so I can go ahead and create proper patches? Thanks, Dimitris On 02/06/2014 11:25 AM, Dimitris Papavasiliou wrote: Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
Re: [PING^4][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Ping! On 02/27/2014 11:44 AM, Dimitris Papavasiliou wrote: Ping! On 02/20/2014 12:11 PM, Dimitris Papavasiliou wrote: Hello all, Pinging this patch review request again. See previous messages quoted below for details. Regards, Dimitris On 02/13/2014 04:22 PM, Dimitris Papavasiliou wrote: Hello, Pinging this patch review request. Can someone involved in the Objective-C language frontend have a quick look at the description of the proposed features and tell me if it'd be ok to have them in the trunk so I can go ahead and create proper patches? Thanks, Dimitris On 02/06/2014 11:25 AM, Dimitris Papavasiliou wrote: Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
Re: [PING^3][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Ping! On 02/20/2014 12:11 PM, Dimitris Papavasiliou wrote: Hello all, Pinging this patch review request again. See previous messages quoted below for details. Regards, Dimitris On 02/13/2014 04:22 PM, Dimitris Papavasiliou wrote: Hello, Pinging this patch review request. Can someone involved in the Objective-C language frontend have a quick look at the description of the proposed features and tell me if it'd be ok to have them in the trunk so I can go ahead and create proper patches? Thanks, Dimitris On 02/06/2014 11:25 AM, Dimitris Papavasiliou wrote: Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
Re: [PING^2][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Hello all, Pinging this patch review request again. See previous messages quoted below for details. Regards, Dimitris On 02/13/2014 04:22 PM, Dimitris Papavasiliou wrote: Hello, Pinging this patch review request. Can someone involved in the Objective-C language frontend have a quick look at the description of the proposed features and tell me if it'd be ok to have them in the trunk so I can go ahead and create proper patches? Thanks, Dimitris On 02/06/2014 11:25 AM, Dimitris Papavasiliou wrote: Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
Re: [PING][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Hello, Pinging this patch review request. Can someone involved in the Objective-C language frontend have a quick look at the description of the proposed features and tell me if it'd be ok to have them in the trunk so I can go ahead and create proper patches? Thanks, Dimitris On 02/06/2014 11:25 AM, Dimitris Papavasiliou wrote: Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
[PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Hello, This is a patch regarding a couple of Objective-C related dialect options and warning switches. I have already submitted it a while ago but gave up after pinging a couple of times. I am now informed that should have kept pinging until I got someone's attention so I'm resending it. The patch is now against an old revision and as I stated originally it's probably not in a state that can be adopted as is. I'm sending it as is so that the implemented features can be assesed in terms of their usefulness and if they're welcome I'd be happy to make any necessary changes to bring it up-to-date, split it into smaller patches, add test-cases and anything else that is deemed necessary. Here's the relevant text from my initial message: Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris Index: gcc/c-family/c.opt === --- gcc/c-family/c.opt (revision 199867) +++ gcc/c-family/c.opt (working copy) @@ -661,6 +661,10 @@ Wselector ObjC ObjC++ Var(warn_selector) Warning Warn if a selector has multiple methods +Wshadow-ivar +ObjC ObjC++ Var(warn_shadow_ivar) Init(-1) Warning +Warn if a local declaration hides an instance variable + Wsequence-point C ObjC C++ ObjC++ Var(warn_sequence_point) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Warn about possible violations of sequence point rules @@ -1018,6 +1022,29 @@ fnil-receivers ObjC ObjC++ Var(flag_nil_receivers) Init(1) Assume that receivers of Objective-C messages may be nil +flocal-ivars +ObjC ObjC++ Var(flag_local_ivars) Init(1) +Allow access to instance variables as if they were local declarations within instance method implementations. + +fivar-visibility= +ObjC ObjC++ Joined RejectNegative Enum(ivar_visibility) Var(default_ivar_visibility) Init(IVAR_VISIBILITY_PROTECTED) +-fvisibility=[private|protected|public|package] Set the default symbol visibility + +Enum +Name(ivar_visibility) Type(enum ivar_visibility) UnknownError(unrecognized ivar visibility value %qs) + +EnumValue +Enum(ivar_visibility) String(private) Value(IVAR_VISIBILITY_PRIVATE) + +EnumValue +Enum(ivar_visibility) String(protected) Value(IVAR_VISIBILITY_PROTECTED) + +EnumValue +Enum(ivar_visibility) String(public) Value(IVAR_VISIBILITY_PUBLIC) + +EnumValue +Enum(ivar_visibility) String(package)
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Since there obviously is no interest in this patch I'm simply going to attach it to the ticket mentioned below (Bug 56044) in case someone decides to look into it in the future. If anyone should want to comment on this please do so at the bug tracker since I probably won't be following this list. Thanks, Dimitris On 06/24/2013 03:04 PM, Dimitris Papavasiliou wrote: Ping! Would anybody care to comment on this? On 06/10/2013 12:44 AM, Dimitris Papavasiliou wrote: Hello, First, let me say that I have consciously broken most of the rules mentioned about patch submission at gcc.gnu.org but I have done so in order to spare myself from wasting time to provide a proper patch in case the implemented functionality is not deemed worthy of approval and adoption into GCC. If any of the implemented switches prove to be welcome I'll be more than happy to split them into separate patches, add test-cases and add ChangLog entries as needed. Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Ping! Would anybody care to comment on this? On 06/10/2013 12:44 AM, Dimitris Papavasiliou wrote: Hello, First, let me say that I have consciously broken most of the rules mentioned about patch submission at gcc.gnu.org but I have done so in order to spare myself from wasting time to provide a proper patch in case the implemented functionality is not deemed worthy of approval and adoption into GCC. If any of the implemented switches prove to be welcome I'll be more than happy to split them into separate patches, add test-cases and add ChangLog entries as needed. Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris
[PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope
Hello, First, let me say that I have consciously broken most of the rules mentioned about patch submission at gcc.gnu.org but I have done so in order to spare myself from wasting time to provide a proper patch in case the implemented functionality is not deemed worthy of approval and adoption into GCC. If any of the implemented switches prove to be welcome I'll be more than happy to split them into separate patches, add test-cases and add ChangLog entries as needed. Two of these switches are related to a feature request I submitted a while ago, Bug 56044 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044). I won't reproduce the entire argument here since it is available in the feature request. The relevant functionality in the patch comes in the form of two switches: -Wshadow-ivars which controls the local declaration of ‘somevar’ hides instance variable warning which curiously is enabled by default instead of being controlled at least by -Wshadow. The patch changes it so that this warning can be enabled and disabled specifically through -Wshadow-ivars as well as with all other shadowing-related warnings through -Wshadow. The reason for the extra switch is that, while searching through the Internet for a solution to this problem I have found out that other people are inconvenienced by this particular warning as well so it might be useful to be able to turn it off while keeping all the other shadowing-related warnings enabled. -flocal-ivars which when true, as it is by default, treats instance variables as having local scope. If false (-fno-local-ivars) instance variables must always be referred to as self-ivarname and references of ivarname resolve to the local or global scope as usual. I've also taken the opportunity of adding another switch unrelated to the above but related to instance variables: -fivar-visibility which can be set to either private, protected (the default), public and package. This sets the default instance variable visibility which normally is implicitly protected. My use-case for it is basically to be able to set it to public and thus effectively disable this visibility mechanism altogether which I find no use for and therefore have to circumvent. I'm not sure if anyone else feels the same way towards this but I figured it was worth a try. I'm attaching a preliminary patch against the current revision in case anyone wants to have a look. The changes are very small and any blatant mistakes should be immediately obvious. I have to admit to having virtually no knowledge of the internals of GCC but I have tried to keep in line with formatting guidelines and general style as well as looking up the particulars of the way options are handled in the available documentation to avoid blind copy-pasting. I have also tried to test the functionality both in my own (relatively large, or at least not too small) project and with small test programs and everything works as expected. Finallly, I tried running the tests too but these fail to complete both in the patched and unpatched version, possibly due to the way I've configured GCC. Dimitris Index: gcc/c-family/c.opt === --- gcc/c-family/c.opt (revision 199867) +++ gcc/c-family/c.opt (working copy) @@ -661,6 +661,10 @@ Wselector ObjC ObjC++ Var(warn_selector) Warning Warn if a selector has multiple methods +Wshadow-ivar +ObjC ObjC++ Var(warn_shadow_ivar) Init(-1) Warning +Warn if a local declaration hides an instance variable + Wsequence-point C ObjC C++ ObjC++ Var(warn_sequence_point) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Warn about possible violations of sequence point rules @@ -1018,6 +1022,29 @@ fnil-receivers ObjC ObjC++ Var(flag_nil_receivers) Init(1) Assume that receivers of Objective-C messages may be nil +flocal-ivars +ObjC ObjC++ Var(flag_local_ivars) Init(1) +Allow access to instance variables as if they were local declarations within instance method implementations. + +fivar-visibility= +ObjC ObjC++ Joined RejectNegative Enum(ivar_visibility) Var(default_ivar_visibility) Init(IVAR_VISIBILITY_PROTECTED) +-fvisibility=[private|protected|public|package] Set the default symbol visibility + +Enum +Name(ivar_visibility) Type(enum ivar_visibility) UnknownError(unrecognized ivar visibility value %qs) + +EnumValue +Enum(ivar_visibility) String(private) Value(IVAR_VISIBILITY_PRIVATE) + +EnumValue +Enum(ivar_visibility) String(protected) Value(IVAR_VISIBILITY_PROTECTED) + +EnumValue +Enum(ivar_visibility) String(public) Value(IVAR_VISIBILITY_PUBLIC) + +EnumValue +Enum(ivar_visibility) String(package) Value(IVAR_VISIBILITY_PACKAGE) + fnonansi-builtins C++ ObjC++ Var(flag_no_nonansi_builtin, 0) Index: gcc/flag-types.h === --- gcc/flag-types.h (revision 199867) +++ gcc/flag-types.h (working copy) @@ -104,6 +104,16 @@ enum