Commits

Markus Mottl committed fd02eba

Improved portability by better supporting C99 and non-GNU compilers in bin-prot

  • Participants
  • Parent commits 7beeb74

Comments (0)

Files changed (1)

base/bin-prot/lib/common_stubs.h

 extern value *v_bin_prot_exc_Buffer_short;
 
 
-/* GNU compiler pragmas */
+/* Compiler pragmas and inlining */
 
-#if __GNUC__ >= 3
+/* Forget any previous definition of inlining, it may not be what we mean */
+#ifdef inline
+# undef inline
+#endif
+
+/* The semantics of "inline" in C99 is not what we intend so just drop it */
+#if defined(__STDC__) && __STDC__ && \
+    defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+# define inline
+#endif
+
+#if defined(__GNUC__) && __GNUC__ >= 3
 # ifndef inline
 #   define inline inline __attribute__ ((always_inline))
 # endif
 #   define unlikely(x) __builtin_expect (!!(x), 0)
 # endif
 #else
+  /* Non-GNU compilers should always ignore "inline" no matter the C-standard */
 # ifndef inline
 #   define inline
 # endif