Message ID | 20240115092537.1706919-1-iii@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | Mark ASM_OUTPUT_FUNCTION_LABEL ()'s DECL argument as used | expand |
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) { #if TARGET_ABI_OPEN_VMS vms_start_function (fnname);
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
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
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. */
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(-)