[Top][All Lists]

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

Re: XALLOC_INLINE static on HP-UX?

From: Paul Eggert
Subject: Re: XALLOC_INLINE static on HP-UX?
Date: Mon, 18 Feb 2013 17:19:54 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

On 02/18/2013 02:42 PM, Karl Berry wrote:

> Richard Lloyd (cc'd) reported this to bug-texinfo:
>   * gnulib/lib/xalloc.h:
>     XALLOC_INLINE needed to be be defined as static (rather than extern
>     inline) to avoid multiple defintions of *alloc() routines. I just
>     put this in xalloc.h as follows (line 30):
>   #ifdef __hpux
>   #undef XALLOC_INLINE
>   #define XALLOC_INLINE static
>   #endif

Thanks.  The "right" way to fix this is to change the definition of
_GL_EXTERN_INLINE, since a similar problem should occur with any library
that tries to declare C99-style inline functions.  For now, I've try to do
that in gnulib by installing the patch at the end of this message.  But this
is fairly drastic, as it disables inline functions with HP-UX cc.
So it might be helpful to know more about the problem, to come up with a
less-drastic change.  Richard, what happens in texinfo 5.0 if you
don't include the above workaround?  That is, what is the command line that
fails and what was the output of the failed compilation?

Also, what version of the compiler are you using?
What is the value of the __HP_cc macro?  E.g.:

   echo '__HP_cc' >t.c
   cc -E t.c

where you should use the same compilation environment as with the
failed build.

Here's the gnulib patch I just pushed.
 ChangeLog           | 10 ++++++++++
 m4/extern-inline.m4 |  5 ++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6e202e9..050ad4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-02-18  Paul Eggert  <address@hidden>
+       extern-inline: avoid compilation error with HP-UX cc
+       Reported by Richard Lloyd in
+       <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
+       * m4/extern-inline.m4 (_GL_INLINE, _GL_EXTERN_INLINE):
+       Suppress extern inline with HP-UX cc.  This should be safe,
+       though it may hurt performance.  Perhaps someone with some HP-UX
+       experience can come up with a higher-performance fix.
 2013-02-14  Paul Eggert  <address@hidden>
        putenv: fix heap corruption with mixed putenv/_putenv
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index 5880d4f..0152f29 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -18,13 +18,16 @@ AC_DEFUN([gl_EXTERN_INLINE],
    _GL_INLINE_HEADER_END contains useful stuff to put
      in the same include file, after uses of _GL_INLINE.
+   Suppress extern inline with HP-UX cc, as it appears to be broken; see
+   <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
    Suppress the use of extern inline on Apple's platforms,
    as Libc-825.25 (2012-09-19) is incompatible with it; see
    Perhaps Apple will fix this some day.  */
 #if ((__GNUC__ \
       ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
-      : 199901L <= __STDC_VERSION__) \
+      : 199901L <= __STDC_VERSION__ && !defined __HP_cc) \
      && !defined __APPLE__)
 # define _GL_INLINE inline
 # define _GL_EXTERN_INLINE extern inline

reply via email to

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