bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib support for C99-style extern inline


From: Paul Eggert
Subject: Re: gnulib support for C99-style extern inline
Date: Wed, 01 Aug 2012 14:36:19 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0

No comment and I'd like to get this into Emacs so
I pushed those changes, with the following two minor
formatting fixes:

>From f97192f62226734f9813010d1068cef4fbe95076 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Sat, 28 Jul 2012 08:34:01 -0700
Subject: [PATCH 1/2] Fix indenting.

---
 m4/extern-inline.m4 |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index c80d546..f019ad7 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -10,14 +10,14 @@ 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 linline'.
-    _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.  */
+   _GL_EXTERN_INLINE is a portable alternative to 'extern linline'.
+   _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
-- 
1.7.6.5


>From e84a5dced96edbd298e154cf7db2d876f49f5c5a Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Wed, 1 Aug 2012 14:30:54 -0700
Subject: [PATCH 2/2] Keep the extern-inline macros closer together.

---
 lib/stat-time.h |    7 +++----
 lib/timespec.h  |    7 +++----
 lib/u64.h       |    7 +++----
 lib/utimens.h   |    7 +++----
 4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/lib/stat-time.h b/lib/stat-time.h
index d04b400..74dd00a 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -24,6 +24,9 @@
 #include <time.h>
 
 _GL_INLINE_HEADER_BEGIN
+#ifndef _GL_STAT_TIME_INLINE
+# define _GL_STAT_TIME_INLINE _GL_INLINE
+#endif
 
 /* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type
    struct timespec, if available.  If not, then STAT_TIMESPEC_NS (ST,
@@ -47,10 +50,6 @@ _GL_INLINE_HEADER_BEGIN
 # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.st__tim.tv_nsec)
 #endif
 
-#ifndef _GL_STAT_TIME_INLINE
-# define _GL_STAT_TIME_INLINE _GL_INLINE
-#endif
-
 /* Return the nanosecond component of *ST's access time.  */
 _GL_STAT_TIME_INLINE long int
 get_stat_atime_ns (struct stat const *st)
diff --git a/lib/timespec.h b/lib/timespec.h
index 5a6d1c0..d0a2194 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -22,6 +22,9 @@
 # include <time.h>
 
 _GL_INLINE_HEADER_BEGIN
+#ifndef _GL_TIMESPEC_INLINE
+# define _GL_TIMESPEC_INLINE _GL_INLINE
+#endif
 
 /* Return negative, zero, positive if A < B, A == B, A > B, respectively.
 
@@ -51,10 +54,6 @@ _GL_INLINE_HEADER_BEGIN
 
    The (int) cast avoids a gcc -Wconversion warning.  */
 
-#ifndef _GL_TIMESPEC_INLINE
-# define _GL_TIMESPEC_INLINE _GL_INLINE
-#endif
-
 _GL_TIMESPEC_INLINE int
 timespec_cmp (struct timespec a, struct timespec b)
 {
diff --git a/lib/u64.h b/lib/u64.h
index 8fd9a95..6a7d370 100644
--- a/lib/u64.h
+++ b/lib/u64.h
@@ -20,6 +20,9 @@
 #include <stdint.h>
 
 _GL_INLINE_HEADER_BEGIN
+#ifndef _GL_U64_INLINE
+# define _GL_U64_INLINE _GL_INLINE
+#endif
 
 /* Return X rotated left by N bits, where 0 < N < 64.  */
 #define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n))
@@ -54,10 +57,6 @@ typedef struct { uint32_t lo, hi; } u64;
 #  define u64init(hi, lo) { lo, hi }
 # endif
 
-#ifndef _GL_U64_INLINE
-# define _GL_U64_INLINE _GL_INLINE
-#endif
-
 /* Given the high and low-order 32-bit quantities HI and LO, return a u64
    value representing (HI << 32) + LO.  */
 _GL_U64_INLINE u64
diff --git a/lib/utimens.h b/lib/utimens.h
index 8034316..f765d10 100644
--- a/lib/utimens.h
+++ b/lib/utimens.h
@@ -27,14 +27,13 @@ int lutimens (char const *, struct timespec const [2]);
 # include <sys/stat.h>
 
 _GL_INLINE_HEADER_BEGIN
-
-int fdutimensat (int fd, int dir, char const *name, struct timespec const [2],
-                 int atflag);
-
 #ifndef _GL_UTIMENS_INLINE
 # define _GL_UTIMENS_INLINE _GL_INLINE
 #endif
 
+int fdutimensat (int fd, int dir, char const *name, struct timespec const [2],
+                 int atflag);
+
 /* Using this function makes application code slightly more readable.  */
 _GL_UTIMENS_INLINE int
 lutimensat (int dir, char const *file, struct timespec const times[2])
-- 
1.7.6.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]