Further option handling bugs
Neil Booth
neil@daikokuya.co.uk
Tue May 6 20:28:00 GMT 2003
Gerald Pfeifer wrote:-
> I'm afraid the option handling rewrite introduced some further bugs
> in addition to the -Wsigned problem noted last week:
>
> % cat x.c
> void f() { }
> % cat x.cc
> void f() { }
> % /sw/gcc-current/bin/gcc -Wmissing-prototypes -c x.c
> x.c:1: warning: no previous prototype for `f'
> % /sw/gcc-current/bin/g++ -Wmissing-prototypes -c x.cc
> %
>
> -Wmissing-prototypes is documented as a C-only option in doc/invoke.texi
> and is not implemented in g++, but g++ fails to complain.
>
> Likewise for -Wstrict-prototypes.
>
> Neil, would you mind having a look? I'm sure it'll take you less time
> to fix than it took me to spot and track it down. ;-)
Fixed thus.
Neil.
* c-opts.c (COMMAND_LINE_OPTIONS): Reject -Wmissing-prototypes
and -Wstrict-prototypes if C++.
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.42
diff -u -p -r1.42 c-opts.c
--- c-opts.c 3 May 2003 21:44:25 -0000 1.42
+++ c-opts.c 6 May 2003 20:26:26 -0000
@@ -205,7 +205,7 @@ static void finish_options PARAMS ((void
OPT("Wmissing-braces", CL_ALL, OPT_Wmissing_braces) \
OPT("Wmissing-declarations", CL_C, OPT_Wmissing_declarations) \
OPT("Wmissing-format-attribute",CL_ALL, OPT_Wmissing_format_attribute) \
- OPT("Wmissing-prototypes", CL_ALL, OPT_Wmissing_prototypes) \
+ OPT("Wmissing-prototypes", CL_C, OPT_Wmissing_prototypes) \
OPT("Wmultichar", CL_ALL, OPT_Wmultichar) \
OPT("Wnested-externs", CL_C, OPT_Wnested_externs) \
OPT("Wnon-template-friend", CL_CXX, OPT_Wnon_template_friend) \
@@ -224,7 +224,7 @@ static void finish_options PARAMS ((void
OPT("Wsequence-point", CL_C, OPT_Wsequence_point) \
OPT("Wsign-compare", CL_ALL, OPT_Wsign_compare) \
OPT("Wsign-promo", CL_CXX, OPT_Wsign_promo) \
- OPT("Wstrict-prototypes", CL_ALL, OPT_Wstrict_prototypes) \
+ OPT("Wstrict-prototypes", CL_C, OPT_Wstrict_prototypes) \
OPT("Wsynth", CL_CXX, OPT_Wsynth) \
OPT("Wsystem-headers", CL_ALL, OPT_Wsystem_headers) \
OPT("Wtraditional", CL_C, OPT_Wtraditional) \
More information about the Gcc
mailing list