public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Cc: Douglas Rupp <douglas.b.rupp@gmail.com>,
	Tristan Gingold <tgingold@free.fr>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix multi-statement define for alpha-dec-vms
Date: Mon, 13 Sep 2021 11:11:30 +0200	[thread overview]
Message-ID: <CAFiYyc2UnywZ_=48F6xLO8PUu5Dh4cRan_bOOe5PS_L9p9rzLQ@mail.gmail.com> (raw)
In-Reply-To: <20210912181218.2um4x2netru3kigg@lug-owl.de>

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
>
> --

  reply	other threads:[~2021-09-13  9:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-12 18:12 Jan-Benedict Glaw
2021-09-13  9:11 ` Richard Biener [this message]
2021-09-13 10:19   ` Jan-Benedict Glaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc2UnywZ_=48F6xLO8PUu5Dh4cRan_bOOe5PS_L9p9rzLQ@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=douglas.b.rupp@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jbglaw@lug-owl.de \
    --cc=tgingold@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).