From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH 1/3] mini-os: add BUILD_BUG_ON()
Date: Wed, 2 Jul 2014 18:10:20 +0200 [thread overview]
Message-ID: <20140702161019.GA6022@type> (raw)
In-Reply-To: <53B43275020000780001F9CD@mail.emea.novell.com>
Jan Beulich, le Wed 02 Jul 2014 15:25:25 +0100, a écrit :
> Just copy over what the hypervisor currently uses.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> --- a/extras/mini-os/include/lib.h
> +++ b/extras/mini-os/include/lib.h
> @@ -54,6 +54,20 @@
> #include <xen/event_channel.h>
> #include "gntmap.h"
>
> +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
> +/* Force a compilation error if condition is true */
> +#define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); })
> +/* Force a compilation error if condition is true, but also produce a
> + result (of value 0 and type size_t), so the expression can be used
> + e.g. in a structure initializer (or where-ever else comma expressions
> + aren't permitted). */
> +#define BUILD_BUG_ON_ZERO(cond) \
> + sizeof(struct { _Static_assert(!(cond), "!(" #cond ")"); })
> +#else
> +#define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); })
> +#define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
> +#endif
> +
> #ifdef HAVE_LIBC
> #include <sys/queue.h>
> #include <stdio.h>
>
>
>
> mini-os: add BUILD_BUG_ON()
>
> Just copy over what the hypervisor currently uses.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/extras/mini-os/include/lib.h
> +++ b/extras/mini-os/include/lib.h
> @@ -54,6 +54,20 @@
> #include <xen/event_channel.h>
> #include "gntmap.h"
>
> +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
> +/* Force a compilation error if condition is true */
> +#define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); })
> +/* Force a compilation error if condition is true, but also produce a
> + result (of value 0 and type size_t), so the expression can be used
> + e.g. in a structure initializer (or where-ever else comma expressions
> + aren't permitted). */
> +#define BUILD_BUG_ON_ZERO(cond) \
> + sizeof(struct { _Static_assert(!(cond), "!(" #cond ")"); })
> +#else
> +#define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); })
> +#define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
> +#endif
> +
> #ifdef HAVE_LIBC
> #include <sys/queue.h>
> #include <stdio.h>
--
Samuel
<s> je la connaissais pas celle la : "make: Entering an unknown directory"
-+- #ens-mim -+-
next prev parent reply other threads:[~2014-07-02 16:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-02 13:53 [PATCH 0/3] LZO update and fixes Jan Beulich
2014-07-02 14:25 ` [PATCH 1/3] mini-os: add BUILD_BUG_ON() Jan Beulich
2014-07-02 16:10 ` Samuel Thibault [this message]
2014-07-03 9:58 ` Tim Deegan
2014-07-03 10:10 ` Jan Beulich
2014-07-03 10:26 ` Tim Deegan
2014-07-03 10:34 ` [PATCH v2 " Jan Beulich
2014-07-03 10:42 ` Tim Deegan
2014-07-02 14:26 ` [PATCH 2/3] lzo: update LZO compression to current upstream version Jan Beulich
2014-07-03 10:44 ` Ian Campbell
2014-07-02 14:27 ` [PATCH 3/3] lzo: properly check for overruns Jan Beulich
2014-07-03 10:45 ` Ian Campbell
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=20140702161019.GA6022@type \
--to=samuel.thibault@ens-lyon.org \
--cc=JBeulich@suse.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.