Re: [PATCH] Add configure check for _Static_assert()
From: Lucas De Marchi <hidden>
Date: 2013-09-06 12:58:28
On Thu, Aug 29, 2013 at 4:49 AM, Thomas Petazzoni [off-list ref] wrote:
Dear Lucas De Marchi, On Thu, 29 Aug 2013 00:55:04 -0300, Lucas De Marchi wrote:quoted
Hi Thomas, On Wed, Aug 28, 2013 at 12:33 PM, Thomas Petazzoni [off-list ref] wrote:quoted
Commit 8efede20ef ("Use _Static_assert") introduced the usage of _Static_assert(). However, _Static_assert() is a fairly new thing, since it was introduced only in gcc 4.6. In order to support olderWhat distro is still in gcc 4.6? Is it a LTS one?It's not a distro. As you know, I work on the Buildroot project, a tool that builds rootfs for embedded Linux systems using cross-compilation. One of the package we have is obviously kmod, but since we support a wide range of architectures, not all of them are necessarily fully up-to-date in terms of compiler version. The specific example that raised the problem is a gcc 4.5.x toolchain for PowerPC provided by Mentor Graphics Sourcery CodeBench (formerly known as CodeSourcery).quoted
quoted
+#if defined(HAVE_STATIC_ASSERT) #define assert_cc(expr) \ _Static_assert((expr), #expr) +#else +#define assert_cc(expr)could you then define it similarly to what it was before then in this #else? I think this would do it (totally untested) with the downside of an ugly build error. #define assert_cc(expr) \ do { (void) sizeof(char [1 - 2*!(expr)]); } while(0)Sure, will fix this and resend.
Ping. Lucas De Marchi