Re: [PATCH][PING] libobjc: Properly handle classes without instance variables in class_copyIvarList ().

2015-01-05 Thread Dimitris Papavasiliou

Ping!

On 12/24/2014 07:28 PM, Dimitris Papavasiliou wrote:

Hello,

The attached patch fixes an issue reported a couple of years ago in Bug
51891 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51891).  The problem
is caused because classes without instance variables have no ivar list
at all, so that their ivars pointer is NULL, but the code in
class_copyIvarList () is unaware of this.

That this is in fact so can be easily verified by checking the code of
class_addIvar in the same source file, where the ivars list is allocated
when the first ivar is added.  The code there also checks for a NULL
ivars pointer.

The patch also adds a simple test-case for this issue.  I think that the
ChangeLog entry should be something along the lines of:

2014-12-24  Dimitris Papavasiliou  dpapa...@gmail.com

  PR libobjc/51891
  * libobjc/ivars.c: Add a check for classes without instance
 variables, which have a NULL ivar list pointer.
  * gcc/testsuite/objc.dg/gnu-api-2-class.m: Add a test case
 for the above change.

I hope I got the formatting right.  I've run make -k check-objc and all
tests pass without problems.

Let me know if there are any problems, or if I can do anything else to
facilitate the acceptance of the patch.

Regards,
Dimitris





[PATCH] libobjc: Properly handle classes without instance variables in class_copyIvarList ().

2014-12-24 Thread Dimitris Papavasiliou

Hello,

The attached patch fixes an issue reported a couple of years ago in Bug 
51891 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51891).  The problem 
is caused because classes without instance variables have no ivar list 
at all, so that their ivars pointer is NULL, but the code in 
class_copyIvarList () is unaware of this.


That this is in fact so can be easily verified by checking the code of 
class_addIvar in the same source file, where the ivars list is allocated 
when the first ivar is added.  The code there also checks for a NULL 
ivars pointer.


The patch also adds a simple test-case for this issue.  I think that the 
ChangeLog entry should be something along the lines of:


   2014-12-24  Dimitris Papavasiliou  dpapa...@gmail.com

 PR libobjc/51891
 * libobjc/ivars.c: Add a check for classes without instance
variables, which have a NULL ivar list pointer.
 * gcc/testsuite/objc.dg/gnu-api-2-class.m: Add a test case
for the above change.

I hope I got the formatting right.  I've run make -k check-objc and all 
tests pass without problems.


Let me know if there are any problems, or if I can do anything else to 
facilitate the acceptance of the patch.


Regards,
Dimitris

Index: gcc/testsuite/objc.dg/gnu-api-2-class.m
===
--- gcc/testsuite/objc.dg/gnu-api-2-class.m	(revision 219054)
+++ gcc/testsuite/objc.dg/gnu-api-2-class.m	(working copy)
@@ -239,6 +239,19 @@
   abort ();
   }
 
+  printf (Testing class_copyIvarList () on class with no instance variables...\n);
+  {
+unsigned int count;
+Ivar * list = class_copyIvarList (objc_getClass (MyOtherSubClass),
+  count);
+
+if (count != 0)
+  abort ();
+
+if (list != NULL)
+  abort ();
+  }
+
   printf (Testing class_copyMethodList ()...\n);
   {
 unsigned int count;
Index: libobjc/ivars.c
===
--- libobjc/ivars.c	(revision 219054)
+++ libobjc/ivars.c	(working copy)
@@ -179,7 +179,7 @@
   struct objc_ivar **returnValue = NULL;
   struct objc_ivar_list* ivar_list;
 
-  if (class_ == Nil  ||  CLS_IS_IN_CONSTRUCTION (class_))
+  if (class_ == Nil  ||  CLS_IS_IN_CONSTRUCTION (class_) || !class_-ivars)
 {
   if (numberOfReturnedIvars)
 	*numberOfReturnedIvars = 0;



Re: [PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope

2014-05-13 Thread Dimitris Papavasiliou

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

2014-05-12 Thread Dimitris Papavasiliou

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

2014-05-12 Thread Dimitris Papavasiliou

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

2014-05-05 Thread Dimitris Papavasiliou

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

2014-04-28 Thread Dimitris Papavasiliou
 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/ChangeLog
===
--- gcc/ChangeLog	(revision 209852)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2014-04-28  Dimitris Papavasiliou  dpapa...@gmail.com
+
+	* doc/invoke.texi: Document new switches -Wno-shadow-ivar,
+	-fno-local-ivars and -fivar-visibility.
+	* c-family/c.opt: Make -Wshadow also implicitly enable
+	-Wshadow-ivar.
+
+
 2014-04-28  Eric Botcazou  ebotca...@adacore.com
 
 	* configure.ac: Tweak GAS check for LEON instructions on SPARC.
Index: gcc/testsuite/ChangeLog
===
--- gcc/testsuite/ChangeLog	(revision 209852)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -1,3 +1,16 @@
+2014-04-28  Dimitris Papavasiliou  dpapa...@gmail.com
+
+	* objc.dg/shadow-1.m: New test.
+	* objc.dg/shadow-2.m: New test.
+	* objc.dg/ivar-scope-1.m: New test.
+	* objc.dg/ivar-scope-2.m: New test.
+	* objc.dg/ivar-scope-3.m: New test.
+	* objc.dg/ivar-scope-4.m: New test.
+	* objc.dg/ivar-visibility-1.m: New test.
+	* objc.dg/ivar-visibility-2.m: New test.
+	* objc.dg/ivar-visibility-3.m: New test.
+	* objc.dg/ivar-visibility-4.m: New test.
+
 2014-03-27  Thomas Koenig  tkoe...@gcc.gnu.org
 
 	PR fortran/59604
Index: gcc/testsuite/objc.dg/ivar-visibility-2.m
===
--- gcc/testsuite/objc.dg/ivar-visibility-2.m	(revision 0)
+++ gcc/testsuite/objc.dg/ivar-visibility-2.m	(revision 0)
@@ -0,0 +1,34 @@
+/* Test instance variable visibility.  */
+/* Author: Dimitris Papavasiliou dpapa...@gmail.com.  */
+/* { dg-do compile } */
+/* { dg-additional-options -fivar-visibility=protected } */
+#include objc/objc.h
+
+@interface MySuperClass
+{
+int someivar;
+}
+@end
+
+@implementation MySuperClass
+@end
+
+
+@interface MyClass : MySuperClass 
+@end
+
+@implementation MyClass
+@end
+
+@interface MyOtherClass
+- (void) test: (MyClass *) object;
+@end
+
+@implementation MyOtherClass
+- (void) test: (MyClass *) object
+{
+  int a;
+
+  a = object-someivar;   /* { dg-error instance variable .someivar. is declared protected } */
+}
+@end
Index: gcc/testsuite/objc.dg/ivar-scope-1.m
===
--- gcc/testsuite/objc.dg/ivar-scope-1.m	(revision 0)
+++ gcc/testsuite/objc.dg/ivar-scope-1.m	(revision 0)
@@ -0,0 +1,24 @@
+/* Test instance variable scope.  */
+/* Author: Dimitris Papavasiliou dpapa...@gmail.com.  */
+/* { dg-do compile } */
+#include objc/objc.h
+
+@interface MyClass
+{
+  int someivar;
+}
+- (void) test;
+@end
+
+@implementation MyClass
+- (void) test
+{
+  int a;
+
+  /* Make sure instance variables do have local scope when
+ -fno-local-ivar isn't specified. */
+  
+  a = self-someivar;  /* No warning or error. */
+  a = someivar;/* No error. */
+}
+@end
Index: gcc/testsuite/objc.dg/ivar-visibility-3.m
===
--- gcc/testsuite/objc.dg/ivar-visibility-3.m	(revision 0)
+++ gcc/testsuite/objc.dg/ivar-visibility-3.m	(revision 0)
@@ -0,0 +1,34 @@
+/* Test instance variable visibility.  */
+/* Author: Dimitris Papavasiliou dpapa...@gmail.com.  */
+/* { dg-do compile } */
+/* { dg-additional-options -fivar-visibility=private } */
+#include objc/objc.h
+
+@interface MySuperClass
+{
+int someivar;
+}
+@end
+
+@implementation MySuperClass
+@end
+
+
+@interface MyClass : MySuperClass 
+@end
+
+@implementation MyClass
+@end
+
+@interface MyOtherClass
+- (void) test: (MyClass *) object;
+@end
+
+@implementation MyOtherClass
+- (void) test: (MyClass *) object
+{
+  int a;
+
+  a = object-someivar;   /* { dg-error instance variable .someivar. is declared private } */
+}
+@end
Index: gcc/testsuite/objc.dg/ivar-scope-2.m
===
--- gcc/testsuite/objc.dg/ivar-scope-2.m	(revision 0)
+++ gcc/testsuite/objc.dg/ivar-scope-2.m	(revision 0)
@@ -0,0 +1,34 @@
+/* Test instance variable scope.  */
+/* Author: Dimitris Papavasiliou dpapa...@gmail.com.  */
+/* { dg-do compile } */
+/* { dg-additional-options -fno-local-ivars } */
+#include objc/objc.h
+
+@interface MyClass
+{
+  int someivar;
+}
+- (void) testscope;
+- (void) testshadowing;
+@end
+
+@implementation MyClass
+- (void) testscope
+{
+  int a;
+
+  a = self-someivar;  /* No warning or error. */
+  a = someivar;/* { dg-error .someivar. undeclared } */
+}
+
+- (void) testshadowing
+{
+  int someivar = 1;
+  int a;
+
+  /* Since instance variables don't have local scope no shadowing
+ should occur. */
+  
+  a = someivar; /* No warning. */
+}
+@end
Index: gcc/testsuite/objc.dg/ivar-visibility-4.m
===
--- gcc/testsuite/objc.dg/ivar-visibility-4.m	(revision 0

Re: [PING^8][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope

2014-04-25 Thread Dimitris Papavasiliou

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

2014-04-25 Thread Dimitris Papavasiliou
 variables.  */
+/* Author: Dimitris Papavasiliou dpapa...@gmail.com.  */
+/* { dg-do compile } */
+/* { dg-additional-options -Wno-shadow } */
+#include objc/objc.h
+
+@interface MyClass
+{
+@private
+  int private;
+
+@protected
+  int protected;
+
+@public
+  int public;
+}
+- (void) test;
+@end
+
+@implementation MyClass
+- (void) test
+{
+  int private = 12;
+  int protected = 12;
+  int public = 12;
+  int a;
+  
+  a = private;/* { dg-warning hides instance variable  { xfail *-*-* } } */
+  a = protected;  /* { dg-warning hides instance variable  { xfail *-*-* } } */
+  a = public; /* { dg-warning hides instance variable  { xfail *-*-* } } */
+}
+@end
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
Index: gcc/testsuite/objc.dg/shadow-1.m
===
--- gcc/testsuite/objc.dg/shadow-1.m	(revision 0)
+++ gcc/testsuite/objc.dg/shadow-1.m	(revision 0)
@@ -0,0 +1,33 @@
+/* Test disabling of warnings for shadowing instance variables.  */
+/* Author: Dimitris Papavasiliou dpapa...@gmail.com.  */
+/* { dg-do compile } */
+/* { dg-additional-options -Wno-shadow-ivar } */
+#include objc/objc.h
+
+@interface MyClass
+{
+@private
+  int private;
+
+@protected
+  int protected;
+
+@public
+  int public;
+}
+- (void) test;
+@end
+
+@implementation MyClass
+- (void) test
+{
+  int private = 12;
+  int protected = 12;
+  int public = 12;
+  int a;
+  
+  a = private;/* { dg-warning hides instance variable  { xfail *-*-* } } */
+  a = protected;  /* { dg-warning hides instance variable  { xfail *-*-* } } */
+  a = public; /* { dg-warning hides instance variable  { xfail *-*-* } } */
+}
+@end
Index: gcc/testsuite/objc.dg/ivar-scope-1.m
===
--- gcc/testsuite/objc.dg/ivar-scope-1.m	(revision 0)
+++ gcc/testsuite/objc.dg/ivar-scope-1.m	(revision 0)
@@ -0,0 +1,21 @@
+/* Test instance variable scope.  */
+/* Author: Dimitris Papavasiliou dpapa...@gmail.com.  */
+/* { dg-do compile } */
+#include objc/objc.h
+
+@interface MyClass
+{
+  int someivar;
+}
+- (void) test;
+@end
+
+@implementation MyClass
+- (void) test
+{
+  int a;
+  
+  a = self-someivar;  /* Ok */
+  a = someivar;/* { dg-error .someivar. undeclared  { xfail *-*-* } } */
+}
+@end
Index: gcc/testsuite/objc.dg/ivar-scope-2.m
===
--- gcc/testsuite/objc.dg/ivar-scope-2.m	(revision 0)
+++ gcc/testsuite/objc.dg/ivar-scope-2.m	(revision 0)
@@ -0,0 +1,34 @@
+/* Test instance variable scope.  */
+/* Author: Dimitris Papavasiliou dpapa...@gmail.com.  */
+/* { dg-do compile } */
+/* { dg-additional-options -fno-local-ivars } */
+#include objc/objc.h
+
+@interface MyClass
+{
+  int someivar;
+}
+- (void) testscope;
+- (void) testshadowing;
+@end
+
+@implementation MyClass
+- (void) testscope
+{
+  int a;
+
+  a = self-someivar;  /* Ok */
+  a = someivar;/* { dg-error .someivar. undeclared } */
+}
+
+- (void) testshadowing
+{
+  int someivar = 1;
+  int a;
+
+  /* Since instance variables don't have local scope no shadowing
+ should occur. */
+  
+  a = someivar;/* { dg-warning hides instance variable  { xfail *-*-* } } */
+}
+@end
Index: gcc/testsuite/objc.dg/ivar-scope-3.m
===
--- gcc/testsuite/objc.dg/ivar-scope-3.m	(revision 0)
+++ gcc/testsuite/objc.dg/ivar-scope-3.m	(revision 0)
@@ -0,0 +1,60 @@
+/* Test instance variable scope.  */
+/* Author: Dimitris Papavasiliou dpapa...@gmail.com.  */
+/* { dg-do run } */
+/* { dg-additional-options -Wno-shadow-ivar } */
+#include ../objc-obj-c++-shared/TestsuiteObject.m
+#include objc/objc.h
+
+extern void abort(void);
+
+int someivar = 1;
+
+@interface MyClass: TestsuiteObject
+{
+  int someivar;
+}
+- (int) get;
+- (int) getHidden;
+@end
+
+@implementation MyClass
+- init
+{
+  someivar = 2;
+
+  return self;
+}
+
+- (int) get
+{
+  return someivar;
+}
+
+- (int) getHidden
+{
+  int someivar = 3;
+  
+  return someivar;
+}
+@end
+
+int main(void)
+{
+  MyClass *object;
+
+  object = [[MyClass alloc] init];
+
+  /* Check whether the instance variable hides the global variable. */
+  
+  if ([object get] != 2) {
+abort();
+  }
+
+  /* Check whether the local variable hides the instance variable. */
+  
+  if ([object getHidden] != 3) {
+abort();
+  }
+
+  return 0;
+}
Index: gcc/testsuite/objc.dg/ivar-scope-4.m
===
--- gcc/testsuite/objc.dg/ivar-scope-4.m	(revision 0)
+++ gcc/testsuite

Re: [PING^8][PATCH] Add a couple of dialect and warning options regarding Objective-C instance variable scope

2014-04-24 Thread Dimitris Papavasiliou
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

2014-04-24 Thread Dimitris Papavasiliou

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

2014-04-24 Thread Dimitris Papavasiliou

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

2014-04-03 Thread Dimitris Papavasiliou

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

2014-03-28 Thread Dimitris Papavasiliou

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

2014-03-22 Thread Dimitris Papavasiliou

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

2014-03-13 Thread Dimitris Papavasiliou

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

2014-03-06 Thread Dimitris Papavasiliou

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

2014-02-27 Thread Dimitris Papavasiliou

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

2014-02-20 Thread Dimitris Papavasiliou

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

2014-02-13 Thread Dimitris Papavasiliou

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

2014-02-06 Thread Dimitris Papavasiliou

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

2013-07-02 Thread Dimitris Papavasiliou
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

2013-06-24 Thread Dimitris Papavasiliou

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

2013-06-09 Thread Dimitris Papavasiliou

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