From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15265 invoked by alias); 19 Jan 2013 22:29:25 -0000 Received: (qmail 15215 invoked by uid 48); 19 Jan 2013 22:29:10 -0000 From: "dpapavas at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug objc/56044] Add dialect option to gobjc to prevent instance variables from posing as local variables inside methods. Date: Sat, 19 Jan 2013 22:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: objc X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: dpapavas at gmail dot com X-Bugzilla-Status: WAITING X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg01851.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044 --- Comment #4 from Dimitris Papavasiliou 2013-01-19 22:29:10 UTC --- I have considered -Wshadow and this is the way I think I'll go for now because thinking up of variable names is hard enough without having to think of synonyms on top. The problems with -Wshadow are that: 1) It also disables other warnings about variable shadowing which are pretty useful and 2) It doesn't solve the opposite side of the problem: If you decide not to use this instance-var-as-auto convention then if for some reason, say due to a typo, you do use it inadvertently the compiler will not complain but silently do something you didn't mean to do. (BTW while researching this in hope of finding something like the requested switch, I've found numerous other complaints and questions along the same lines so it seems it would be useful to others as well). Testcase attached. Just use it with gcc -c autoivar.m Let me know if there's anything more I can do to help.