John W. Eaton wrote: > An additional problem showed up on OS X systems: > > libtool: compile: g++-4.2 -DHAVE_CONFIG_H -I. -I.. -I/sw/lib/flex/include > -I/sw/include -O0 -g -m32 -I/sw/include/freetype2 -I/sw/include/qhull > -I/usr/include -I../libgnu -I../libgnu -I../libcruft/misc -I../liboctave > -I../liboctave -I. -I. -I/sw/lib/flex/include -I/sw/include -O0 -g -m32 > -I/sw/include/freetype2 -I/sw/include/qhull -I/usr/include -I/sw/include -O0 > -g -m32 -D_THREAD_SAFE -D_REENTRANT -DHAVE_CONFIG_H -mieee-fp -I/sw/include > -I/sw/include/freetype2 -I/sw/include -I/usr/X11/include -Wall -W -Wshadow > -Wold-style-cast -Wformat -I/sw/include -O0 -g -m32 -D_THREAD_SAFE > -D_REENTRANT -D_THREAD_SAFE -pthread -I/sw/include -O0 -g -m32 -D_THREAD_SAFE > -D_REENTRANT -MT liboctinterp_la-sighandlers.lo -MD -MP -MF > .deps/liboctinterp_la-sighandlers.Tpo -c sighandlers.cc -fno-common -DPIC -o > .libs/liboctinterp_la-sighandlers.o > sighandlers.cc: In function ‘void my_friendly_exit(const char*, int, bool)’: > sighandlers.cc:132: warning: use of old-style cast > sighandlers.cc:158: warning: use of old-style cast > sighandlers.cc: In function ‘void (* octave_set_signal_handler(int, void > (*)(int), bool))(int)’: > sighandlers.cc:198: error: expected unqualified-id before ‘(’ token > sighandlers.cc:199: error: expected unqualified-id before ‘(’ token > sighandlers.cc: In function ‘void sigchld_handler(int)’: > sighandlers.cc:232: error: expected unqualified-id before ‘(’ token > sighandlers.cc:232: error: expected unqualified-id before ‘(’ token > sighandlers.cc:232: error: expected unqualified-id before ‘(’ token > sighandlers.cc: In function ‘octave_interrupt_handler > octave_ignore_interrupts()’: > sighandlers.cc:506: warning: use of old-style cast > sighandlers.cc: In function ‘void install_signal_handlers()’: > sighandlers.cc:646: warning: use of old-style cast > make[3]: *** [liboctinterp_la-sighandlers.lo] Error 1 > make[2]: *** [all] Error 2 > make[1]: *** [all-recursive] Error 1 > make: *** [all] Error 2 > > Lines 198 and 199 of Octave's sighandlers.cc file are > > gnulib::sigemptyset (&act.sa_mask); > gnulib::sigemptyset (&oact.sa_mask); > > and looking at the preprocessed source file, I see they are being > transformed to > > gnulib::(*(&act.sa_mask) = 0, 0); > gnulib::(*(&oact.sa_mask) = 0, 0); > > So apparently, sigemptyset is a macro on OS X systems. Likewise for > sigaddset.
I agree that your program should not need to have #undef sigemptyset in order to use the gnulib::sigemptyset function. So let's fix it in gnulib. This is a guess. Please report if it does not work. 2010-03-20 Bruno Haible <br...@clisp.org> signal: Undefine macro definitions in C++ mode. * lib/signal.in.h (sigismember, sigemptyset, sigaddset, sigdelset, sigfillset): Undefine macro definitions from the system header in C++ mode. Reported by John W. Eaton <j...@gnu.org>. --- lib/signal.in.h.orig Sun Mar 21 01:42:59 2010 +++ lib/signal.in.h Sun Mar 21 01:42:52 2010 @@ -85,7 +85,12 @@ # endif /* Test whether a given signal is contained in a signal set. */ -# if !...@have_posix_signalblocking@ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on MacOS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigismember +# endif +# else _GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig) _GL_ARG_NONNULL ((1))); # endif @@ -93,14 +98,24 @@ _GL_CXXALIASWARN (sigismember); /* Initialize a signal set to the empty set. */ -# if !...@have_posix_signalblocking@ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on MacOS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigemptyset +# endif +# else _GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set)); _GL_CXXALIASWARN (sigemptyset); /* Add a signal to a signal set. */ -# if !...@have_posix_signalblocking@ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on MacOS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigaddset +# endif +# else _GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig) _GL_ARG_NONNULL ((1))); # endif @@ -108,7 +123,12 @@ _GL_CXXALIASWARN (sigaddset); /* Remove a signal from a signal set. */ -# if !...@have_posix_signalblocking@ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on MacOS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigdelset +# endif +# else _GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig) _GL_ARG_NONNULL ((1))); # endif @@ -116,7 +136,12 @@ _GL_CXXALIASWARN (sigdelset); /* Fill a signal set with all possible signals. */ -# if !...@have_posix_signalblocking@ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on MacOS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigfillset +# endif +# else _GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));