[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/8] osdep.h: Define macros for the benefit of C
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 2/8] osdep.h: Define macros for the benefit of C++ before C++11 |
Date: |
Thu, 18 Feb 2016 11:51:05 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 02/18/2016 11:05 AM, Peter Maydell wrote:
> For C++ before C++11, <stdint.h> requires definition of the macros
> __STDC_CONSTANT_MACROS, __STDC_LIMIT_MACROS and __STDC_FORMAT_MACROS
> in order to enable definition of various macros by the header file.
> Define these in osdep.h, so that we get the right header file
> definitions whether osdep.h is being used by plain C, C++11 or
> older C++.
>
> In particular libvixl's header files depend on this and won't
> compile if osdep.h is included before them otherwise.
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> include/qemu/osdep.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
Reviewed-by: Eric Blake <address@hidden>
> +/* Older versions of C++ don't get definitions of various macros from
> + * stdlib.h unless we define these macros before first inclusion of
> + * that system header.
> + */
> +#ifndef __STDC_CONSTANT_MACROS
> +#define __STDC_CONSTANT_MACROS
> +#endif
Style nit: In libvirt, we've grown used to writing:
#ifndef ...
# define ...
#endif
that is, use spacing to make it more visually obvious what level of
conditional nesting is in effect during preprocessor lines. But short
of a tree-wide change to enforce that style (which I'm not advocating),
it's more of a food for thought comment, and has no bearing on taking
this series as is.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 0/8] more include cleaning, Peter Maydell, 2016/02/18
- [Qemu-devel] [PATCH 7/8] all: Clean up includes, Peter Maydell, 2016/02/18
- [Qemu-devel] [PATCH 8/8] include: Clean up includes, Peter Maydell, 2016/02/18
- [Qemu-devel] [PATCH 2/8] osdep.h: Define macros for the benefit of C++ before C++11, Peter Maydell, 2016/02/18
- Re: [Qemu-devel] [PATCH 2/8] osdep.h: Define macros for the benefit of C++ before C++11,
Eric Blake <=
- [Qemu-devel] [PATCH 6/8] osdep.h: Include config-target.h if NEED_CPU_H is defined, Peter Maydell, 2016/02/18
- [Qemu-devel] [PATCH 3/8] disas/arm-a64.cc: Include osdep.h first, Peter Maydell, 2016/02/18
- [Qemu-devel] [PATCH 4/8] scripts/clean-includes: Enhance to handle header files, Peter Maydell, 2016/02/18
- [Qemu-devel] [PATCH 5/8] scripts/clean-includes: Add --all option, Peter Maydell, 2016/02/18