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

Bug#377416: libc6-dev: __THROW defined in <sys/cdefs.h> is broken with GCC 3.3



Aurelien Jarno <aurelien@aurel32.net> writes:

> Roger Leigh wrote:
>> Package: libc6-dev
>> Version: 2.3.6-15
>> Severity: important
>>
>> # if !defined __cplusplus && __GNUC_PREREQ (3, 3)
>> #  define __THROW       __attribute__ ((__nothrow__))          XXXX
>> #  define __NTH(fct)    __attribute__ ((__nothrow__)) fct
>> # else
>> #  if defined __cplusplus && __GNUC_PREREQ (2,8)
>> #   define __THROW      throw ()
>> #   define __NTH(fct)   fct throw ()
>> #  else
>> #   define __THROW
>> #   define __NTH(fct)   fct
>> #  endif
>> # endif
>>
>> The line marked with XXXX expands incorrectly:
>>
>> void f() __THROW
>> ==> void f() __attribute__ ((__nothrow__))
>>
>> instead of void __attribute__ ((__nothrow__)) f()
>>
>> The __NTH macro is OK.  It's OK for later compilers, but I'm not sure
>> this special case for GCC 3.3 is necessary, unless there's a reason
>> why the more general throw() doesn't work with GCC 3.3?  throw() is
>> standard C++ syntax, so this looks rather broken, IMO.
>
> Except we are compiling C code here, not C++ code.

Yes, you are right.  However, the expansion is still broken (this is
what was causing the glibc build failure on glibc WRT #340871).

The problem is not that __THROW is used *after* the function
declaration, rather than immediately before the function name,
resulting in synatically incorrect code, as I demonstrated above.


-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please sign and encrypt your mail.

Attachment: pgpMUofwvW6Av.pgp
Description: PGP signature


Reply to: