Skip to contentSkip to conversation

Fix an "'__sentinel__' attribute directive ignored" warning

PATCH Applied Ramsay Jones 1 participant 1 message May 23, 2007 Sparse checker

lore
Share & tools
lore
#0 lore raw

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

This attribute was introduced in gcc 3.5. My Cygwin install, which is not that old, is using gcc 3.4.4.

---
 lib.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
lib.h +6 -0
index df9cfc4..6902f91 100644
@@ -68,10 +68,16 @@ typedef struct pseudo *pseudo_t;
 struct token *skip_to(struct token *, int);
 struct token *expect(struct token *, int, const char *);
 #ifdef __GNUC__
+#define GCC_VERSION (__GNUC__ * 1000 + __GNUC__MINOR__)
 #define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1)))
 #define NORETURN_ATTR __attribute__ ((__noreturn__))
+/* __sentinel__ attribute was introduced in gcc 3.5 */
+#if (GCC_VERSION >= 3005)
 #define SENTINEL_ATTR __attribute__ ((__sentinel__))
 #else
+#define SENTINEL_ATTR
+#endif /* gcc >= 3.5 */
+#else
 #define FORMAT_ATTR(pos)
 #define NORETURN_ATTR
 #define SENTINEL_ATTR
Signature · 1 line
1.5.1