diff mbox

[libcpp] use CPP_PEDANTIC

Message ID CAJXstsD7Maawb8yD8e-M28HNoX_fz=fd2QYk0RP9u-NgGvu-Sg@mail.gmail.com
State New
Headers show

Commit Message

Prathamesh Kulkarni April 25, 2014, 6:57 a.m. UTC
Use macro CPP_PEDANTIC (PF) instead of directly using
it's definition: CPP_OPTION (PF, cpp_pedantic).

[libcpp]
* directives.c (_cpp_handle_directive): Use CPP_PEDANTIC macro.
* macro.c (parse_params): Likewise.

Bootstrapped on x86_64-unknown-linux-gnu.
OK for trunk ?

Thanks and Regards,
Prathamesh

Comments

Tom Tromey April 25, 2014, 5:49 p.m. UTC | #1
>>>>> "Prathamesh" == Prathamesh Kulkarni <bilbotheelffriend@gmail.com> writes:

Prathamesh> Use macro CPP_PEDANTIC (PF) instead of directly using
Prathamesh> it's definition: CPP_OPTION (PF, cpp_pedantic).

I'm curious why you want this.

Prathamesh> [libcpp]
Prathamesh> * directives.c (_cpp_handle_directive): Use CPP_PEDANTIC macro.
Prathamesh> * macro.c (parse_params): Likewise.

Prathamesh> Bootstrapped on x86_64-unknown-linux-gnu.
Prathamesh> OK for trunk ?

Regardless of why, it is ok.

If it is just for clarity, though, I suppose I wonder why CPP_PEDANTIC
and CPP_WTRADITIONAL are given special definitions.  Perhaps instead
they should be removed in favor of just CPP_OPTION everywhere.  Though
this also seems of marginal usefulness.

Tom
Prathamesh Kulkarni April 25, 2014, 5:56 p.m. UTC | #2
On Fri, Apr 25, 2014 at 11:19 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Prathamesh" == Prathamesh Kulkarni <bilbotheelffriend@gmail.com> writes:
>
> Prathamesh> Use macro CPP_PEDANTIC (PF) instead of directly using
> Prathamesh> it's definition: CPP_OPTION (PF, cpp_pedantic).
>
> I'm curious why you want this.
CPP_PEDANTIC is used everywhere else in libcpp, so I thought it would
be better to use CPP_PEDANTIC
in these cases for consistency.
>
> Prathamesh> [libcpp]
> Prathamesh> * directives.c (_cpp_handle_directive): Use CPP_PEDANTIC macro.
> Prathamesh> * macro.c (parse_params): Likewise.
>
> Prathamesh> Bootstrapped on x86_64-unknown-linux-gnu.
> Prathamesh> OK for trunk ?
>
> Regardless of why, it is ok.
>
> If it is just for clarity, though, I suppose I wonder why CPP_PEDANTIC
> and CPP_WTRADITIONAL are given special definitions.  Perhaps instead
> they should be removed in favor of just CPP_OPTION everywhere.  Though
> this also seems of marginal usefulness.
>
> Tom
diff mbox

Patch

Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 209778)
+++ libcpp/directives.c	(working copy)
@@ -403,7 +403,7 @@  _cpp_handle_directive (cpp_reader *pfile
 
   if (was_parsing_args)
     {
-      if (CPP_OPTION (pfile, cpp_pedantic))
+      if (CPP_PEDANTIC (pfile))
 	cpp_error (pfile, CPP_DL_PEDWARN,
 	     "embedding a directive within macro arguments is not portable");
       pfile->state.parsing_args = 0;
Index: libcpp/macro.c
===================================================================
--- libcpp/macro.c	(revision 209778)
+++ libcpp/macro.c	(working copy)
@@ -2794,13 +2794,13 @@  parse_params (cpp_reader *pfile, cpp_mac
 				   pfile->spec_nodes.n__VA_ARGS__);
 	      pfile->state.va_args_ok = 1;
 	      if (! CPP_OPTION (pfile, c99)
-		  && CPP_OPTION (pfile, cpp_pedantic)
+		  && CPP_PEDANTIC (pfile)
 		  && CPP_OPTION (pfile, warn_variadic_macros))
 		cpp_pedwarning
                   (pfile, CPP_W_VARIADIC_MACROS,
 		   "anonymous variadic macros were introduced in C99");
 	    }
-	  else if (CPP_OPTION (pfile, cpp_pedantic)
+	  else if (CPP_PEDANTIC (pfile)
 		   && CPP_OPTION (pfile, warn_variadic_macros))
 	    cpp_pedwarning (pfile, CPP_W_VARIADIC_MACROS,
 		            "ISO C does not permit named variadic macros");