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 <jbg...@lug-owl.de>
Suggested-by: Jan-Benedict Glaw <jbg...@lug-owl.de>
Fixes: c659dd8bfb55 ("Implement ASM_DECLARE_FUNCTION_NAME using 
ASM_OUTPUT_FUNCTION_LABEL")
Signed-off-by: Ilya Leoshkevich <i...@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)
 {
 #if TARGET_ABI_OPEN_VMS
   vms_start_function (fnname);

Reply via email to