From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: linux-modules <linux-modules@vger.kernel.org>
Subject: Re: [PATCH] Add configure check for _Static_assert()
Date: Thu, 29 Aug 2013 09:49:32 +0200 [thread overview]
Message-ID: <20130829094932.20c35e84@skate> (raw)
In-Reply-To: <CAKi4VALsZAMwKyT8U-Jcg+E_Hm_CyiwKJf+Kr3Y-JP_7Ze5D6w@mail.gmail.com>
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@free-electrons.com> 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.
Thanks!
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2013-08-29 7:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-28 15:33 [PATCH] Add configure check for _Static_assert() Thomas Petazzoni
2013-08-29 3:55 ` Lucas De Marchi
2013-08-29 7:49 ` Thomas Petazzoni [this message]
2013-08-29 20:19 ` Lucas De Marchi
2013-09-06 12:58 ` Lucas De Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130829094932.20c35e84@skate \
--to=thomas.petazzoni@free-electrons.com \
--cc=linux-modules@vger.kernel.org \
--cc=lucas.de.marchi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).