bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module 'c++defs'


From: John W. Eaton
Subject: Re: new module 'c++defs'
Date: Tue, 23 Feb 2010 10:48:21 -0500

On 23-Feb-2010, Eric Blake wrote:

| According to John W. Eaton on 2/23/2010 7:51 AM:
| > The only other error I'm seeing is
| > 
| >   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-oct-time.lo -MD -MP -MF 
.deps/liboctave_la-oct-time.Tpo -c /home/jwe/src/octave/liboctave/oct-time.cc  
-fPIC -DPIC -o .libs/liboctave_la-oct-time.o
| >   In file included from /home/jwe/src/octave/liboctave/oct-time.cc:30:
| >   ../libgnu/sys/time.h:230: error: invalid conversion from 'int 
(*)(timeval*, timezone*)throw ()' to 'int (*)(timeval*, void*)'
| >   make[1]: *** [liboctave_la-oct-time.lo] Error 1
| 
| Sounds like a case where GETTIMEOFDAY_TIMEZONE is needed.

Ah, OK, using

  _GL_FUNCDECL_RPL (gettimeofday, int,
                    (struct timeval *restrict, GETTIMEOFDAY_TIMEZONE *restrict)
                    _GL_ARG_NONNULL ((1)));
  _GL_CXXALIAS_RPL (gettimeofday, int,
                    (struct timeval *restrict, GETTIMEOFDAY_TIMEZONE 
*restrict));
  #  else
  _GL_CXXALIAS_SYS (gettimeofday, int,
                    (struct timeval *restrict, GETTIMEOFDAY_TIMEZONE 
*restrict));

instead of

  _GL_FUNCDECL_RPL (gettimeofday, int,
                    (struct timeval *restrict, void *restrict)
                    _GL_ARG_NONNULL ((1)));
  _GL_CXXALIAS_RPL (gettimeofday, int,
                    (struct timeval *restrict, void *restrict));
  #  else
  _GL_CXXALIAS_SYS (gettimeofday, int,
                    (struct timeval *restrict, void *restrict));

avoided the problem for me.

Now I'm able to compile all of Octave with the c++defs module and with

  #define GNULIB_NAMESPACE gnulib

in Octave's config.h file.

But at this point I have not added the gnulib:: namespace tag to 
all the calls to system library functions that could be handled by
gnulib.  So as things are now, building Octave on a system which
requires gnulib replacement functiosn will fail (1) at build time if
there are missing functions, or (2) at run time if there are broken
functions.   I think that building Octave only works for me because
I'm using a system that doesn't have any missing functions which
require gnulib replacement.

How can one easily find all the places where the GNULIB_NAMESPACE tag
is needed?  Is there some way we can get the compiler to help with
this job?

The reason I liked the idea of having the gnulib headers automatically
add the "using gnulib::FOO" directive was that it would require no
change to my code.  One of the great things about gnulib with C is
that it allows the system functions to be replaced when needed without
having to change existing code.  Retrofitting a large project with
namespace tags will be tedious at best, and likely to result in hard
to find errors.

Is there some reason to not add using directives in the gnulib
headers for each system function that is placed in the gnulib::
namespace?

Oh, now I remember that doing this requires placing the system headers
inside a namespace, and I guess that could cause some trouble.  But
would you be interested in trying it?  I could do the testing and help
with making the required changes.

jwe




reply via email to

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