c++/767: -fno-honor-std impossible on Linux
wolfgang.bangerth@iwr.uni-heidelberg.de
wolfgang.bangerth@iwr.uni-heidelberg.de
Fri Nov 10 05:56:00 GMT 2000
>Number: 767
>Category: c++
>Synopsis: -fno-honor-std impossible on Linux
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Nov 10 05:56:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Wolfgang Bangerth
>Release: unknown-1.0
>Organization:
>Environment:
gcc version 2.97 20001106/Linux 2.2.14
>Description:
Trying to compiler some code we have with -fno-honor-std, I
fell over several hundred errors like
x.cc:7: declaration of `int remove(const char*)' throws different exceptions
x.cc:2: than previous declaration `int remove(const char*) throw ()'
They are due to code like this:
-----------------------------------------------
extern "C" {
extern int remove (__const char *__filename) throw ();
}
namespace std
{
extern "C" int remove(const char*);
}
------------------------------------------------
The first is included from the system headers (/usr/include/argp.h), where
# define __P(args) args throw ()
while the second declaration is from
gcc/include/g++-v3/bits/.
This problem is quite unfortunate, as it will most probably
not allow to compile old code that does not use std::
on Linux. On other systems, the problem may be nonexistent
if __P is not declared using `throw' (e.g., Solaris does
not declare it with `throw').
>How-To-Repeat:
>Fix:
In shadow headers, declare all C-style functions in namespace
std with `throw()' if system headers do that as well.
Alternatively (but I don't know whether that is right): why
are exception specifications important to extern C function
at all? They can't throw any, so one could as well ignore
exception specifications on them.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list