qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Patch Tracking <patches@linaro.org>
Subject: Re: [Qemu-devel] [PATCH 03/14] disas/arm-a64.cc: Include osdep.h first
Date: Thu, 18 Feb 2016 15:49:51 +0000	[thread overview]
Message-ID: <CAFEAcA91Aa7BeMToTXJ4_S=V+jWHzk+bx4N7NEKRJih0-MsMHA@mail.gmail.com> (raw)
In-Reply-To: <1455031511-23684-4-git-send-email-peter.maydell@linaro.org>

On 9 February 2016 at 15:25, Peter Maydell <peter.maydell@linaro.org> wrote:
> Rearrange include directives so that we include osdep.h first.
> This has to be done manually because clean-includes doesn't
> handle C++.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  disas/arm-a64.cc | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc
> index d4d46d5..9280950 100644
> --- a/disas/arm-a64.cc
> +++ b/disas/arm-a64.cc
> @@ -17,12 +17,13 @@
>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>   */
>
> -#include "vixl/a64/disasm-a64.h"
> -
>  extern "C" {
> +#include "qemu/osdep.h"
>  #include "disas/bfd.h"
>  }
>
> +#include "vixl/a64/disasm-a64.h"
> +
>  using namespace vixl;
>
>  static Decoder *vixl_decoder = NULL;

So this patch doesn't build on the old mingw32 compiler. I think this
is because this compiler is not C++11, and so its <stdint.h> doesn't
provide various macros for C++ unless __STDC_CONSTANT_MACROS,
__STDC_LIMIT_MACROS and __STDC_FORMAT_MACROS are defined before the
first inclusion of <stdint.h>.

libvixl's globals.h defines these constants, but this only works if
globals.h is first-include, so making osdep.h first-include then
results in stdint.h being included before globals.h has a chance
to set the defines.

What's the best way to deal with this? I can see a couple of options:

(1) as a special case, for this file include disasm-a64.h before
osdep.h
(2) as a special case, for this file manually define the __STDC_*
before including osdep.h
(3) make osdep.h itself define the __STDC_* constants so it works
with C++-before-C++11 as well as with C and with C++11

I think I prefer (3) (though it does mean we will have to tweak
osdep.h in future if a new vixl version should ever require any
further similar #defines.)

thanks
-- PMM

  reply	other threads:[~2016-02-18 15:50 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 15:24 [Qemu-devel] [PATCH 00/14] More #include cleanups Peter Maydell
2016-02-09 15:24 ` [Qemu-devel] [PATCH 01/14] cpu: Clean up includes Peter Maydell
2016-02-12 14:49   ` Andreas Färber
2016-02-09 15:24 ` [Qemu-devel] [PATCH 02/14] ui/cocoa.m: Include qemu/osdep.h Peter Maydell
2016-02-09 16:07   ` Eric Blake
2016-02-09 16:08     ` Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 03/14] disas/arm-a64.cc: Include osdep.h first Peter Maydell
2016-02-18 15:49   ` Peter Maydell [this message]
2016-02-18 16:41     ` Markus Armbruster
2016-02-18 16:42       ` Peter Maydell
2016-02-18 17:15     ` Eric Blake
2016-02-09 15:25 ` [Qemu-devel] [PATCH 04/14] hw/block/nand.c: " Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 05/14] target-cris: Remove unnecessary ifdef from mmu.c Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 06/14] cris: Clean up includes Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 07/14] libdecnumber: " Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 08/14] tests/i440fx-test: Don't define ARRAY_SIZE locally Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 09/14] tests: Clean up includes Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 10/14] qapi: Clean up includes in generated files Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 11/14] scripts/feature_to_c.sh: Include qemu/osdep.h rather than config.h Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 12/14] scripts/tracetool: Include qemu/osdep.h in generated .c files Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 13/14] all: Clean up includes Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 14/14] oslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h Peter Maydell
2016-02-09 16:08 ` [Qemu-devel] [PATCH 00/14] More #include cleanups Eric Blake
2016-02-09 16:11   ` Eric Blake
2016-02-09 16:21     ` Peter Maydell
2016-02-09 17:01       ` Peter Maydell
2016-02-09 17:10       ` Eric Blake
2016-02-09 17:18         ` Eric Blake
2016-02-09 18:04           ` Peter Maydell
2016-02-09 18:17             ` Paolo Bonzini
2016-02-09 18:29             ` Eric Blake
2016-02-16 13:49 ` Peter Maydell
2016-02-16 15:47   ` Peter Maydell

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='CAFEAcA91Aa7BeMToTXJ4_S=V+jWHzk+bx4N7NEKRJih0-MsMHA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=patches@linaro.org \
    --cc=qemu-devel@nongnu.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 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).