bug-gnulib
[Top][All Lists]
Advanced

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

popen on OSF/1 5.1


From: Bruno Haible
Subject: popen on OSF/1 5.1
Date: Mon, 20 Dec 2010 00:32:53 +0100
User-agent: KMail/1.9.9

On OSF/1 5.1 I got these test build failures:

depbase=`echo test-stdio-c++.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; g++ 
-DHAVE_CONFIG_H -I.   -DGNULIB_STRICT_CHECKING=1  -I. -I.  -I.. -I./..  
-I../gllib -I./../gllib -mieee   -MT test-stdio-c++.o -MD -MP -MF $depbase.Tpo 
-c -o test-stdio-c++.o test-stdio-c++.cc && mv -f $depbase.Tpo $depbase.Po
In file included from /usr/include/mesg.h:52,
                 from /usr/include/nl_types.h:75,
                 from /usr/include/sys/lc_core.h:58,
                 from /usr/include/sys/localedef.h:76,
                 from /usr/include/ctype.h:108,
                 from ../gllib/ctype.h:36,
                 from ../gllib/getopt.h:112,
                 from 
/opt/fsw/gcc42/lib/gcc/alpha-dec-osf5.1/4.2/include/stdio.h:493,
                 from ../gllib/stdio.h:36,
                 from test-stdio-c++.cc:22:
../gllib/stdio.h:954: error: '::popen' has not been declared
../gllib/stdio.h:956: error: 'popen' was not declared in this scope
../gllib/stdio.h:956: error: invalid type in declaration before ';' token
In file included from ../gllib/stdio.h:36,
                 from test-stdio-c++.cc:22:
/opt/fsw/gcc42/lib/gcc/alpha-dec-osf5.1/4.2/include/stdio.h:502: error: 'FILE* 
popen(const char*, const char*)' redeclared as different kind of symbol
../gllib/stdio.h:956: error: previous declaration of 'int popen'
*** Exit 1

The reason is that while the system header does declare popen(), this
declaration comes too late, because a recursive include of gnulib's
<stdio.h> leads to a use of popen as a function pointer before the
entire system's <stdio.h> has been processed.

gllib/stdio.h:36
-> /opt/fsw/gcc42/lib/gcc/alpha-dec-osf5.1/4.2/include/stdio.h:493
   -> gllib/getopt.h:112
      -> gllib/ctype.h:36
         -> /usr/include/ctype.h:108
            -> /usr/include/sys/localedef.h:76
               -> /usr/include/sys/lc_core.h:58
                  -> /usr/include/nl_types.h:75
                     -> /usr/include/mesg.h:52
                        -> gllib/stdio.h

(In order to analyze this, I needed "gcc -E -dD". Thanks for the tip, Jim!)

This fixes it. This patch may be dangerous for other platforms, so Jim,
you might want to exclude it from your next coreutils build.


2010-12-19  Bruno Haible  <address@hidden>

        stdio: Fix problem with popen() declaration on OSF/1 5.1.
        * lib/stdio.in.h: During the include_next statement, let recursive
        includes of this file include only the system header file.

--- lib/stdio.in.h.orig Mon Dec 20 00:24:16 2010
+++ lib/stdio.in.h      Sun Dec 19 22:10:41 2010
@@ -21,8 +21,14 @@
 #endif
 @PRAGMA_COLUMNS@
 
-#if defined __need_FILE || defined __need___FILE
-/* Special invocation convention inside glibc header files.  */
+#if defined __need_FILE || defined __need___FILE || defined 
_GL_ALREADY_INCLUDING_STDIO_H
+/* Special invocation convention:
+   - Inside glibc header files.
+   - On OSF/1 5.1 we have a sequence of nested includes
+     <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
+     <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
+     In this situation, the functions are not yet declared, therefore we cannot
+     provide the C++ aliases.  */
 
 address@hidden@ @NEXT_STDIO_H@
 
@@ -31,9 +37,13 @@
 
 #ifndef _GL_STDIO_H
 
+#define _GL_ALREADY_INCLUDING_STDIO_H
+
 /* The include_next requires a split double-inclusion guard.  */
 address@hidden@ @NEXT_STDIO_H@
 
+#undef _GL_ALREADY_INCLUDING_STDIO_H
+
 #ifndef _GL_STDIO_H
 #define _GL_STDIO_H
 



reply via email to

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