[PATCH 1/5] Fix an "'__sentinel__' attribute directive ignored" warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This attribute was introduced in gcc 3.5. In order to avoid
such warnings, add a gcc version check when defining the
SENTINEL_ATTR macro. (This warning message, in particular,
was issued by a gcc 3.4.4 compiler).

Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxx>
---

Hi Chris,

I had some, somewhat old, patches kicking around in my sparse
repo which may be useful; so I'm sending them along for your
consideration.

For this patch, an alternative solution (which I haven't tried)
would be to add -Wno-attributes to CFLAGS.

ATB,
Ramsay Jones

 lib.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lib.h b/lib.h
index b22fa93..919b5b1 100644
--- a/lib.h
+++ b/lib.h
@@ -70,7 +70,11 @@ struct token *expect(struct token *, int, const char *);
 #ifdef __GNUC__
 #define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1)))
 #define NORETURN_ATTR __attribute__ ((__noreturn__))
-#define SENTINEL_ATTR __attribute__ ((__sentinel__))
+#if ((__GNUC__ * 100 + __GNUC__MINOR__) >= 305)  /* gcc version >= 3.5 */
+# define SENTINEL_ATTR __attribute__ ((__sentinel__))
+#else
+# define SENTINEL_ATTR
+#endif
 #else
 #define FORMAT_ATTR(pos)
 #define NORETURN_ATTR
-- 
1.6.3.1


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux