From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Tim Deegan <tim@xen.org>, xen-devel@lists.xen.org
Cc: Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH v2] RFC: Automatically check xen's public headers for C++ pitfalls.
Date: Thu, 26 Feb 2015 16:43:56 +0000 [thread overview]
Message-ID: <54EF4D4C.7030005@citrix.com> (raw)
In-Reply-To: <20150226162842.GG43832@deinos.phlegethon.org>
On 26/02/15 16:28, Tim Deegan wrote:
> At 16:11 +0000 on 26 Feb (1424963496), Tim Deegan wrote:
>> Add a check, like the existing check for non-ANSI C in the public
>> headers, that runs the public headers through a C++ compiler to
>> flag non-C++-friendly constructs.
> Oops, this still has the EFI changes in it. v3, rebased, is on its way.
>
>> Unlike the ANSI C check, we accept GCC-isms (gnu++98), and we also
>> check various tools-only headers.
>>
>> Explicitly _not_ addressing the use of 'private' in various fields,
>> since we'd previously decided not to fix that.
> BTW, ring.h is the only instance of that, so the extra diff to clear
> that up too is pretty small (see below).
>
> Not sure what people think about that though - it might be
> quite a PITA for downstream users of it, though they ought really to
> be using local copies so they can update in a controlled way.
It is basically no effort, wont (directly) break consumers, and will
make the headers fully friendly (other than extern C, which can be dealt
with using the C++ #include <c$FOO> pattern).
+1 throw this in and be done with the incompatibilities for good.
~Andrew
>
> diff --git a/xen/include/Makefile b/xen/include/Makefile
> index d48a642..c7a1d52 100644
> --- a/xen/include/Makefile
> +++ b/xen/include/Makefile
> @@ -104,8 +104,7 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
> headers++.chk: $(PUBLIC_HEADERS) Makefile
> if $(CXX) -v >/dev/null 2>&1; then \
> for i in $(filter %.h,$^); do \
> - $(CXX) -x c++ -std=gnu++98 -Wall -Werror \
> - -D__XEN_TOOLS__ -Dprivate=private_is_a_keyword_in_cpp \
> + $(CXX) -x c++ -std=gnu++98 -Wall -Werror -D__XEN_TOOLS__ \
> -include stdint.h -include public/xen.h \
> -S -o /dev/null $$i || exit 1; \
> echo $$i; \
> diff --git a/xen/include/public/io/ring.h b/xen/include/public/io/ring.h
> index 73e13d7..bb13494 100644
> --- a/xen/include/public/io/ring.h
> +++ b/xen/include/public/io/ring.h
> @@ -111,7 +111,7 @@ struct __name##_sring { \
> uint8_t msg; \
> } tapif_user; \
> uint8_t pvt_pad[4]; \
> - } private; \
> + } local; \
> uint8_t __pad[44]; \
> union __name##_sring_entry ring[1]; /* variable-length */ \
> }; \
> @@ -156,7 +156,7 @@ typedef struct __name##_back_ring __name##_back_ring_t
> #define SHARED_RING_INIT(_s) do { \
> (_s)->req_prod = (_s)->rsp_prod = 0; \
> (_s)->req_event = (_s)->rsp_event = 1; \
> - (void)memset((_s)->private.pvt_pad, 0, sizeof((_s)->private.pvt_pad)); \
> + (void)memset((_s)->local.pvt_pad, 0, sizeof((_s)->local.pvt_pad)); \
> (void)memset((_s)->__pad, 0, sizeof((_s)->__pad)); \
> } while(0)
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-02-26 16:43 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 13:11 [PATCH] RFC: Make xen's public headers a little friendlier for C++ Tim Deegan
2015-02-26 14:09 ` Jan Beulich
2015-02-26 15:22 ` Tim Deegan
2015-02-26 15:39 ` Jan Beulich
2015-02-26 16:11 ` [PATCH v2] RFC: Automatically check xen's public headers for C++ pitfalls Tim Deegan
2015-02-26 16:28 ` Tim Deegan
2015-02-26 16:43 ` Andrew Cooper [this message]
2015-02-26 16:47 ` Jan Beulich
2015-02-26 17:01 ` Tim Deegan
2015-02-26 17:49 ` Razvan Cojocaru
2015-02-26 19:22 ` Tim Deegan
2015-02-26 20:31 ` Don Slutz
2015-02-27 8:00 ` Jan Beulich
2015-02-26 16:49 ` David Vrabel
2015-03-05 11:25 ` Tim Deegan
2015-03-05 11:35 ` Ian Campbell
2015-03-05 11:41 ` Jan Beulich
2015-03-05 11:55 ` Ian Campbell
2015-03-05 12:13 ` Wei Liu
2015-03-05 12:34 ` Ian Campbell
2015-03-05 12:16 ` Tim Deegan
2015-03-12 10:03 ` Tim Deegan
2015-03-12 10:14 ` Ian Campbell
2015-03-12 11:16 ` Tim Deegan
2015-03-12 10:57 ` Jan Beulich
2015-02-26 16:24 ` [PATCH v3] " Tim Deegan
2015-02-26 20:28 ` Don Slutz
2015-02-27 10:05 ` Tim Deegan
2015-02-27 8:36 ` Jan Beulich
2015-02-27 9:22 ` Tim Deegan
2015-02-27 9:34 ` Jan Beulich
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=54EF4D4C.7030005@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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.