From a7ac034985bdc8192dc136dd252072a51693ac53 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 5 Jan 2021 09:40:19 -0600 Subject: [PATCH] Add `WORD_BITS` predef detection. fixes https://github.com/boostorg/predef/pull/107 fixes https://github.com/boostorg/predef/pull/108 --- doc/history.adoc | 2 + doc/index.html | 49 ++++++++++++-- doc/predef.adoc | 2 + include/boost/predef/architecture.h | 1 - include/boost/predef/architecture/alpha.h | 5 ++ include/boost/predef/architecture/arm.h | 10 +++ include/boost/predef/architecture/blackfin.h | 5 ++ include/boost/predef/architecture/convex.h | 5 ++ include/boost/predef/architecture/ia64.h | 5 ++ include/boost/predef/architecture/m68k.h | 5 ++ include/boost/predef/architecture/mips.h | 10 +++ include/boost/predef/architecture/parisc.h | 5 ++ include/boost/predef/architecture/ppc.h | 5 ++ include/boost/predef/architecture/ptx.h | 5 ++ include/boost/predef/architecture/pyramid.h | 5 ++ include/boost/predef/architecture/riscv.h | 5 ++ include/boost/predef/architecture/rs6k.h | 10 +++ include/boost/predef/architecture/sparc.h | 10 +++ include/boost/predef/architecture/superh.h | 13 ++++ include/boost/predef/architecture/sys370.h | 5 ++ include/boost/predef/architecture/sys390.h | 5 ++ include/boost/predef/architecture/x86/32.h | 5 ++ include/boost/predef/architecture/x86/64.h | 5 ++ include/boost/predef/architecture/z.h | 5 ++ include/boost/predef/other.h | 5 +- include/boost/predef/other/endian.h | 6 +- include/boost/predef/other/wordsize.h | 69 ++++++++++++++++++++ include/boost/predef/platform.h | 1 - 28 files changed, 252 insertions(+), 11 deletions(-) create mode 100644 include/boost/predef/other/wordsize.h diff --git a/doc/history.adoc b/doc/history.adoc index 41c2e25..38b31e9 100644 --- a/doc/history.adoc +++ b/doc/history.adoc @@ -14,6 +14,8 @@ http://www.boost.org/LICENSE_1_0.txt) * Fix including sub-BSD OS headers directly causing redef warnings. * Add CI testing of direct inclusion of all headers. * Add CI testing on FreeBSD for clang and gcc. +* Add `WORD_BITS` set of predefs to detect the architecture word size. + Initial implementation inspired by submission from Mikhail Komarov. == 1.11 diff --git a/doc/index.html b/doc/index.html index 9884ed7..f8d328f 100644 --- a/doc/index.html +++ b/doc/index.html @@ -693,8 +693,9 @@ pre.pygments .tok-il { color: #666666 } /* Literal.Number.Integer.Long */
  • 4.8. Other macros
  • 4.9. Version definition macros @@ -6390,7 +6391,43 @@ information and acquired knowledge:

    -

    4.8.2. BOOST_PREDEF_WORKAROUND

    +

    4.8.2. BOOST_ARCH_WORD_BITS

    +
    +

    Detects the native word size, in bits, for the current architecture. There are +two types of macros for this detection:

    +
    +
    +
      +
    • +

      BOOST_ARCH_WORD_BITS, gives the number of word size bits +(16, 32, 64).

      +
    • +
    • +

      BOOST_ARCH_WORD_BITS_16, BOOST_ARCH_WORD_BITS_32, and +BOOST_ARCH_WORD_BITS_64, indicate when the given word size is +detected.

      +
    • +
    +
    +
    +

    They allow for both single checks and direct use of the size in code.

    +
    +
    + + + + + +
    +
    +
    +The word size is determined manually on each architecture. Hence use of +the wordsize.h header will also include all the architecture headers. +
    +
    +
    +
    +

    4.8.3. BOOST_PREDEF_WORKAROUND

    BOOST_PREDEF_WORKAROUND(symbol,comp,major,minor,patch)
    @@ -6416,7 +6453,7 @@ is undefine this expand to test the given symbol version value with
    -

    4.8.3. BOOST_PREDEF_TESTED_AT

    +

    4.8.4. BOOST_PREDEF_TESTED_AT

    BOOST_PREDEF_TESTED_AT(symbol,major,minor,patch)
    @@ -6820,6 +6857,10 @@ expressions. It defaults to "c++", but can be any of: "c", "cpp",
  • Add CI testing on FreeBSD for clang and gcc.

  • +
  • +

    Add WORD_BITS set of predefs to detect the architecture word size. +Initial implementation inspired by submission from Mikhail Komarov.

    +
  • diff --git a/doc/predef.adoc b/doc/predef.adoc index cac33c8..85566b9 100644 --- a/doc/predef.adoc +++ b/doc/predef.adoc @@ -828,6 +828,8 @@ include::../include/boost/predef/hardware/simd/x86_amd/versions.h[tag=reference] include::../include/boost/predef/other/endian.h[tag=reference] +include::../include/boost/predef/other/wordsize.h[tag=reference] + include::../include/boost/predef/other/workaround.h[tag=reference] :leveloffset: -3 diff --git a/include/boost/predef/architecture.h b/include/boost/predef/architecture.h index 732d6f0..3048329 100644 --- a/include/boost/predef/architecture.h +++ b/include/boost/predef/architecture.h @@ -29,6 +29,5 @@ http://www.boost.org/LICENSE_1_0.txt) #include #include #include -/*#include */ #endif diff --git a/include/boost/predef/architecture/alpha.h b/include/boost/predef/architecture/alpha.h index a24b10f..64d3dad 100644 --- a/include/boost/predef/architecture/alpha.h +++ b/include/boost/predef/architecture/alpha.h @@ -52,6 +52,11 @@ http://en.wikipedia.org/wiki/DEC_Alpha[DEC Alpha] architecture. # define BOOST_ARCH_ALPHA_AVAILABLE #endif +#if BOOST_ARCH_ALPHA +# undef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_ALPHA_NAME "DEC Alpha" #endif diff --git a/include/boost/predef/architecture/arm.h b/include/boost/predef/architecture/arm.h index b7a8a83..8ab20b2 100644 --- a/include/boost/predef/architecture/arm.h +++ b/include/boost/predef/architecture/arm.h @@ -126,6 +126,16 @@ http://en.wikipedia.org/wiki/ARM_architecture[ARM] architecture. # define BOOST_ARCH_ARM_AVAILABLE #endif +#if BOOST_ARCH_ARM +# if BOOST_ARCH_ARM >= BOOST_VERSION_NUMBER(8,0,0) +# undef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_AVAILABLE +# else +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + #define BOOST_ARCH_ARM_NAME "ARM" #endif diff --git a/include/boost/predef/architecture/blackfin.h b/include/boost/predef/architecture/blackfin.h index ce1a655..5c94b44 100644 --- a/include/boost/predef/architecture/blackfin.h +++ b/include/boost/predef/architecture/blackfin.h @@ -39,6 +39,11 @@ Blackfin Processors from Analog Devices. # define BOOST_ARCH_BLACKFIN_AVAILABLE #endif +#if BOOST_ARCH_BLACKFIN +# undef BOOST_ARCH_WORD_BITS_16 +# define BOOST_ARCH_WORD_BITS_16 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_BLACKFIN_NAME "Blackfin" #endif diff --git a/include/boost/predef/architecture/convex.h b/include/boost/predef/architecture/convex.h index 5ce59c7..eb73d08 100644 --- a/include/boost/predef/architecture/convex.h +++ b/include/boost/predef/architecture/convex.h @@ -58,6 +58,11 @@ http://en.wikipedia.org/wiki/Convex_Computer[Convex Computer] architecture. # define BOOST_ARCH_CONVEX_AVAILABLE #endif +#if BOOST_ARCH_CONVEX +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_CONVEX_NAME "Convex Computer" #endif diff --git a/include/boost/predef/architecture/ia64.h b/include/boost/predef/architecture/ia64.h index 12a08d1..1f4b58a 100644 --- a/include/boost/predef/architecture/ia64.h +++ b/include/boost/predef/architecture/ia64.h @@ -42,6 +42,11 @@ http://en.wikipedia.org/wiki/Ia64[Intel Itanium 64] architecture. # define BOOST_ARCH_IA64_AVAILABLE #endif +#if BOOST_ARCH_IA64 +# undef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_IA64_NAME "Intel Itanium 64" #endif diff --git a/include/boost/predef/architecture/m68k.h b/include/boost/predef/architecture/m68k.h index 2d87745..a594537 100644 --- a/include/boost/predef/architecture/m68k.h +++ b/include/boost/predef/architecture/m68k.h @@ -75,6 +75,11 @@ http://en.wikipedia.org/wiki/M68k[Motorola 68k] architecture. # define BOOST_ARCH_M68K_AVAILABLE #endif +#if BOOST_ARCH_M68K +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_M68K_NAME "Motorola 68k" #endif diff --git a/include/boost/predef/architecture/mips.h b/include/boost/predef/architecture/mips.h index 490c5e5..e35d23a 100644 --- a/include/boost/predef/architecture/mips.h +++ b/include/boost/predef/architecture/mips.h @@ -66,6 +66,16 @@ http://en.wikipedia.org/wiki/MIPS_architecture[MIPS] architecture. # define BOOST_ARCH_MIPS_AVAILABLE #endif +#if BOOST_ARCH_MIPS +# if BOOST_ARCH_MIPS >= BOOST_VERSION_NUMBER(3,0,0) +# undef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_AVAILABLE +# else +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + #define BOOST_ARCH_MIPS_NAME "MIPS" #endif diff --git a/include/boost/predef/architecture/parisc.h b/include/boost/predef/architecture/parisc.h index 0825445..b93bfd9 100644 --- a/include/boost/predef/architecture/parisc.h +++ b/include/boost/predef/architecture/parisc.h @@ -57,6 +57,11 @@ http://en.wikipedia.org/wiki/PA-RISC_family[HP/PA RISC] architecture. # define BOOST_ARCH_PARISC_AVAILABLE #endif +#if BOOST_ARCH_PARISC +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_PARISC_NAME "HP/PA RISC" #endif diff --git a/include/boost/predef/architecture/ppc.h b/include/boost/predef/architecture/ppc.h index 019e11b..55ba5a1 100644 --- a/include/boost/predef/architecture/ppc.h +++ b/include/boost/predef/architecture/ppc.h @@ -65,6 +65,11 @@ http://en.wikipedia.org/wiki/PowerPC[PowerPC] architecture. # define BOOST_ARCH_PPC_AVAILABLE #endif +#if BOOST_ARCH_PPC +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_PPC_NAME "PowerPC" #endif diff --git a/include/boost/predef/architecture/ptx.h b/include/boost/predef/architecture/ptx.h index a331094..7737213 100644 --- a/include/boost/predef/architecture/ptx.h +++ b/include/boost/predef/architecture/ptx.h @@ -37,6 +37,11 @@ https://en.wikipedia.org/wiki/Parallel_Thread_Execution[PTX] architecture. # define BOOST_ARCH_PTX_AVAILABLE #endif +#if BOOST_ARCH_PTX +# undef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_PTX_NAME "PTX" #endif diff --git a/include/boost/predef/architecture/pyramid.h b/include/boost/predef/architecture/pyramid.h index afcd1a9..40c5359 100644 --- a/include/boost/predef/architecture/pyramid.h +++ b/include/boost/predef/architecture/pyramid.h @@ -35,6 +35,11 @@ Pyramid 9810 architecture. # define BOOST_ARCH_PYRAMID_AVAILABLE #endif +#if BOOST_ARCH_PYRAMID +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_PYRAMID_NAME "Pyramid 9810" #endif diff --git a/include/boost/predef/architecture/riscv.h b/include/boost/predef/architecture/riscv.h index 7c3a7ba..8b819d7 100644 --- a/include/boost/predef/architecture/riscv.h +++ b/include/boost/predef/architecture/riscv.h @@ -35,6 +35,11 @@ http://en.wikipedia.org/wiki/RISC-V[RISC-V] architecture. # define BOOST_ARCH_RISCV_AVAILABLE #endif +#if BOOST_ARCH_RISCV +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_RISCV_NAME "RISC-V" #endif diff --git a/include/boost/predef/architecture/rs6k.h b/include/boost/predef/architecture/rs6k.h index e33c793..1c6d987 100644 --- a/include/boost/predef/architecture/rs6k.h +++ b/include/boost/predef/architecture/rs6k.h @@ -41,6 +41,11 @@ http://en.wikipedia.org/wiki/RS/6000[RS/6000] architecture. # define BOOST_ARCH_RS6000_AVAILABLE #endif +#if BOOST_ARCH_RS6000 +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_RS6000_NAME "RS/6000" #define BOOST_ARCH_PWR BOOST_ARCH_RS6000 @@ -49,6 +54,11 @@ http://en.wikipedia.org/wiki/RS/6000[RS/6000] architecture. # define BOOST_ARCH_PWR_AVAILABLE #endif +#if BOOST_ARCH_PWR +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_PWR_NAME BOOST_ARCH_RS6000_NAME #endif diff --git a/include/boost/predef/architecture/sparc.h b/include/boost/predef/architecture/sparc.h index 31551e3..52e9fcb 100644 --- a/include/boost/predef/architecture/sparc.h +++ b/include/boost/predef/architecture/sparc.h @@ -47,6 +47,16 @@ http://en.wikipedia.org/wiki/SPARC[SPARC] architecture. # define BOOST_ARCH_SPARC_AVAILABLE #endif +#if BOOST_ARCH_SPARC +# if BOOST_ARCH_SPARC >= BOOST_VERSION_NUMBER(9,0,0) +# undef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_AVAILABLE +# else +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + #define BOOST_ARCH_SPARC_NAME "SPARC" #endif diff --git a/include/boost/predef/architecture/superh.h b/include/boost/predef/architecture/superh.h index 5034d90..f72dc8b 100644 --- a/include/boost/predef/architecture/superh.h +++ b/include/boost/predef/architecture/superh.h @@ -60,6 +60,19 @@ If available versions [1-5] are specifically detected. # define BOOST_ARCH_SH_AVAILABLE #endif +#if BOOST_ARCH_SH +# if BOOST_ARCH_SH >= BOOST_VERSION_NUMBER(5,0,0) +# undef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_AVAILABLE +# elif BOOST_ARCH_SH >= BOOST_VERSION_NUMBER(3,0,0) +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +# else +# undef BOOST_ARCH_WORD_BITS_16 +# define BOOST_ARCH_WORD_BITS_16 BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + #define BOOST_ARCH_SH_NAME "SuperH" #endif diff --git a/include/boost/predef/architecture/sys370.h b/include/boost/predef/architecture/sys370.h index 265d0f0..5500d25 100644 --- a/include/boost/predef/architecture/sys370.h +++ b/include/boost/predef/architecture/sys370.h @@ -36,6 +36,11 @@ http://en.wikipedia.org/wiki/System/370[System/370] architecture. # define BOOST_ARCH_SYS370_AVAILABLE #endif +#if BOOST_ARCH_SYS370 +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_SYS370_NAME "System/370" #endif diff --git a/include/boost/predef/architecture/sys390.h b/include/boost/predef/architecture/sys390.h index 155c9be..9aba568 100644 --- a/include/boost/predef/architecture/sys390.h +++ b/include/boost/predef/architecture/sys390.h @@ -36,6 +36,11 @@ http://en.wikipedia.org/wiki/System/390[System/390] architecture. # define BOOST_ARCH_SYS390_AVAILABLE #endif +#if BOOST_ARCH_SYS390 +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_SYS390_NAME "System/390" #endif diff --git a/include/boost/predef/architecture/x86/32.h b/include/boost/predef/architecture/x86/32.h index cd2e750..b20fed9 100644 --- a/include/boost/predef/architecture/x86/32.h +++ b/include/boost/predef/architecture/x86/32.h @@ -78,6 +78,11 @@ If available versions [3-6] are specifically detected. # define BOOST_ARCH_X86_32_AVAILABLE #endif +#if BOOST_ARCH_X86_32 +# undef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_X86_32_NAME "Intel x86-32" #include diff --git a/include/boost/predef/architecture/x86/64.h b/include/boost/predef/architecture/x86/64.h index ebd80fb..f0554a0 100644 --- a/include/boost/predef/architecture/x86/64.h +++ b/include/boost/predef/architecture/x86/64.h @@ -41,6 +41,11 @@ http://en.wikipedia.org/wiki/Ia64[Intel IA-64] architecture. # define BOOST_ARCH_X86_64_AVAILABLE #endif +#if BOOST_ARCH_X86_64 +# undef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_X86_64_NAME "Intel x86-64" #include diff --git a/include/boost/predef/architecture/z.h b/include/boost/predef/architecture/z.h index d2d8e95..a5f7979 100644 --- a/include/boost/predef/architecture/z.h +++ b/include/boost/predef/architecture/z.h @@ -35,6 +35,11 @@ http://en.wikipedia.org/wiki/Z/Architecture[z/Architecture] architecture. # define BOOST_ARCH_Z_AVAILABLE #endif +#if BOOST_ARCH_Z +# undef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_AVAILABLE +#endif + #define BOOST_ARCH_Z_NAME "z/Architecture" #endif diff --git a/include/boost/predef/other.h b/include/boost/predef/other.h index c09ad49..dc7e341 100644 --- a/include/boost/predef/other.h +++ b/include/boost/predef/other.h @@ -1,5 +1,5 @@ /* -Copyright Rene Rivera 2013-2015 +Copyright Rene Ferdinand Rivera Morell 2013-2020 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -11,6 +11,7 @@ http://www.boost.org/LICENSE_1_0.txt) #endif #include -/*#include */ +#include +#include #endif diff --git a/include/boost/predef/other/endian.h b/include/boost/predef/other/endian.h index eb82da2..8f116de 100644 --- a/include/boost/predef/other/endian.h +++ b/include/boost/predef/other/endian.h @@ -95,7 +95,7 @@ information and acquired knowledge: # endif #endif -/* Built-in byte-swpped big-endian macros. +/* Built-in byte-swapped big-endian macros. */ #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD @@ -112,7 +112,7 @@ information and acquired knowledge: # endif #endif -/* Built-in byte-swpped little-endian macros. +/* Built-in byte-swapped little-endian macros. */ #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD @@ -154,7 +154,7 @@ information and acquired knowledge: #endif /* Windows on ARM, if not otherwise detected/specified, is always - * byte-swaped little-endian. + * byte-swapped little-endian. */ #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD diff --git a/include/boost/predef/other/wordsize.h b/include/boost/predef/other/wordsize.h new file mode 100644 index 0000000..165e786 --- /dev/null +++ b/include/boost/predef/other/wordsize.h @@ -0,0 +1,69 @@ +/* +Copyright Rene Ferdinand Rivera Morell 2020 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OTHER_WORD_SIZE_H +#define BOOST_PREDEF_OTHER_WORD_SIZE_H + +#include +#include +#include + +/* tag::reference[] += `BOOST_ARCH_WORD_BITS` + +Detects the native word size, in bits, for the current architecture. There are +two types of macros for this detection: + +* `BOOST_ARCH_WORD_BITS`, gives the number of word size bits + (16, 32, 64). +* `BOOST_ARCH_WORD_BITS_16`, `BOOST_ARCH_WORD_BITS_32`, and + `BOOST_ARCH_WORD_BITS_64`, indicate when the given word size is + detected. + +They allow for both single checks and direct use of the size in code. + +NOTE: The word size is determined manually on each architecture. Hence use of +the `wordsize.h` header will also include all the architecture headers. + +*/ // end::reference[] + +#ifndef BOOST_ARCH_WORD_BITS_16 +# define BOOST_ARCH_WORD_BITS_16 BOOST_VERSION_NUMBER_NOT_AVAILABLE +#else +# define BOOST_ARCH_WORD_BITS 16 +#endif + +#ifndef BOOST_ARCH_WORD_BITS_32 +# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_NOT_AVAILABLE +#else +# define BOOST_ARCH_WORD_BITS 32 +#endif + +#ifndef BOOST_ARCH_WORD_BITS_64 +# define BOOST_ARCH_WORD_BITS_64 BOOST_VERSION_NUMBER_NOT_AVAILABLE +#else +# define BOOST_ARCH_WORD_BITS 64 +#endif + +#ifndef BOOST_ARCH_WORD_BITS +# define BOOST_ARCH_WORD_BITS 0 +#endif + +#define BOOST_ARCH_WORD_BITS_16_NAME "16-bit Word Size" +#define BOOST_ARCH_WORD_BITS_32_NAME "32-bit Word Size" +#define BOOST_ARCH_WORD_BITS_64_NAME "64-bit Word Size" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_WORD_BITS_16,BOOST_ARCH_WORD_BITS_16_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_WORD_BITS_32,BOOST_ARCH_WORD_BITS_32_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_WORD_BITS_64,BOOST_ARCH_WORD_BITS_64_NAME) diff --git a/include/boost/predef/platform.h b/include/boost/predef/platform.h index 65a0e2a..756d65f 100644 --- a/include/boost/predef/platform.h +++ b/include/boost/predef/platform.h @@ -24,6 +24,5 @@ http://www.boost.org/LICENSE_1_0.txt) #include #include // deprecated #include -/*#include */ #endif