public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Joseph S. Myers" <jsm28@cam.ac.uk> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c/9072: -Wconversion should be split into two distinct flags Date: Sun, 29 Dec 2002 04:06:00 -0000 [thread overview] Message-ID: <20021229120601.5594.qmail@sources.redhat.com> (raw) The following reply was made to PR c/9072; it has been noted by GNATS. From: "Joseph S. Myers" <jsm28@cam.ac.uk> To: Zack Weinberg <zack@codesourcery.com> Cc: Segher Boessenkool <segher@koffie.nl>, <128950@bugs.debian.org>, <gcc-patches@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org>, <debian-gcc@lists.debian.org> Subject: Re: c/9072: -Wconversion should be split into two distinct flags Date: Sun, 29 Dec 2002 11:59:26 +0000 (GMT) On Sun, 29 Dec 2002, Zack Weinberg wrote: > I'm very much in favor of making -Wconversion more useful, but is > there any reason not to shift the argument-type-conversion warnings > entirely over to -Wtraditional? Particularly if the warning is > avoided for prototypes in system headers (so that 'sinf' and the like > raise no complaints) -- this would, for instance, catch the occasional > problem we have with arguments of type 'bool' in GCC itself. > > Then -Wconversion would be entirely for dubious type conversions on > assignment. I believe -Wconversion should have exactly the following simple specification: warn for any implicit conversion that may change a value. This implies -Wsign-compare, parts of the existing -Wconversion (but not those for widening through prototype, etc.), and various cases that there isn't currently a warning option for (e.g. assigning a signed int to an unsigned int), and would be useful for security auditing. The same intelligence used by -Wsign-compare to avoid warning where problems cannot in fact arise (e.g. comparing a constant positive signed integer to an unsigned integer) should be used. Depending on how many warnings this generates for reasonable code, there may need to be options to disable individual parts (beyond the existing -Wno-sign-compare). Some parts of this might also be useful in -Wtraditional. Such a -Wconversion implementation would need thorough testcases (probably a few hundred lines, likely rather longer than the rest of the patch) for all the different cases of implicit conversion that do warn, or don't warn because that type conversion can't change values, or don't warn because that conversion is converting a constant (etc.) to the same value. -- Joseph S. Myers jsm28@cam.ac.uk
next reply other threads:[~2002-12-29 12:06 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-12-29 4:06 Joseph S. Myers [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-02-03 16:36 Wolfgang Bangerth 2003-02-03 2:36 Agthorr 2003-02-03 2:06 Segher Boessenkool 2003-02-03 0:16 Joseph S. Myers 2003-02-02 22:54 bangerth 2002-12-29 1:06 Zack Weinberg 2002-12-29 0:56 Segher Boessenkool 2002-12-29 0:46 Zack Weinberg 2002-12-28 22:16 Segher Boessenkool 2002-12-27 15:36 Matthias Klose
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=20021229120601.5594.qmail@sources.redhat.com \ --to=jsm28@cam.ac.uk \ --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).