This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] Fix new -Wparentheses warnings encountered during bootstrap


On Thu, Mar 31, 2016 at 04:53:45PM -0400, Patrick Palka wrote:
> @@ -2526,12 +2526,13 @@ struct GTY(()) lang_decl {
>  
>    */
>  #define FOR_EACH_CLONE(CLONE, FN)			\
> -  if (TREE_CODE (FN) == FUNCTION_DECL			\
> -      && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN)	\
> -	  || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN)))	\
> -     for (CLONE = DECL_CHAIN (FN);			\
> -	  CLONE && DECL_CLONED_FUNCTION_P (CLONE);	\
> -	  CLONE = DECL_CHAIN (CLONE))
> +  if (!(TREE_CODE (FN) == FUNCTION_DECL			\
> +	&& (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN)	\
> +	    || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))))\
> +    ;							\
> +  else for (CLONE = DECL_CHAIN (FN);			\
> +	    CLONE && DECL_CLONED_FUNCTION_P (CLONE);	\
> +	    CLONE = DECL_CHAIN (CLONE))

Can you please do
+  else							\
+    for (CLONE = DECL_CHAIN (FN);			\
...
instead?

> --- a/gcc/testsuite/g++.dg/plugin/pragma_plugin.c
> +++ b/gcc/testsuite/g++.dg/plugin/pragma_plugin.c
> @@ -32,14 +32,16 @@ handle_pragma_sayhello (cpp_reader *dummy)
>        return;
>      }
>    if (TREE_STRING_LENGTH (message) > 1)
> -    if (cfun)
> -      warning (OPT_Wpragmas, 
> -	      "%<pragma GCCPLUGIN sayhello%> from function %qE: %s",
> -	      cfun->decl, TREE_STRING_POINTER (message));
> +    {
> +      if (cfun)
> +        warning (OPT_Wpragmas, 
> +	        "%<pragma GCCPLUGIN sayhello%> from function %qE: %s",
> +	        cfun->decl, TREE_STRING_POINTER (message));
>        else
> -	warning (OPT_Wpragmas, 
> +        warning (OPT_Wpragmas, 
>  	    "%<pragma GCCPLUGIN sayhello%> outside of function: %s",
>  	    TREE_STRING_POINTER (message));
> +    }

Several lines with 8 spaces instead of tab above.  Can you also indent
the last warning's following lines to be below OPT_?

Otherwise LGTM.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]