[lug] [OT] g++ error message: declared with an exception specification?
Scott Herod
herod at dimensional.com
Tue Nov 19 12:54:17 MST 2002
On Tue, 19 Nov 2002 rm at fabula.de wrote:
> On Tue, Nov 19, 2002 at 10:30:50AM -0700, Scott Herod wrote:
> >
> > Hello,
> >
> > Sorry of the OT post, but this is about the best group of people for it.
> >
> > I'm trying to write a bash built-in and compile it with g++. This is with
> > bash 2-05a source from the GNU folk. I'm getting errors like:
> >
> > ../GNU/bash-2.05a/general.h:187: `sh_intfunc_t' declared with an exception
> > specification
>
> Rather silly question: if you compile an extension to a C-Program, shouldn't
> the exported functions be wrapped in 'extern C ...{ ...' ? Exception specification
> smells pretty much like C++-Linking ....
>
> ralfd
I thought that was for going the other way, i.e. allowing a C++
declaration to be understood by C?
At any rate, from the dump with g++ -E I discovered that
/usr/include/sys/cdefs.h is included which contains a few lines with:
<snip>
#undef __P
#undef __PMT
#ifdef __GNUC__
/* GCC can always grok prototypes. For C++ programs we add throw()
to help it optimize the function calls. But this works only with
gcc 2.8.x and egcs. */
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
# else
# define __THROW
# endif
# define __P(args) args __THROW
<snip>
which of course screws up the __P definition previously made in one of the
bash header files. It also explains that nasty throw(). I suspect that
there are some other #defines that I need to use to not hit this section
of code.
Scott
More information about the LUG
mailing list