All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Simon Marchi <simon.marchi@efficios.com>
Cc: lttng-dev <lttng-dev@lists.lttng.org>
Subject: Re: [PATCH lttng-ust] Make bitfield.h C++-friendly
Date: Mon, 19 Aug 2019 22:02:45 -0400 (EDT)	[thread overview]
Message-ID: <1789263059.655.1566266565980.JavaMail.zimbra__12031.9168710679$1566266581$gmane$org@efficios.com> (raw)
In-Reply-To: <20190820015106.22331-1-simon.marchi@efficios.com>

Merged in lttng-ust master branch, thanks!

Mathieu

----- On Aug 19, 2019, at 6:51 PM, Simon Marchi simon.marchi@efficios.com wrote:

> This patch changes bitfield.h to be usable in C++11.
> 
> It will probably never be compiled as C++ in the context of
> lttng-ust, but this is just to keep things sync'ed across projects.
> 
> Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
> ---
> include/lttng/bitfield.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/include/lttng/bitfield.h b/include/lttng/bitfield.h
> index 5ed629381ac6..9386fade1b76 100644
> --- a/include/lttng/bitfield.h
> +++ b/include/lttng/bitfield.h
> @@ -70,8 +70,12 @@
>  * Produce a build-time error if the condition `cond` is non-zero.
>  * Evaluates as a size_t expression.
>  */
> +#ifdef __cplusplus
> +#define _BT_BUILD_ASSERT(cond) ([]{static_assert((cond), "");}, 0)
> +#else
> #define _BT_BUILD_ASSERT(cond)					\
> 	sizeof(struct { int f:(2 * !!(cond) - 1); })
> +#endif
> 
> /*
>  * Cast value `v` to an unsigned integer of the same size as `v`.
> @@ -377,7 +381,7 @@ do {									\
> do {									\
> 	__typeof__(*(vptr)) *_vptr = (vptr);				\
> 	__typeof__(*_vptr) _v;						\
> -	type *_ptr = (void *) (ptr);					\
> +	type *_ptr = (type *) (ptr);					\
> 	unsigned long _start = (start), _length = (length);		\
> 	type _mask, _cmask;						\
> 	unsigned long _ts = sizeof(type) * CHAR_BIT; /* type size */	\
> --
> 2.23.0
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

       reply	other threads:[~2019-08-20  2:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190820015106.22331-1-simon.marchi@efficios.com>
2019-08-20  2:02 ` Mathieu Desnoyers [this message]
2019-08-20  1:51 [PATCH lttng-ust] Make bitfield.h C++-friendly Simon 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='1789263059.655.1566266565980.JavaMail.zimbra__12031.9168710679$1566266581$gmane$org@efficios.com' \
    --to=mathieu.desnoyers@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    --cc=simon.marchi@efficios.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 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.