[PATCH 4/5] Deal with c99 inline semantics.

Werner Koch wk at gnupg.org
Tue Nov 6 17:19:12 CET 2012

On Tue,  6 Nov 2012 08:52, tk at giga.or.at said:

>> But it seems not to behave exactly as defined for gnu99.  If you can
>> show that there is a problem when using gcc -std=gnu99 I will look at it
>> again.
> That's easy, here goes:

You are right.  I just pushed this:

>From 5093bed27580e608de073bcc5953bd76b6b8b2de Mon Sep 17 00:00:00 2001
From: Werner Koch <wk at gnupg.org>
Date: Tue, 6 Nov 2012 17:14:04 +0100
Subject: [PATCH] Fix extern inline use for gcc > 4.3 in c99 mode

* mpi/mpi-inline.h [!G10_MPI_INLINE_DECL]: Take care of changed extern
inline semantics in gcc.

I am not use how this will work out with non-gcc. However, we had no
problems in the past and thus this change is the least invasive for
non-gcc compilers.
 mpi/mpi-inline.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/mpi/mpi-inline.h b/mpi/mpi-inline.h
index c32adae..6e44518 100644
--- a/mpi/mpi-inline.h
+++ b/mpi/mpi-inline.h
@@ -28,8 +28,15 @@
 #ifndef G10_MPI_INLINE_H
 #define G10_MPI_INLINE_H
+/* Starting with gcc 4.3 "extern inline" conforms in c99 mode to the
+   c99 semantics.  To keep the useful old semantics we use an
+   attribute.  */
 #ifndef G10_MPI_INLINE_DECL
-#define G10_MPI_INLINE_DECL  extern __inline__
+# ifdef __GNUC_STDC_INLINE__
+#  define G10_MPI_INLINE_DECL  extern inline __attribute__ ((__gnu_inline__))
+# else
+#  define G10_MPI_INLINE_DECL  extern __inline__
+# endif
 G10_MPI_INLINE_DECL  mpi_limb_t



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gnupg-devel mailing list