All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Andrey Borzenkov <arvidjaar@gmail.com>, bug-gnulib@gnu.org
Cc: grub-devel@gnu.org, zaphod@berentweb.com
Subject: Re: [PATCH] Do not use inline in argp.h on FreeBSD
Date: Mon, 04 Aug 2014 11:40:56 -0700	[thread overview]
Message-ID: <53DFD3B8.8060902@cs.ucla.edu> (raw)
In-Reply-To: <1406302104-30958-1-git-send-email-arvidjaar@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 157 bytes --]

Thanks for the heads-up.  I installed the attached patch into the gnulib 
master.  It differs from your patch but should do the job.  Please give 
it a try.

[-- Attachment #2: 0001-extern-inline-port-to-FreeBSD-DragonFly.patch --]
[-- Type: text/plain, Size: 4674 bytes --]

From 6a3948b87d6df36207df685e726ed1e972a01d28 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 4 Aug 2014 11:30:33 -0700
Subject: [PATCH] extern-inline: port to FreeBSD, DragonFly

* m4/extern-inline.m4 (gl_EXTERN_INLINE): Also assume the bug
is present if either __DragonFly__ or __FreeBSD__ is defined.
FreeBSD problem reported by Andrey Borzenkov in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html
Also, worry about __APPLE__ only if __MACH__ is also defined,
as this is more consistent with the rest of gnulib.
(_GL_EXTERN_INLINE_STDHEADER_BUG): Rename this internal macro from
_GL_EXTERN_INLINE_APPLE_BUG, since the bug is not limited to Apple.
---
 ChangeLog           | 12 ++++++++++++
 m4/extern-inline.m4 | 31 +++++++++++++++++++++++--------
 2 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 59ce3dc..bdf743a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-08-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+	extern-inline: port to FreeBSD, DragonFly
+	* m4/extern-inline.m4 (gl_EXTERN_INLINE): Also assume the bug
+	is present if either __DragonFly__ or __FreeBSD__ is defined.
+	FreeBSD problem reported by Andrey Borzenkov in:
+	http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html
+	Also, worry about __APPLE__ only if __MACH__ is also defined,
+	as this is more consistent with the rest of gnulib.
+	(_GL_EXTERN_INLINE_STDHEADER_BUG): Rename this internal macro from
+	_GL_EXTERN_INLINE_APPLE_BUG, since the bug is not limited to Apple.
+
 2014-08-01  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
 	regex: Make #if/#ifdef usage consistent for DEBUG
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index 240150e..7f1bb39 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -19,13 +19,28 @@ AC_DEFUN([gl_EXTERN_INLINE],
    'reference to static identifier "f" in extern inline function'.
    This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
 
-   Suppress the use of extern inline on problematic Apple configurations.
-   OS X 10.8 and earlier mishandle it; see, e.g.,
-   <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
+   Suppress extern inline (with or without __attribute__ ((__gnu_inline__)))
+   on configurations that mistakenly use 'static inline' to implement
+   functions or macros in standard C headers like <ctype.h>.  For example,
+   if isdigit is mistakenly implemented via a static inline function,
+   a program containing an extern inline function that calls isdigit
+   may not work since the C standard prohibits extern inline functions
+   from calling static functions.  This bug is known to occur on:
+
+     OS X 10.8 and earlier; see:
+     http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html
+
+     DragonFly; see
+     http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log
+
+     FreeBSD; see:
+     http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html
+
    OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
    for clang but remains for g++; see <http://trac.macports.org/ticket/41033>.
-   Perhaps Apple will fix this some day.  */
-#if (defined __APPLE__ \
+   Assume DragonFly and FreeBSD will be similar.  */
+#if (((defined __APPLE__ && defined __MACH__) \
+      || defined __DragonFly__ || defined __FreeBSD__) \
      && (defined __header_inline \
          ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
             && ! defined __clang__) \
@@ -33,19 +48,19 @@ AC_DEFUN([gl_EXTERN_INLINE],
              && (defined __GNUC__ || defined __cplusplus)) \
             || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
                 && defined __GNUC__ && ! defined __cplusplus))))
-# define _GL_EXTERN_INLINE_APPLE_BUG
+# define _GL_EXTERN_INLINE_STDHEADER_BUG
 #endif
 #if ((__GNUC__ \
       ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
       : (199901L <= __STDC_VERSION__ \
          && !defined __HP_cc \
          && !(defined __SUNPRO_C && __STDC__))) \
-     && !defined _GL_EXTERN_INLINE_APPLE_BUG)
+     && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
 # define _GL_INLINE inline
 # define _GL_EXTERN_INLINE extern inline
 # define _GL_EXTERN_INLINE_IN_USE
 #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
-       && !defined _GL_EXTERN_INLINE_APPLE_BUG)
+       && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
 # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
    /* __gnu_inline__ suppresses a GCC 4.2 diagnostic.  */
 #  define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
-- 
1.9.3


      parent reply	other threads:[~2014-08-04 20:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 15:28 [PATCH] Do not use inline in argp.h on FreeBSD Andrey Borzenkov
2014-07-25 21:39 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-07-26  3:58   ` Andrey Borzenkov
2014-09-25 15:40   ` [PATCH] update m4/extern-inline.m4 to upstream version to fix compilation " Andrey Borzenkov
2014-08-04 18:40 ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53DFD3B8.8060902@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=arvidjaar@gmail.com \
    --cc=bug-gnulib@gnu.org \
    --cc=grub-devel@gnu.org \
    --cc=zaphod@berentweb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.