Re: [PATCH] Add configure check for _Static_assert()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 29, 2013 at 4:49 AM, Thomas Petazzoni
<thomas.petazzoni@xxxxxxxxxxxxxxxxxx> wrote:
> Dear Lucas De Marchi,
>
> On Thu, 29 Aug 2013 00:55:04 -0300, Lucas De Marchi wrote:
>> Hi Thomas,
>>
>> On Wed, Aug 28, 2013 at 12:33 PM, Thomas Petazzoni
>> <thomas.petazzoni@xxxxxxxxxxxxxxxxxx> wrote:
>> > 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 older
>>
>> What 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).
>
>> > +#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
--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux