This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: static_assert in c89 and c99


On Thu, Feb 05, 2015 at 10:59:07AM +0100, Lars Gullik BjÃnnes wrote:
> >> In assert.h static_assert is always defined when __USE_ISOC11 is defined
> >> and that is unconditionally defined by _ISOC11_SOURCE. For a library
> >> feature that would be ok, but since static_assert is using
> >> _Static_assert its usability is really controlled by the compiler and
> >> -std=c11.
> >> 
> >> I think the static_assert define must be guarded by a check that
> >> -std=c11 really is in effect.
> >
> | If glibc is providing static_assert using _Static_assert on compilers
> | which don't implement the latter, that should probably be fixed. It
> | could be done using _Static_assert conditionally on __GNUC__>=x ||
> | __STDC_VERSION__>=C11, with a fallback to an old method like the dummy
> | type declaration with possibly-invalid array size.
> 
> Gcc 4.6 got support for _Static_assert unconditionally.
> We se the problem since we are (unfortunately) forced to use gcc 4.4.

Then I think glibc should check for 100*__GNUC__+__GNUC_MINOR__<406
and use an alternate definition for _Static_assert in that case. Even
if glibc does not support being built with gcc 4.4, it should still
support using gcc 4.4 (and much older) to compile applications against
glibc.

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]