Re: [RFA 12/13] Add ATTRIBUTE_UNUSED to regdat.sh output

Pedro Alves
2018-07-16T15:11:47Z

On 07/12/2018 09:52 PM, Tom Tromey wrote:
> This changes regdat.sh to emit ATTRIBUTE_UNUSED for the
> xmltarget_${name} variable. This seemed simpler than trying to figure
> out under exactly which circumstances each one was in fact used.

Can you give an example configuration where you got a warning?

Thanks,
Pedro Alves

>
> 2018-07-12 Tom Tromey <tom@tromey.com>
>
> * regformats/regdat.sh: Mark xmltarget_${name} with
> ATTRIBUTE_UNUSED.
> ---
> gdb/ChangeLog | 5 +++++
> gdb/regformats/regdat.sh | 8 ++++----
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/regformats/regdat.sh b/gdb/regformats/regdat.sh
> index 5a8564ac50c..7868e757582 100755
> --- a/gdb/regformats/regdat.sh
> +++ b/gdb/regformats/regdat.sh
> @@ -164,12 +164,12 @@ done
> echo
> echo "static const char *expedite_regs_${name}[] = { \"`echo ${expedite} | sed 's/,/", "/g'`\", 0 };"
> if test "${feature}" != x; then
> - echo "static const char *xmltarget_${name} = 0;"
> + echo "static const char *xmltarget_${name} ATTRIBUTE_UNUSED = 0;"
> elif test "${xmltarget}" = x; then
> if test "${xmlarch}" = x && test "${xmlosabi}" = x; then
> - echo "static const char *xmltarget_${name} = 0;"
> + echo "static const char *xmltarget_${name} ATTRIBUTE_UNUSED = 0;"
> else
> - echo "static const char *xmltarget_${name} = \"@<target>\\"
> + echo "static const char *xmltarget_${name} ATTRIBUTE_UNUSED = \"@<target>\\"
> if test "${xmlarch}" != x; then
> echo "<architecture>${xmlarch}</architecture>\\"
> fi
> @@ -179,7 +179,7 @@ elif test "${xmltarget}" = x; then
> echo "</target>\";"
> fi
> else
> - echo "static const char *xmltarget_${name} = \"${xmltarget}\";"
> + echo "static const char *xmltarget_${name} ATTRIBUTE_UNUSED = \"${xmltarget}\";"
> fi
> echo
>
>