Hi, Richard > "Hu, Jiangping" <hujiangp...@cn.fujitsu.com> writes: > > Hi, > > > > I find there are many "ATTRIBUTE_UNUSED" macros in the function > parameter lists, > > but some of the parameters are used in the function bodies in fact. E.g. > > > > @@gcc/final.c > > void > > output_operand (rtx x, int code ATTRIBUTE_UNUSED) > > { > > if (x && GET_CODE (x) == SUBREG) > > x = alter_subreg (&x, true); > > > > /* X must not be a pseudo reg. */ > > if (!targetm.no_register_allocation) > > gcc_assert (!x || !REG_P (x) || REGNO (x) < > FIRST_PSEUDO_REGISTER); > > > > targetm.asm_out.print_operand (asm_out_file, x, code); > > > > if (x == NULL_RTX) > > return; > > > > mark_symbol_refs_as_used (x); > > } > > > > I know there are no compile issues for the code above, and if we read > the body, > > it will not cause too much trouble to readers. > > Agreed. > > > So I don't know if can I make a patch to remove that? If it is approved, > > can I just firstly change the files I encountered, because I think many > files > > may have this situation, it's hard to address all of them in 1 patch. > > Yeah, small numbers of changes per patch are better. There's certainly > no requirement to do everything at once, incremental improvements are > better. Understood.
> > Uses of ATTRIBUTE_UNUSED in code like the above come from cases where > a target hook (here asm_out.print_operand) was previously a target macro. > When it was a target macro, there was no requirement for the macro to use > every parameter, and so the ATTRIBUTE_UNUSEDs were added to suppress > warnings for the targets that didn't use particular parameters. > > Since converting macros to hooks is a mostly mechanical (and boring) > process, it's natural to miss cases in which an ATTRIBUTE_UNUSED > is no longer required. Thanks for detailed explanation. Regards! Hujp > > FWIW, there will probably still be uses of ATTRIBUTE_UNUSED for values > that > are used in macro arguments, and those ATTRIBUTE_UNUSEDs are still needed. > > Thanks, > Richard >