[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH][BZ #16907] Do not disable __attribute__ when you include arg
From: |
Ondřej Bílka |
Subject: |
Re: [PATCH][BZ #16907] Do not disable __attribute__ when you include argp.h |
Date: |
Fri, 23 May 2014 12:00:38 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Mon, May 19, 2014 at 08:37:27AM +0100, Will Newton wrote:
> On 18 May 2014 13:57, Ondřej Bílka <address@hidden> wrote:
> > Hi,
> >
> > As written in bug report:
> >
> > "
> > When <argp.h> is included first and thus __attribute__ is not defined,
> > with -std=c90, c99 or c11, the __attribute__ is redefined as empty due
> > to the following code:
> > This might break headers included later, for example it breaks
> > -D_FORTIFY_SOURCE=2 by not defining strcpy() correctly [1]. Besides some
> > reformating, this code is more than 10 years old, and I don't know if
> > there is still a reason to redefine __attribute__ that way.
> > "
> >
> > So is there any reason to keep fragments of code below? As we use
> > __attribute__ in stdio.h without checking gcc version I doubt that
> > compiling with gcc would work. I did not checked that though.
>
> I believe this file is shared with gnulib so changes should ideally be
> synchronized between the two projects.
>
CCing gnulib. Could this be backported also there or do you have
different solution?
> >
> >
> >
> > * argp/argp-fmtstream.h: Do not define __attribute__.
> > * argp/argp.h: Likewise.
> >
> >
> > diff --git a/argp/argp-fmtstream.h b/argp/argp-fmtstream.h
> > index 1ed2834..f3f82df 100644
> > --- a/argp/argp-fmtstream.h
> > +++ b/argp/argp-fmtstream.h
> > @@ -29,21 +29,6 @@
> > #include <string.h>
> > #include <unistd.h>
> >
> > -#ifndef __attribute__
> > -/* This feature is available in gcc versions 2.5 and later. */
> > -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \
> > - defined __STRICT_ANSI__
> > -# define __attribute__(Spec) /* empty */
> > -# endif
> > -/* The __-protected variants of `format' and `printf' attributes
> > - are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
> > -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \
> > - defined __STRICT_ANSI__
> > -# define __format__ format
> > -# define __printf__ printf
> > -# endif
> > -#endif
> > -
> > #if defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)
> > /* line_wrap_stream is available, so use that. */
> > #define ARGP_FMTSTREAM_USE_LINEWRAP
> > diff --git a/argp/argp.h b/argp/argp.h
> > index 0868228..c1072a3 100644
> > --- a/argp/argp.h
> > +++ b/argp/argp.h
> > @@ -35,21 +35,6 @@
> > # define __NTH(fct) fct __THROW
> > #endif
> >
> > -#ifndef __attribute__
> > -/* This feature is available in gcc versions 2.5 and later. */
> > -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \
> > - defined __STRICT_ANSI__
> > -# define __attribute__(Spec) /* empty */
> > -# endif
> > -/* The __-protected variants of `format' and `printf' attributes
> > - are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
> > -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \
> > - defined __STRICT_ANSI__
> > -# define __format__ format
> > -# define __printf__ printf
> > -# endif
> > -#endif
> > -
> > /* GCC 2.95 and later have "__restrict"; C99 compilers have
> > "restrict", and "configure" may have defined "restrict". */
> > #ifndef __restrict
>
- Re: [PATCH][BZ #16907] Do not disable __attribute__ when you include argp.h,
Ondřej Bílka <=