This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
throw in __P
- To: libc-alpha@cygnus.com
- Subject: throw in __P
- From: marc@laendle
- Date: Thu, 2 Jul 1998 14:21:54 +0200
>Submitter-Id: net
>Originator: Marc Lehmann
>Organization:
>
>Confidential: no
>Synopsis: throw () in __P generates illegal C++
>Severity: serious
>Priority: low
>Category: libc
>Class: sw-bug
>Release: libc-2.0.94
>Environment:
Host type: i686-pc-linux-gnu
System: Linux cerebro 2.1.107 #5 SMP Mon Jun 29 19:53:29 CEST 1998 i686
Architecture: i686
Addons: crypt linuxthreads
Build CFLAGS: -O2 -g2 -pipe -malign-double -mpentiumpro -march=pentiumpro
Build CC: gcc
Compiler version: egcs-2.91.43 19980628 (gcc2 ss-980502 experimental)
Kernel headers: 2.1.107
Symbol versioning: yes
Build static: yes
Build shared: no
Build pic-default: no
Build profile: no
Build omitfp: yes
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
since 19980626, __P includes throw() when used with egcs, and
since that date, c++ programs don't compile anymore ;)
the reason is that __P is used in typedefs and in declaring
function pointers in structs, i.e.
typedef int (*_IO_overflow_t) __P ((_IO_FILE *, int));
gets
typedef int (*_IO_overflow_t) (_IO_FILE *, int) throw () ;
(this is from an egcs include-file, but similar cases occur in pthread.h)
which is illegal c++ (at least according to CD2).
>How-To-Repeat:
compiling the one-liner "#include <printf.h>" generates:
/usr/include/printf.h:64: invalid exception specifications
/usr/include/printf.h:72: invalid exception specifications
>Fix:
do not use exception specifications in typedefs and struct definitions. I'm
eager to find out which solution will be put into libc ;->