summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/buffer.h2
-rw-r--r--src/config.h.in8
3 files changed, 13 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c5814e0..c399713 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -99,6 +99,10 @@ CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
CHECK_C_SOURCE_COMPILES(
"int main() { __builtin_expect(0,0); return 0; }"
HAVE___BUILTIN_EXPECT)
+CHECK_C_SOURCE_COMPILES("
+ int f(void) __attribute__ (());
+ int main() { return 0; }
+" HAVE___ATTRIBUTE__)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
diff --git a/src/buffer.h b/src/buffer.h
index d14b38e..acbead7 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -110,7 +110,7 @@ CMARK_EXPORT
int cmark_strbuf_puts(cmark_strbuf *buf, const char *string);
CMARK_EXPORT
int cmark_strbuf_printf(cmark_strbuf *buf, const char *format, ...)
- __attribute__((format (printf, 2, 3)));
+ CMARK_ATTRIBUTE((format (printf, 2, 3)));
CMARK_EXPORT
int cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap);
CMARK_EXPORT
diff --git a/src/config.h.in b/src/config.h.in
index bd39c4e..5294bc9 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -7,3 +7,11 @@
#endif
#cmakedefine HAVE___BUILTIN_EXPECT
+
+#cmakedefine HAVE___ATTRIBUTE__
+
+#ifdef HAVE___ATTRIBUTE__
+ #define CMARK_ATTRIBUTE(list) __attribute__ (list)
+#else
+ #define CMARK_ATTRIBUTE(list)
+#endif