[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



On Wed, Feb 07, 2007 at 12:20:38AM +0000, Roger Leigh wrote:
> Pierre HABOUZIT <madcoder@debian.org> writes:
> 
> > tag 377416 + moreinfo
> > thanks
> >
> > On Sat, Jul 08, 2006 at 08:14:35PM +0100, 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()
> >
> >   I'm not sure to understand where the problem is.
> 
> I thought I explained the problem adequately in the bug report.  Look
> at the example in the very first entry.  The versions for GCC >= 3.3
> are totally different from >= 2.8.  GCC function attributes are
> specified *before* the function name, and yet the GCC >= 2.8 variation
> uses throw() which is used *after* the function name and arguments.
> As a result, it it will break depending upon the compiler version,
> because wherever you put __THROW it will always be broken on one
> compiler.

  Well I was not 100% sure what your problem was, I think I now
understand correctly what you think is wrong. So here is my
interpretation of the problem:

  I still think __THROW shall not be used elswhere than in function
prototypes. With gcc attributes can be postfixed at the prototype
declaration level like this:

    return_type function_name(something *) __attribute__((__nothrow__));

  so about #340871 and
> http://bugs.debian.org/cgi-bin/bugreport.cgi/local-mathinline_h.diff?bug=340871;msg=137;att=2

  I believe that the "fix" is not correct, it should have used
__NTH(...) rather than __THROW.


  Looking at __NTH, it has (in the glibc2.5) 2 implementations:

  * argp.h (buggy)
  * cdefs.h (ok)

  glibc-ports has none.

  So it looks like to me that only the argp.h definition has to be
fixed, and that the m68k patch has to be fixed to use the one in cdefs
rather than __THROW for the static inlines.


Summarry:

  Sorry if I'm being dense, but I really think that the m68k patch is
wrong (I'll fix it as soon as I got an access to the pkg-glibc repo on
alioth) __and__ the real problem lies in argp.h __NTH implementation.
Not with __THROW that indeed has the drawbacks you mention, but is
really not meant to be used for anything else than a prototype
declaration.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpkseXUzQwLh.pgp
Description: PGP signature


Reply to: