summaryrefslogtreecommitdiff
path: root/src/magic.h
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-09-26 16:07:38 +0200
committerAlfred E. Heggestad <aeh@db.org>2015-09-26 16:07:38 +0200
commit9dc7de25d9b259cc012677e78ae58285221ee665 (patch)
tree5d804d76a5315936f43f86f9e6f96fa3025f4b20 /src/magic.h
parentca226753e03c1773dab1899cb27fa3e94b7b6581 (diff)
magic: use __func__ for C99
Diffstat (limited to 'src/magic.h')
-rw-r--r--src/magic.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/magic.h b/src/magic.h
index 15eacee..523d38a 100644
--- a/src/magic.h
+++ b/src/magic.h
@@ -11,13 +11,24 @@
#error "macro MAGIC must be defined"
#endif
+
+/*
+ * Any C compiler conforming to C99 or later MUST support __func__
+ */
+#if __STDC_VERSION__ >= 199901L
+#define __MAGIC_FUNC__ (const char *)__func__
+#else
+#define __MAGIC_FUNC__ __FUNCTION__
+#endif
+
+
/** Check magic number */
#define MAGIC_DECL uint32_t magic;
#define MAGIC_INIT(s) (s)->magic = MAGIC
#define MAGIC_CHECK(s) \
if (MAGIC != s->magic) { \
warning("%s: wrong magic struct=%p (magic=0x%08x)\n", \
- __FUNCTION__, s, s->magic); \
+ __MAGIC_FUNC__, s, s->magic); \
BREAKPOINT; \
}
#else