public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sim: move UNUSED before TYPE in SIM_ENDIAN_INLINE's definition
@ 2021-06-20  1:35 Simon Marchi
  2021-06-20  1:35 ` [PATCH 2/2] sim: use INLINE2 in STATIC_INLINE's definition Simon Marchi
  2021-06-20  2:07 ` [PATCH 1/2] sim: move UNUSED before TYPE in SIM_ENDIAN_INLINE's definition Mike Frysinger
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Marchi @ 2021-06-20  1:35 UTC (permalink / raw)
  To: gdb-patches

I get this when building with gcc 11:

      CC       common/common_libcommon_a-sim-load.o
    In file included from /home/simark/src/binutils-gdb/sim/common/sim-n-bits.h:27,
                     from /home/simark/src/binutils-gdb/sim/common/sim-bits.c:259,
                     from /home/simark/src/binutils-gdb/sim/common/sim-bits.h:599,
                     from /home/simark/src/binutils-gdb/sim/common/sim-basics.h:122,
                     from /home/simark/src/binutils-gdb/sim/common/sim-load.c:30:
    /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:27: error: ‘offset_16’ defined but not used [-Werror=unused-function]
       39 | #define offset_N XCONCAT2(offset_,N)
          |                           ^~~~~~~
    /home/simark/src/binutils-gdb/sim/../include/symcat.h:23:26: note: in definition of macro ‘CONCAT2’
       23 | #define CONCAT2(a,b)     a##b
          |                          ^
    /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:18: note: in expansion of macro ‘XCONCAT2’
       39 | #define offset_N XCONCAT2(offset_,N)
          |                  ^~~~~~~~
    /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:138:1: note: in expansion of macro ‘offset_N’
      138 | offset_N (unsigned_N *x,
          | ^~~~~~~~

offset_N uses INLINE_SIM_ENDIAN, which uses UNUSED to put the "unused"
attribute.  However, it appears after the function's return type, which
seems to make it not apply to the function.  Moving it to before the
return type fixes the error.

sim/common/ChangeLog:

	* sim-inline.h (SIM_ENDIAN_INLINE): Move UNUSED before TYPE.

Change-Id: Ide20106683ed7a9ebf35d484dabf70b309cb1ba6
---
 sim/common/sim-inline.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h
index 2750fa93cbc7..6ac4942e3521 100644
--- a/sim/common/sim-inline.h
+++ b/sim/common/sim-inline.h
@@ -445,7 +445,7 @@
      && !defined (SIM_ENDIAN_C) \
      && (REVEAL_MODULE_P (SIM_ENDIAN_INLINE)))
 # if (SIM_ENDIAN_INLINE & INLINE_GLOBALS)
-#  define INLINE_SIM_ENDIAN(TYPE) static INLINE TYPE UNUSED
+#  define INLINE_SIM_ENDIAN(TYPE) static INLINE UNUSED TYPE
 #  define EXTERN_SIM_ENDIAN_P 0
 # else
 #  define INLINE_SIM_ENDIAN(TYPE) static TYPE UNUSED
-- 
2.32.0


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

end of thread, other threads:[~2021-06-20  2:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20  1:35 [PATCH 1/2] sim: move UNUSED before TYPE in SIM_ENDIAN_INLINE's definition Simon Marchi
2021-06-20  1:35 ` [PATCH 2/2] sim: use INLINE2 in STATIC_INLINE's definition Simon Marchi
2021-06-20  2:07 ` [PATCH 1/2] sim: move UNUSED before TYPE in SIM_ENDIAN_INLINE's definition Mike Frysinger
2021-06-20  2:21   ` Simon Marchi
2021-06-20  2:47     ` Mike Frysinger
2021-06-20  2:50       ` Simon Marchi

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