[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
new module 'c++defs'
From: |
John W. Eaton |
Subject: |
new module 'c++defs' |
Date: |
Mon, 22 Feb 2010 12:53:53 -0500 |
On 22-Feb-2010, Bruno Haible wrote:
| Here come the proposed changes to allow C++ developers to choose among
| the default mode with many
| #define func rpl_func
| macro definitions and a "namespace mode", which is more in line with the
| way C++ programs are built.
|
| I handled all header files that do such #defines, except for
| - stat and stat64 - a difficult situation, which I prefer not to touch,
| - getopt.h - also tricky.
|
| [...]
|
| Opinions? Suggestions?
Thanks for working on this.
I tried your changes with the Octave sources and quickly hit this error:
make[3]: Entering directory `/scratch/jwe/build/octave/liboctave'
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I.
-I/home/jwe/src/octave/liboctave -I.. -I../libgnu
-I/home/jwe/src/octave/libgnu -I/home/jwe/src/octave/libcruft/misc -ggdb3
-DHAVE_CONFIG_H -I/usr/include/freetype2 -Wall -W -Wshadow -Wold-style-cast
-Wformat -ggdb3 -pthread -ggdb3 -MT liboctave_la-CollocWt.lo -MD -MP -MF
.deps/liboctave_la-CollocWt.Tpo -c -o liboctave_la-CollocWt.lo `test -f
'CollocWt.cc' || echo '/home/jwe/src/octave/liboctave/'`CollocWt.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I/home/jwe/src/octave/liboctave
-I.. -I../libgnu -I/home/jwe/src/octave/libgnu
-I/home/jwe/src/octave/libcruft/misc -ggdb3 -DHAVE_CONFIG_H
-I/usr/include/freetype2 -Wall -W -Wshadow -Wold-style-cast -Wformat -ggdb3
-pthread -ggdb3 -MT liboctave_la-CollocWt.lo -MD -MP -MF
.deps/liboctave_la-CollocWt.Tpo -c /home/jwe/src/octave/liboctave/CollocWt.cc
-fPIC -DPIC -o .libs/liboctave_la-CollocWt.o
In file included from /usr/include/sys/ucontext.h:23,
from /usr/include/signal.h:359,
from ../libgnu/signal.h:36,
from /usr/include/sys/wait.h:31,
from /home/jwe/src/octave/liboctave/syswait.h:39,
from /home/jwe/src/octave/liboctave/lo-utils.h:33,
from /home/jwe/src/octave/liboctave/Array.h:38,
from /home/jwe/src/octave/liboctave/Array2.h:32,
from /home/jwe/src/octave/liboctave/MArray2.h:28,
from /home/jwe/src/octave/liboctave/dMatrix.h:27,
from /home/jwe/src/octave/liboctave/CollocWt.h:29,
from /home/jwe/src/octave/liboctave/CollocWt.cc:30:
../libgnu/stdio.h:1087: error: previous declaration of 'int
_gl_cxxalias_dummy' with 'C++' linkage
../libgnu/signal.h:246: error: conflicts with new declaration with 'C' linkage
The following additional change avoids the trouble for me by forcing 'C'
linkage for the _gl_cxxalias_dummy symbol.
jwe
diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h
index f3bc4d4..f4313bf 100644
--- a/build-aux/c++defs.h
+++ b/build-aux/c++defs.h
@@ -111,13 +111,18 @@
*/
#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
_GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
-#if defined __cplusplus && defined GNULIB_NAMESPACE
-# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+#if defined __cplusplus
+# if defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
namespace GNULIB_NAMESPACE \
{ \
rettype (*const func) parameters = ::rpl_func; \
} \
- extern int _gl_cxxalias_dummy
+ extern "C" int _gl_cxxalias_dummy
+# else
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+ extern "C" int _gl_cxxalias_dummy
+# endif
#else
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
extern int _gl_cxxalias_dummy
@@ -130,13 +135,18 @@
Example:
_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
*/
-#if defined __cplusplus && defined GNULIB_NAMESPACE
-# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+#if defined __cplusplus
+# if defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
namespace GNULIB_NAMESPACE \
{ \
rettype (*const func) parameters = ::func; \
} \
- extern int _gl_cxxalias_dummy
+ extern "C" int _gl_cxxalias_dummy
+# else
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+ extern "C" int _gl_cxxalias_dummy
+# endif
#else
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
extern int _gl_cxxalias_dummy
- new module 'c++defs', Bruno Haible, 2010/02/21
- new module 'c++defs',
John W. Eaton <=
- Re: new module 'c++defs', Bruno Haible, 2010/02/22
- Re: new module 'c++defs', John W. Eaton, 2010/02/23
- Re: new module 'c++defs', Bruno Haible, 2010/02/23
- Re: new module 'c++defs', John W. Eaton, 2010/02/23
- Re: new module 'c++defs', Eric Blake, 2010/02/23
- Re: new module 'c++defs', John W. Eaton, 2010/02/23