Fix multi-statement define for alpha-dec-vms

Message ID 20210912181218.2um4x2netru3kigg@lug-owl.de
State New
Headers show
Series
  • Fix multi-statement define for alpha-dec-vms
Related show

Commit Message

Jan-Benedict Glaw Sept. 12, 2021, 6:12 p.m.
Hi!

While mass-building a cross-gcc, I noticed that for
alpha-dec-vms/alpha64-dec-vms, recent GCC versions correctly throw a warning
due to a multi-statement define that gets rippen in an if/else case:

[all 2021-09-12 15:51:55] /usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o value-prof.o -MT value-prof.o -MMD -MP -MF ./.deps/value-prof.TPo ../../gcc/gcc/value-prof.c
[all 2021-09-12 15:52:01] /usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o var-tracking.o -MT var-tracking.o -MMD -MP -MF ./.deps/var-tracking.TPo ../../gcc/gcc/var-tracking.c
[all 2021-09-12 15:52:03] In file included from ./tm.h:21,
[all 2021-09-12 15:52:03]                  from ../../gcc/gcc/backend.h:28,
[all 2021-09-12 15:52:03]                  from ../../gcc/gcc/var-tracking.c:91:
[all 2021-09-12 15:52:03] ../../gcc/gcc/var-tracking.c: In function 'void prepare_call_arguments(basic_block, rtx_insn*)':
[all 2021-09-12 15:52:03] ../../gcc/gcc/config/alpha/vms.h:148:3: error: macro expands to multiple statements [-Werror=multistatement-macros]
[all 2021-09-12 15:52:03]   148 |   (CUM).num_args = 0;                                           \
[all 2021-09-12 15:52:03]       |   ^
[all 2021-09-12 15:52:03] ../../gcc/gcc/var-tracking.c:6334:17: note: in expansion of macro 'INIT_CUMULATIVE_ARGS'
[all 2021-09-12 15:52:03]  6334 |                 INIT_CUMULATIVE_ARGS (args_so_far_v, type, NULL_RTX, fndecl,
[all 2021-09-12 15:52:03]       |                 ^~~~~~~~~~~~~~~~~~~~
[all 2021-09-12 15:52:03] ../../gcc/gcc/var-tracking.c:6332:15: note: some parts of macro expansion are not guarded by this 'else' clause
[all 2021-09-12 15:52:03]  6332 |               else
[all 2021-09-12 15:52:03]       |               ^~~~
[all 2021-09-12 15:52:20] cc1plus: all warnings being treated as errors
[all 2021-09-12 15:52:20] make[1]: *** [Makefile:1143: var-tracking.o] Error 1
[all 2021-09-12 15:52:20] make[1]: Leaving directory '/var/lib/laminar/run/gcc-alpha64-dec-vms/8/toolchain-build/gcc'
[all 2021-09-12 15:52:20] make: *** [Makefile:4425: all-gcc] Error 2




gcc/ChangeLog:

	* config/alpha/vms.h (INIT_CUMULATIVE_ARGS): Wrap multi-statment
	define into a block.





Okay for trunk?

Thanks,
  Jan-Benedict

--

Comments

apinski--- via Gcc-patches Sept. 13, 2021, 9:11 a.m. | #1
On Sun, Sep 12, 2021 at 8:12 PM Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
>

> Hi!

>

> While mass-building a cross-gcc, I noticed that for

> alpha-dec-vms/alpha64-dec-vms, recent GCC versions correctly throw a warning

> due to a multi-statement define that gets rippen in an if/else case:

>

> [all 2021-09-12 15:51:55] /usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o value-prof.o -MT value-prof.o -MMD -MP -MF ./.deps/value-prof.TPo ../../gcc/gcc/value-prof.c

> [all 2021-09-12 15:52:01] /usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o var-tracking.o -MT var-tracking.o -MMD -MP -MF ./.deps/var-tracking.TPo ../../gcc/gcc/var-tracking.c

> [all 2021-09-12 15:52:03] In file included from ./tm.h:21,

> [all 2021-09-12 15:52:03]                  from ../../gcc/gcc/backend.h:28,

> [all 2021-09-12 15:52:03]                  from ../../gcc/gcc/var-tracking.c:91:

> [all 2021-09-12 15:52:03] ../../gcc/gcc/var-tracking.c: In function 'void prepare_call_arguments(basic_block, rtx_insn*)':

> [all 2021-09-12 15:52:03] ../../gcc/gcc/config/alpha/vms.h:148:3: error: macro expands to multiple statements [-Werror=multistatement-macros]

> [all 2021-09-12 15:52:03]   148 |   (CUM).num_args = 0;                                           \

> [all 2021-09-12 15:52:03]       |   ^

> [all 2021-09-12 15:52:03] ../../gcc/gcc/var-tracking.c:6334:17: note: in expansion of macro 'INIT_CUMULATIVE_ARGS'

> [all 2021-09-12 15:52:03]  6334 |                 INIT_CUMULATIVE_ARGS (args_so_far_v, type, NULL_RTX, fndecl,

> [all 2021-09-12 15:52:03]       |                 ^~~~~~~~~~~~~~~~~~~~

> [all 2021-09-12 15:52:03] ../../gcc/gcc/var-tracking.c:6332:15: note: some parts of macro expansion are not guarded by this 'else' clause

> [all 2021-09-12 15:52:03]  6332 |               else

> [all 2021-09-12 15:52:03]       |               ^~~~

> [all 2021-09-12 15:52:20] cc1plus: all warnings being treated as errors

> [all 2021-09-12 15:52:20] make[1]: *** [Makefile:1143: var-tracking.o] Error 1

> [all 2021-09-12 15:52:20] make[1]: Leaving directory '/var/lib/laminar/run/gcc-alpha64-dec-vms/8/toolchain-build/gcc'

> [all 2021-09-12 15:52:20] make: *** [Makefile:4425: all-gcc] Error 2

>

>

>

>

> gcc/ChangeLog:

>

>         * config/alpha/vms.h (INIT_CUMULATIVE_ARGS): Wrap multi-statment

>         define into a block.

>

>

> diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h

> index b8673b6b6fb..e979aef10c7 100644

> --- a/gcc/config/alpha/vms.h

> +++ b/gcc/config/alpha/vms.h

> @@ -145,9 +145,13 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;

>

>  #undef INIT_CUMULATIVE_ARGS

>  #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \

> -  (CUM).num_args = 0;                                          \

> -  (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64;   \

> -  (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;

> +  do                                                                       \

> +    {                                                                      \

> +      (CUM).num_args = 0;                                                  \

> +      (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64;           \

> +      (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;           \

> +    }                                                                      \

> +  while (0)

>

>  #define DEFAULT_PCC_STRUCT_RETURN 0

>

>

>

>

> Okay for trunk?


OK.

Thanks,
Richard.

> Thanks,

>   Jan-Benedict

>

> --
Jan-Benedict Glaw Sept. 13, 2021, 10:19 a.m. | #2
Hi!

On Mon, 2021-09-13 11:11:30 +0200, Richard Biener <richard.guenther@gmail.com> wrote:
> On Sun, Sep 12, 2021 at 8:12 PM Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:

> > gcc/ChangeLog:

> >

> >         * config/alpha/vms.h (INIT_CUMULATIVE_ARGS): Wrap multi-statment

> >         define into a block.

> OK.


Committed, thanks!

MfG, JBG

--

Patch

diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index b8673b6b6fb..e979aef10c7 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -145,9 +145,13 @@  typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
 
 #undef INIT_CUMULATIVE_ARGS
 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
-  (CUM).num_args = 0;						\
-  (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64;	\
-  (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
+  do                                                                       \
+    {                                                                      \
+      (CUM).num_args = 0;                                                  \
+      (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64;           \
+      (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;           \
+    }                                                                      \
+  while (0)
 
 #define DEFAULT_PCC_STRUCT_RETURN 0