This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to pass -pedantic flag to cpplib
- To: nickc at cygnus dot co dot uk
- Subject: Re: Patch to pass -pedantic flag to cpplib
- From: Dave Brolley <brolley at cygnus dot com>
- Date: Fri, 10 Sep 1999 12:08:03 -0400
- CC: gcc-patches at gcc dot gnu dot org
- Organization: Cygnus Solutions Canada Ltd
- References: <199909101424.PAA17680@pathia.cygnus.co.uk>
I don't think that your patch will work with some languages (fortran?) that don't
link to libcpp.a, even when USE_CPPLIB is configured. cpplib inbterfaces can't be
used directly from toplev.c. I suggest the attached patch which uses the same
indirection as the language specific options (namely lang_decode_option) to pass
-pedantic to cpplib.
Dave
Nick Clifton wrote:
> Hi Guys,
>
> I would like submit the following patch for approval. It fixes main
> in toplev.c so that if the -pedantic command line switch has been
> specified it will be passed onto cpplib to enable pedantic warnings
> there. Without this patch a piece of code like this:
>
> #if 0
> #foo
> #endif
Index: toplev.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/toplev.c,v
retrieving revision 1.213
diff -c -p -r1.213 toplev.c
*** toplev.c 1999/09/07 15:20:56 1.213
--- toplev.c 1999/09/10 16:02:43
*************** main (argc, argv)
*** 5125,5133 ****
/* Already been treated above. Do nothing. */
}
else if (!strcmp (str, "pedantic"))
! pedantic = 1;
else if (!strcmp (str, "pedantic-errors"))
! flag_pedantic_errors = pedantic = 1;
else if (!strcmp (str, "quiet"))
quiet_flag = 1;
else if (!strcmp (str, "version"))
--- 5125,5141 ----
/* Already been treated above. Do nothing. */
}
else if (!strcmp (str, "pedantic"))
! {
! pedantic = 1;
! /* This will pass the option to cpplib if it is being used. */
! lang_decode_option (argc - i, argv + i);
! }
else if (!strcmp (str, "pedantic-errors"))
! {
! flag_pedantic_errors = pedantic = 1;
! /* This will pass the option to cpplib if it is being used. */
! lang_decode_option (argc - i, argv + i);
! }
else if (!strcmp (str, "quiet"))
quiet_flag = 1;
else if (!strcmp (str, "version"))