public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] nvptx: Silence unused variable warning
Date: Wed, 31 Aug 2022 09:41:28 -0600	[thread overview]
Message-ID: <80a3a209-efd5-fa9d-8079-ca75c82c16e9@gmail.com> (raw)
In-Reply-To: <20220828110925.gxuejmyvilvqy66h@lug-owl.de>



On 8/28/2022 5:09 AM, Jan-Benedict Glaw wrote:
> Hi!
>
> The nvptx backend defines ASM_OUTPUT_DEF along with
> ASM_OUTPUT_DEF_FROM_DECLS.  Much like the rs6000 coff target, nvptx
> triggers an unused variable warning:
>
> /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 -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 varasm.o -MT varasm.o -MMD -MP -MF ./.deps/varasm.TPo ../../gcc/gcc/varasm.cc
> ../../gcc/gcc/varasm.cc: In function 'void output_constant_pool_contents(rtx_constant_pool*)':
> ../../gcc/gcc/varasm.cc:4318:21: error: unused variable 'name' [-Werror=unused-variable]
>   4318 |         const char *name = XSTR (desc->sym, 0);
>        |                     ^~~~
> cc1plus: all warnings being treated as errors
> make[1]: *** [Makefile:1145: varasm.o] Error 1
>
>
> Fixed the same way:
>
> diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
> index ed72c253191..71297440566 100644
> --- a/gcc/config/nvptx/nvptx.h
> +++ b/gcc/config/nvptx/nvptx.h
> @@ -321,6 +321,9 @@ struct GTY(()) machine_function
>   #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)	\
>     do						\
>       {						\
> +      (void) (FILE);				\
> +      (void) (LABEL1);				\
> +      (void) (LABEL2);				\
>         gcc_unreachable ();			\
>       }						\
>     while (0)
>
>
> Ok for HEAD?
OK with a ChangeLog entry.

jeff


  reply	other threads:[~2022-08-31 15:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-28 11:09 Jan-Benedict Glaw
2022-08-31 15:41 ` Jeff Law [this message]
2022-09-06 10:41 ` Tom de Vries

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=80a3a209-efd5-fa9d-8079-ca75c82c16e9@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).