public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Mark ASM_OUTPUT_FUNCTION_LABEL ()'s DECL argument as used
@ 2024-01-15  9:22 Ilya Leoshkevich
  2024-01-17  2:32 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Leoshkevich @ 2024-01-15  9:22 UTC (permalink / raw)
  To: Jeff Law, Jakub Jelinek
  Cc: Jan-Benedict Glaw, Andreas Krebbel, gcc-patches,
	Stefan Schulze Frielinghaus, Ilya Leoshkevich

Compile tested for the ia64-elf target; bootstrap and regtest running
on x86_64-redhat-linux.  Ok for trunk when successful?



ia64-elf build fails with the following warning:

	[all 2024-01-12 16:32:34] ../../gcc/gcc/config/ia64/ia64.cc:3889:59: error: unused parameter 'decl' [-Werror=unused-parameter]
	[all 2024-01-12 16:32:34]  3889 | ia64_start_function (FILE *file, const char *fnname, tree decl)

decl is passed to ASM_OUTPUT_FUNCTION_LABEL (), whose default
implementation does not use it.  Mark it as used in order to avoid the
warning.

Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Suggested-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Fixes: c659dd8bfb55 ("Implement ASM_DECLARE_FUNCTION_NAME using ASM_OUTPUT_FUNCTION_LABEL")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>

gcc/ChangeLog:

	* defaults.h (ASM_OUTPUT_FUNCTION_LABEL): Mark DECL as used.
---
 gcc/defaults.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 92f3e07f742..1a2ea68a543 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -149,8 +149,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    NAME, such as the label on a function.  */
 
 #ifndef ASM_OUTPUT_FUNCTION_LABEL
-#define ASM_OUTPUT_FUNCTION_LABEL(FILE, NAME, DECL) \
-  assemble_function_label_raw ((FILE), (NAME))
+#define ASM_OUTPUT_FUNCTION_LABEL(FILE, NAME, DECL)	\
+  do {							\
+    (void) (DECL);					\
+    assemble_function_label_raw ((FILE), (NAME));	\
+  } while (0)
 #endif
 
 /* Output the definition of a compiler-generated label named NAME.  */
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Mark ASM_OUTPUT_FUNCTION_LABEL ()'s DECL argument as used
  2024-01-15  9:22 [PATCH] Mark ASM_OUTPUT_FUNCTION_LABEL ()'s DECL argument as used Ilya Leoshkevich
@ 2024-01-17  2:32 ` Jeff Law
  2024-01-23 10:10   ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2024-01-17  2:32 UTC (permalink / raw)
  To: Ilya Leoshkevich, Jeff Law, Jakub Jelinek
  Cc: Jan-Benedict Glaw, Andreas Krebbel, gcc-patches,
	Stefan Schulze Frielinghaus

[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]



On 1/15/24 02:22, Ilya Leoshkevich wrote:
> Compile tested for the ia64-elf target; bootstrap and regtest running
> on x86_64-redhat-linux.  Ok for trunk when successful?
> 
> 
> 
> ia64-elf build fails with the following warning:
> 
> 	[all 2024-01-12 16:32:34] ../../gcc/gcc/config/ia64/ia64.cc:3889:59: error: unused parameter 'decl' [-Werror=unused-parameter]
> 	[all 2024-01-12 16:32:34]  3889 | ia64_start_function (FILE *file, const char *fnname, tree decl)
> 
> decl is passed to ASM_OUTPUT_FUNCTION_LABEL (), whose default
> implementation does not use it.  Mark it as used in order to avoid the
> warning.
> 
> Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
> Suggested-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
> Fixes: c659dd8bfb55 ("Implement ASM_DECLARE_FUNCTION_NAME using ASM_OUTPUT_FUNCTION_LABEL")
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> 
> gcc/ChangeLog:
> 
> 	* defaults.h (ASM_OUTPUT_FUNCTION_LABEL): Mark DECL as used.
So normally the way to go is to just remove the unused argument's name, 
leaving its type.  But in this case we're passing the unused argument 
into a generic macro.

So ISTM the better way to go here is decorate the argument with 
ATTRIBUTE_UNUSED in ia64.cc.  This has the ever-so-slight advantage that 
if/when the ia64 port goes away that the hack goes away too.

Something like the attached, which I'd consider pre-approved.

Jeff

[-- Attachment #2: PQ --]
[-- Type: text/plain, Size: 484 bytes --]

diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
index 53a4444d03b..a2011a9a811 100644
--- a/gcc/config/ia64/ia64.cc
+++ b/gcc/config/ia64/ia64.cc
@@ -3886,7 +3886,7 @@ ia64_expand_prologue (void)
 /* Output the textual info surrounding the prologue.  */
 
 void
-ia64_start_function (FILE *file, const char *fnname, tree decl)
+ia64_start_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)
 {
 #if TARGET_ABI_OPEN_VMS
   vms_start_function (fnname);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Mark ASM_OUTPUT_FUNCTION_LABEL ()'s DECL argument as used
  2024-01-17  2:32 ` Jeff Law
@ 2024-01-23 10:10   ` Jakub Jelinek
  2024-01-23 13:18     ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2024-01-23 10:10 UTC (permalink / raw)
  To: Jeff Law
  Cc: Ilya Leoshkevich, Jeff Law, Jan-Benedict Glaw, Andreas Krebbel,
	gcc-patches, Stefan Schulze Frielinghaus

On Tue, Jan 16, 2024 at 07:32:03PM -0700, Jeff Law wrote:
> 
> 
> On 1/15/24 02:22, Ilya Leoshkevich wrote:
> > Compile tested for the ia64-elf target; bootstrap and regtest running
> > on x86_64-redhat-linux.  Ok for trunk when successful?
> > 
> > 
> > 
> > ia64-elf build fails with the following warning:
> > 
> > 	[all 2024-01-12 16:32:34] ../../gcc/gcc/config/ia64/ia64.cc:3889:59: error: unused parameter 'decl' [-Werror=unused-parameter]
> > 	[all 2024-01-12 16:32:34]  3889 | ia64_start_function (FILE *file, const char *fnname, tree decl)
> > 
> > decl is passed to ASM_OUTPUT_FUNCTION_LABEL (), whose default
> > implementation does not use it.  Mark it as used in order to avoid the
> > warning.
> > 
> > Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
> > Suggested-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
> > Fixes: c659dd8bfb55 ("Implement ASM_DECLARE_FUNCTION_NAME using ASM_OUTPUT_FUNCTION_LABEL")
> > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> > 
> > gcc/ChangeLog:
> > 
> > 	* defaults.h (ASM_OUTPUT_FUNCTION_LABEL): Mark DECL as used.
> So normally the way to go is to just remove the unused argument's name,
> leaving its type.  But in this case we're passing the unused argument into a
> generic macro.
> 
> So ISTM the better way to go here is decorate the argument with
> ATTRIBUTE_UNUSED in ia64.cc.  This has the ever-so-slight advantage that
> if/when the ia64 port goes away that the hack goes away too.
> 
> Something like the attached, which I'd consider pre-approved.
> 
> Jeff

> diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
> index 53a4444d03b..a2011a9a811 100644
> --- a/gcc/config/ia64/ia64.cc
> +++ b/gcc/config/ia64/ia64.cc
> @@ -3886,7 +3886,7 @@ ia64_expand_prologue (void)
>  /* Output the textual info surrounding the prologue.  */
>  
>  void
> -ia64_start_function (FILE *file, const char *fnname, tree decl)
> +ia64_start_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)

Except the too long line sure, that is what I'd go with as well.

	Jakub


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Mark ASM_OUTPUT_FUNCTION_LABEL ()'s DECL argument as used
  2024-01-23 10:10   ` Jakub Jelinek
@ 2024-01-23 13:18     ` Jakub Jelinek
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2024-01-23 13:18 UTC (permalink / raw)
  To: Jeff Law, Ilya Leoshkevich, Jeff Law, Jan-Benedict Glaw,
	Andreas Krebbel, gcc-patches, Stefan Schulze Frielinghaus

On Tue, Jan 23, 2024 at 11:10:05AM +0100, Jakub Jelinek wrote:
> > --- a/gcc/config/ia64/ia64.cc
> > +++ b/gcc/config/ia64/ia64.cc
> > @@ -3886,7 +3886,7 @@ ia64_expand_prologue (void)
> >  /* Output the textual info surrounding the prologue.  */
> >  
> >  void
> > -ia64_start_function (FILE *file, const char *fnname, tree decl)
> > +ia64_start_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)
> 
> Except the too long line sure, that is what I'd go with as well.

Tested with a cross to ia64-linux (both without the patch and with the
patch), committed to trunk as obvious.

	Jakub


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-23 13:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-15  9:22 [PATCH] Mark ASM_OUTPUT_FUNCTION_LABEL ()'s DECL argument as used Ilya Leoshkevich
2024-01-17  2:32 ` Jeff Law
2024-01-23 10:10   ` Jakub Jelinek
2024-01-23 13:18     ` Jakub Jelinek

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