From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8402 invoked by alias); 24 Sep 2010 18:39:34 -0000 Received: (qmail 8328 invoked by uid 22791); 24 Sep 2010 18:39:33 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Sep 2010 18:39:29 +0000 From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/45780] New: Warning for arithmetic operations involving C99 _Bool variable X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 24 Sep 2010 18:40:00 -0000 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: 2010-09/txt/msg02723.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45780 Summary: Warning for arithmetic operations involving C99 _Bool variable Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: ubizjak@gmail.com Pasted from the thread that introduced _Bool in place of "GCC bool": > >> It can be done ultimately, but as a prerequisite, we should have > >> warnings in -Wextra for all of > >> > >> ? boolvar++; ++boolvar; > >> ? boolvar--; --boolvar; > >> ? boolvar = nonbool; > >> ? boolvar & nonbool; boolvar &= nonbool; > >> ? boolvar | nonbool; boolvar |= nonbool; > >> ? boolvar ^ nonbool; boolvar ^= nonbool; > > > > Fair enough. I have CCed Manuel, perhaps he is interested in this warning. > > I am not sure it fits in -Wconversion. -Wbool-arith perhaps? It sounds like a warning for a -Wc90-c99-compat or similar option (possibly in a more specific option such as -Wbool-arith) - pure C99 code has little use for such a warning, it's about code that might be compiled either with C99 _Bool, or with C90 unsigned char, and so needs to avoid cases where they are incompatible. Such an option, similar in spirit to -Wtraditional, could also allow you to get warnings in C99 mode for things currently diagnosed with -std=c90 -pedantic. [1] http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01941.html -- Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.