summaryrefslogtreecommitdiff
path: root/m4/extern-inline.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-08-01 21:46:10 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-08-01 21:46:10 -0700
commita0d4efe9c3c01fde58b401ee5ab88f052128fa85 (patch)
tree70862330c792d4ba0d16d9b389e742d65ddf2004 /m4/extern-inline.m4
parent13294f95172c68a5e77143f917231e0f17f37537 (diff)
downloademacs-a0d4efe9c3c01fde58b401ee5ab88f052128fa85.tar.gz
Merge from gnulib, for extern-inline.
2012-08-01 extern-inline: new module 2012-08-01 stat-time, timespec, u64, utimens: use extern-inline * lib/stat-time.c, lib/utimespec.c, lib/u64.c, m4/extern-inline.m4: New files. The new .c files are for instantiating extern inline functions. Fixes: debbugs:12116
Diffstat (limited to 'm4/extern-inline.m4')
-rw-r--r--m4/extern-inline.m440
1 files changed, 40 insertions, 0 deletions
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
new file mode 100644
index 00000000000..cacf8a08b16
--- /dev/null
+++ b/m4/extern-inline.m4
@@ -0,0 +1,40 @@
+dnl 'extern inline' a la ISO C99.
+
+dnl Copyright 2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_EXTERN_INLINE],
+[
+ AC_REQUIRE([AC_C_INLINE])
+ AH_VERBATIM([extern_inline],
+[/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
+ _GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
+ _GL_INLINE_HEADER_BEGIN contains useful stuff to put
+ in an include file, before uses of _GL_INLINE.
+ It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic,
+ when FOO is an inline function in the header; see
+ <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
+ _GL_INLINE_HEADER_END contains useful stuff to put
+ in the same include file, after uses of _GL_INLINE. */
+#if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__
+# define _GL_INLINE inline
+# define _GL_EXTERN_INLINE extern inline
+# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# define _GL_INLINE_HEADER_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"")
+# define _GL_INLINE_HEADER_END \
+ _Pragma ("GCC diagnostic pop")
+# endif
+#else
+# define _GL_INLINE static inline
+# define _GL_EXTERN_INLINE static inline
+#endif
+
+#ifndef _GL_INLINE_HEADER_BEGIN
+# define _GL_INLINE_HEADER_BEGIN
+# define _GL_INLINE_HEADER_END
+#endif])
+])