This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/82063] issues with arguments enabled by -Wall
- From: "jim.wilson at linaro dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 31 Aug 2017 21:36:42 +0000
- Subject: [Bug c/82063] issues with arguments enabled by -Wall
- Auto-submitted: auto-generated
- References: <bug-82063-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82063
--- Comment #2 from jim.wilson at linaro dot org ---
On Thu, Aug 31, 2017 at 1:32 PM, manu at gcc dot gnu.org
<gcc-bugzilla@gcc.gnu.org> wrote:
> This is already possible:
> https://gcc.gnu.org/onlinedocs/gccint/Option-properties.html
>
> LangEnabledBy(language, opt)
> LangEnabledBy(language, opt, posarg, negarg)
> ...
>
> See examples in c.opt.
I did already look at examples, and read the docs, and step through
code in the debugger. Posarg and negarg are integers, which are
ignored for options that take a string as an argument. So no, this
doesn't work.
Note in optc-gen.awk, where the handle_generated_option call is
generated, the fourth argument is always NULL. This is "const char
*arg" which is the argument for options that take string arguments.
The fifth argument, int value, is where the posarg/negarg value gets
passed. Also, note, in the file opts-common.c, in the function
set_options, in the case CLVC_STRING, it uses only arg, it does not
use value. Since the posarg/negarg values end up in value here, they
are ignored, and are useless.
I would rather ask why the -Walloc-size-larger-than= option is
(unsuccessfully) being enabled by -Wall. It seems an odd one to try
to enable by default.
Another weirdness I just noticed, the docs say that a size suffix is
optional, but in the function alloc_max_size in calls.c, if no suffix
is specified, it does
unit = 0;
...
w *= unit;
which means the argument always gets ignored unless there is a size
suffix. I think that should be
unit = 1;
instead.