[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

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.

I suggest changing it to:

# if defined __cplusplus && __GNUC_PREREQ (2,8)
#  define __THROW      throw ()
#  define __NTH(fct)   fct throw ()
# else
#  define __THROW
#  define __NTH(fct)   fct
# endif

as is the case in e.g. <malloc.h>.

The version check in <malloc.h> also looks broken, though probably is OK
in practice, due to GCC 1.x not being used:

# ifndef __THROW
#  if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8)
#   define __THROW      throw ()
#  else
#   define __THROW
#  endif
# endif

This should probably be using the __GNUC_PREREQ macro like everyone


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux
Locale: LANG=en_GB.UTF8, LC_CTYPE=en_GB.UTF8 (charmap=UTF-8)

Versions of packages libc6-dev depends on:
ii  libc6                         2.3.6-15   GNU C Library: Shared libraries
ii  linux-kernel-headers Linux Kernel Headers for developme

Versions of packages libc6-dev recommends:
ii  bcc [c-compiler]             0.16.14-1.4 16-bit x86 C compiler
ii  gcc [c-compiler]             4:4.1.1-3   The GNU C compiler
ii  gcc-3.3 [c-compiler]         1:3.3.6-13  The GNU C compiler
ii  gcc-3.4 [c-compiler]         3.4.6-2     The GNU C compiler
ii  gcc-4.0 [c-compiler]         4.0.3-4     The GNU C compiler
ii  gcc-4.1 [c-compiler]         4.1.1-7     The GNU C compiler

-- no debconf information

Reply to: