[systemd-devel] [PATCH] use static_assert instead of assert_cc

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sun Dec 30 07:32:43 PST 2012


On Sat, Dec 29, 2012 at 11:14:15PM +0100, Thomas H.P. Andersen wrote:
> On Sat, Dec 29, 2012 at 5:04 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
> > On Sat, Dec 29, 2012 at 02:10:27AM +0100, Thomas H.P. Andersen wrote:
> >> Another item from the todo
> > Hi,
> >
> > the patch looks great, but it raises compatibility problems. AFAICT,
> > required gcc version to raised to 4.6. Debian/squeeze has 4.4.
> 
> According to http://gcc.gnu.org/projects/cxx0x.html static_assert
> should be supported from gcc 4.3
Hm, testing (with 4.4) shows that neither static_assert nor _Static_assert
are available. With 4.6 _Static_assert is available.

Michael Biebl says that Debian/squeeze doesn't have to be supported.
This probably means that it's enough to have gcc-4.6 supported.
This means that we don't need to support compilers which don't
support _Static_assert.

> > clang has _Static_assert, not static_assert. I think that a compile
> > time check is in order. Support for old gcc versions is less
> > important, so it might be enough to document the requirement in
> > README, and then maybe provide a fallback if people complain. OTOH
> > clang compilation support is useful (and used), so it should be kept.
> 
> It builds with clang here. That is with "clang version 3.1
> (branches/release_31)" from F18.
static_assert is provided by /usr/include/assert.h (from glibc).
since http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=839e283ec
(Jan 01 2012). This version hasn't been officially released yet,
AFAICT.  The define is trivial, and could be easily provided in
missing.h.

Zbyszek


More information about the systemd-devel mailing list