public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Zack Weinberg <zack@codesourcery.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c/10604: -Wall includes sign conversion warning [3.3 regression] Date: Fri, 02 May 2003 20:56:00 -0000 [thread overview] Message-ID: <20030502205600.10950.qmail@sources.redhat.com> (raw) The following reply was made to PR c/10604; it has been noted by GNATS. From: Zack Weinberg <zack@codesourcery.com> To: ak@suse.de Cc: gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: c/10604: -Wall includes sign conversion warning [3.3 regression] Date: Fri, 02 May 2003 13:47:13 -0700 It looks like this was experimentally changed as part of the C option-parsing rewrite; since it clearly causes problems, it should be put back the way it was. I am testing the appended patch; Mark has approved it for 3.3 if it works. (The patch for 3.4 will be slightly more invasive, because I'm going to get rid of a historical wart at the same time; that will come later.) zw PR c/10604 * c-opts.c (c_common_decode_option <OPT_Wall>): Set warn_sign_compare for C++ only. * doc/invoke.texi: Clarify documentation of -Wsign-compare. * gcc.dg/compare7.c, g++.dg/warn/compare1.C: New testcases. =================================================================== Index: c-opts.c --- c-opts.c 21 Feb 2003 06:12:58 -0000 1.24.6.1 +++ c-opts.c 2 May 2003 20:38:22 -0000 @@ -699,7 +699,8 @@ c_common_decode_option (argc, argv) warn_parentheses = on; warn_return_type = on; warn_sequence_point = on; /* Was C only. */ - warn_sign_compare = on; /* Was C++ only. */ + if (c_language == clk_cplusplus) + warn_sign_compare = on; warn_switch = on; warn_strict_aliasing = on; =================================================================== Index: doc/invoke.texi --- doc/invoke.texi 23 Apr 2003 21:45:32 -0000 1.209.2.26 +++ doc/invoke.texi 2 May 2003 20:44:55 -0000 @@ -2634,8 +2634,8 @@ casts like @code{(unsigned) -1}. @cindex signed and unsigned values, comparison warning Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. -This warning is also enabled by @option{-W}; to get the other warnings -of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}. +This warning is enabled by @option{-W}, and by @option{-Wall} +in C++ only. @item -Waggregate-return @opindex Waggregate-return =================================================================== Index: testsuite/g++.dg/warn/compare1.C --- testsuite/g++.dg/warn/compare1.C 1 Jan 1970 00:00:00 -0000 +++ testsuite/g++.dg/warn/compare1.C 2 May 2003 20:38:23 -0000 @@ -0,0 +1,10 @@ +/* -Wall is supposed to trigger -Wsign-compare for C++. PR 10604. + See also gcc.dg/compare7.c. */ + +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +int f(unsigned a, int b) +{ + return a < b; /* { dg-warning "signed and unsigned" } */ +} =================================================================== Index: testsuite/gcc.dg/compare7.c --- testsuite/gcc.dg/compare7.c 1 Jan 1970 00:00:00 -0000 +++ testsuite/gcc.dg/compare7.c 2 May 2003 20:38:24 -0000 @@ -0,0 +1,10 @@ +/* -Wall is not supposed to trigger -Wsign-compare for C. PR 10604. + See also g++.dg/warn/compare1.C. */ + +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +int f(unsigned a, int b) +{ + return a < b; /* { dg-bogus "signed and unsigned" } */ +}
next reply other threads:[~2003-05-02 20:56 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-05-02 20:56 Zack Weinberg [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-05-03 21:56 Zack Weinberg 2003-05-03 21:48 zack 2003-05-02 22:36 Neil Booth 2003-05-02 18:36 ak
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030502205600.10950.qmail@sources.redhat.com \ --to=zack@codesourcery.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).