From 9a435659cdceb083308667aecd5a17bab744a0cf Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Sun, 16 Nov 2014 21:32:45 +1300 Subject: [PATCH 01/17] haiku: add platform support --- include/boost/predef/os.h | 1 + include/boost/predef/os/haiku.h | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 include/boost/predef/os/haiku.h diff --git a/include/boost/predef/os.h b/include/boost/predef/os.h index 628eb4f..abd6666 100644 --- a/include/boost/predef/os.h +++ b/include/boost/predef/os.h @@ -15,6 +15,7 @@ http://www.boost.org/LICENSE_1_0.txt) #include #include #include +#include #include #include #include diff --git a/include/boost/predef/os/haiku.h b/include/boost/predef/os/haiku.h new file mode 100644 index 0000000..9e958ab --- /dev/null +++ b/include/boost/predef/os/haiku.h @@ -0,0 +1,46 @@ +/* +Copyright Rene Rivera 2008-2013 +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_OS_HAIKU_H +#define BOOST_PREDEF_OS_HAIKU_H + +#include +#include + +/*` +[heading `BOOST_OS_HAIKU`] + +[@http://en.wikipedia.org/wiki/Haiku_(operating_system) Haiku] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__HAIKU__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_BEOS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__HAIKU__) \ + ) +# undef BOOST_OS_HAIKU +# define BOOST_OS_HAIKU BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_HAIKU +# define BOOST_OS_HAIKU_AVAILABLE +# include +#endif + +#define BOOST_OS_HAIKU_NAME "Haiku" + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_HAIKU,BOOST_OS_HAIKU_NAME) + + +#endif From a7d2f3813e59fb9dde1071942bc3160a09e4d9de Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Sun, 16 Nov 2014 21:44:12 +1300 Subject: [PATCH 02/17] haiku: fix copyright --- include/boost/predef/os/haiku.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/predef/os/haiku.h b/include/boost/predef/os/haiku.h index 9e958ab..2748ed2 100644 --- a/include/boost/predef/os/haiku.h +++ b/include/boost/predef/os/haiku.h @@ -1,5 +1,5 @@ /* -Copyright Rene Rivera 2008-2013 +Copyright Jessica Hamilton 2014 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) From ce0959ba62623bbad078c58736eab1b542456518 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 29 Dec 2014 11:26:49 -0600 Subject: [PATCH 03/17] Fix Haiku detection syntax error when Haiku is not detected. Bump version to 1.2 and update docs. --- doc/history.qbk | 8 ++- doc/html/index.html | 8 +-- doc/html/predef/acknoledgements.html | 12 ++-- doc/html/predef/adding_new_predefs.html | 4 +- doc/html/predef/history.html | 19 ++++- doc/html/predef/introduction.html | 6 +- doc/html/predef/reference.html | 4 +- .../boost_arch_architecture_macros.html | 2 +- .../reference/boost_comp_compiler_macros.html | 2 +- .../boost_lang_language_standards_ma.html | 2 +- .../reference/boost_lib_library_macros.html | 2 +- .../boost_os_operating_system_macros.html | 72 ++++++++++++++----- .../reference/boost_plat_platform_macros.html | 2 +- doc/html/predef/reference/other_macros.html | 2 +- .../reference/version_definition_macros.html | 2 +- doc/html/predef/to_do.html | 4 +- doc/html/predef/using_the_predefs.html | 4 +- doc/predef.qbk | 4 +- include/boost/predef/os/haiku.h | 3 +- include/boost/predef/version.h | 2 +- 20 files changed, 111 insertions(+), 53 deletions(-) diff --git a/doc/history.qbk b/doc/history.qbk index b2fb81e..3af8394 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -7,12 +7,18 @@ http://www.boost.org/LICENSE_1_0.txt) [section History] +[heading 1.2] + +* Account for skip in Visual Studio product version vs. compiler version. + This supports version of VS 2015 an onward. +* Add detection of Haiku OS (from Jessica Hamilton). + [heading 1.1] * Addition of `BOOST_PLAT_*` platform definitions for MinGW and Windows platform variants. * Detection of ARM architecture for Windows compilers to target - mobile devices of WIndows 8. + mobile devices of Windows 8. * Improved ARM detection for 64 bit ARM. * Added detection of iOS an an operating system. * Improved detection of endianess on some platforms. diff --git a/doc/html/index.html b/doc/html/index.html index 024453d..cdff0db 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,10 +1,10 @@ -Predef 1.1 +Predef 1.2 - + @@ -13,7 +13,7 @@

-Predef 1.1

+Predef 1.2

Rene Rivera

@@ -52,7 +52,7 @@
- +

Last revised: June 04, 2014 at 03:28:01 GMT

Last revised: December 29, 2014 at 17:24:18 GMT


diff --git a/doc/html/predef/acknoledgements.html b/doc/html/predef/acknoledgements.html index 7573714..90439da 100644 --- a/doc/html/predef/acknoledgements.html +++ b/doc/html/predef/acknoledgements.html @@ -4,8 +4,8 @@ Acknoledgements - - + + @@ -27,10 +27,10 @@ This library would be an incoherent mess if it weren't for Boost community that provided invaluable feedback for the eight years that it took to polish into a useable form. In particular I would like to thank: Mathias Gaunard, - Robert Stewart, Joël Lamotte, Lars Viklund, Nathan Ridge, Artyom Beilis, Joshua - Boyce, Gottlob Frege, Thomas Heller, Edward Diener, Dave Abrahams, Iain Denniston, - Dan Price, Ioannis Papadopoulos, and Robert Ramey. And thanks to Joel Falcou - for managing the review of this library. + Robert Stewart, Jo��l Lamotte, Lars Viklund, Nathan Ridge, Artyom Beilis, + Joshua Boyce, Gottlob Frege, Thomas Heller, Edward Diener, Dave Abrahams, Iain + Denniston, Dan Price, Ioannis Papadopoulos, and Robert Ramey. And thanks to + Joel Falcou for managing the review of this library.

diff --git a/doc/html/predef/adding_new_predefs.html b/doc/html/predef/adding_new_predefs.html index 091b7b7..37f49d4 100644 --- a/doc/html/predef/adding_new_predefs.html +++ b/doc/html/predef/adding_new_predefs.html @@ -4,8 +4,8 @@ Adding new predefs - - + + diff --git a/doc/html/predef/history.html b/doc/html/predef/history.html index 9d9a2ef..384339c 100644 --- a/doc/html/predef/history.html +++ b/doc/html/predef/history.html @@ -4,8 +4,8 @@ History - - + + @@ -19,6 +19,19 @@

+ 1.2 +

+
    +
  • + Account for skip in Visual Studio product version vs. compiler version. + This supports version of VS 2015 an onward. +
  • +
  • + Add detection of Haiku OS (from Jessica Hamilton). +
  • +
+

+ 1.1

    @@ -28,7 +41,7 @@
  • Detection of ARM architecture for Windows compilers to target mobile devices - of WIndows 8. + of Windows 8.
  • Improved ARM detection for 64 bit ARM. diff --git a/doc/html/predef/introduction.html b/doc/html/predef/introduction.html index 66d3992..ef085b0 100644 --- a/doc/html/predef/introduction.html +++ b/doc/html/predef/introduction.html @@ -4,9 +4,9 @@ Introduction - - - + + + diff --git a/doc/html/predef/reference.html b/doc/html/predef/reference.html index c526fc5..9414b8f 100644 --- a/doc/html/predef/reference.html +++ b/doc/html/predef/reference.html @@ -4,8 +4,8 @@ Reference - - + + diff --git a/doc/html/predef/reference/boost_arch_architecture_macros.html b/doc/html/predef/reference/boost_arch_architecture_macros.html index c790a49..bd15aca 100644 --- a/doc/html/predef/reference/boost_arch_architecture_macros.html +++ b/doc/html/predef/reference/boost_arch_architecture_macros.html @@ -4,7 +4,7 @@ BOOST_ARCH architecture macros - + diff --git a/doc/html/predef/reference/boost_comp_compiler_macros.html b/doc/html/predef/reference/boost_comp_compiler_macros.html index ff59038..3376fd0 100644 --- a/doc/html/predef/reference/boost_comp_compiler_macros.html +++ b/doc/html/predef/reference/boost_comp_compiler_macros.html @@ -4,7 +4,7 @@ BOOST_COMP compiler macros - + diff --git a/doc/html/predef/reference/boost_lang_language_standards_ma.html b/doc/html/predef/reference/boost_lang_language_standards_ma.html index de69405..7623fc4 100644 --- a/doc/html/predef/reference/boost_lang_language_standards_ma.html +++ b/doc/html/predef/reference/boost_lang_language_standards_ma.html @@ -4,7 +4,7 @@ BOOST_LANG language standards macros - + diff --git a/doc/html/predef/reference/boost_lib_library_macros.html b/doc/html/predef/reference/boost_lib_library_macros.html index 7aecdd8..6e9a5ff 100644 --- a/doc/html/predef/reference/boost_lib_library_macros.html +++ b/doc/html/predef/reference/boost_lib_library_macros.html @@ -4,7 +4,7 @@ BOOST_LIB library macros - + diff --git a/doc/html/predef/reference/boost_os_operating_system_macros.html b/doc/html/predef/reference/boost_os_operating_system_macros.html index efb9400..ca12588 100644 --- a/doc/html/predef/reference/boost_os_operating_system_macros.html +++ b/doc/html/predef/reference/boost_os_operating_system_macros.html @@ -4,7 +4,7 @@ BOOST_OS operating system macros - + @@ -417,6 +417,44 @@
+ BOOST_OS_HAIKU +
+

+ Haiku + operating system. +

+
++++ + + + + + + + + +
+

+ Symbol +

+
+

+ Version +

+
+

+ __HAIKU__ +

+
+

+ detection +

+
+
+ BOOST_OS_HPUX

@@ -479,7 +517,7 @@

- + BOOST_OS_IOS

@@ -554,7 +592,7 @@

- + BOOST_OS_IRIX

@@ -605,7 +643,7 @@

- + BOOST_OS_LINUX

@@ -656,7 +694,7 @@

- + BOOST_OS_MACOS

@@ -756,7 +794,7 @@

- + BOOST_OS_OS400

@@ -794,7 +832,7 @@

- + BOOST_OS_QNX

@@ -871,7 +909,7 @@

- + BOOST_OS_SOLARIS

@@ -923,7 +961,7 @@

- + BOOST_OS_UNIX

@@ -999,7 +1037,7 @@

- + BOOST_OS_SVR4

@@ -1075,7 +1113,7 @@

- + BOOST_OS_VMS

@@ -1138,7 +1176,7 @@

- + BOOST_OS_WINDOWS

@@ -1226,7 +1264,7 @@

- + BOOST_OS_BSD_BSDI

@@ -1264,7 +1302,7 @@

- + BOOST_OS_BSD_DRAGONFLY

@@ -1302,7 +1340,7 @@

- + BOOST_OS_BSD_FREE

@@ -1354,7 +1392,7 @@

- + BOOST_OS_BSD_NET

@@ -1466,7 +1504,7 @@

- + BOOST_OS_BSD_OPEN

diff --git a/doc/html/predef/reference/boost_plat_platform_macros.html b/doc/html/predef/reference/boost_plat_platform_macros.html index e554c77..9321e06 100644 --- a/doc/html/predef/reference/boost_plat_platform_macros.html +++ b/doc/html/predef/reference/boost_plat_platform_macros.html @@ -4,7 +4,7 @@ BOOST_PLAT platform macros - + diff --git a/doc/html/predef/reference/other_macros.html b/doc/html/predef/reference/other_macros.html index b1e3f6f..802f689 100644 --- a/doc/html/predef/reference/other_macros.html +++ b/doc/html/predef/reference/other_macros.html @@ -4,7 +4,7 @@ Other macros - + diff --git a/doc/html/predef/reference/version_definition_macros.html b/doc/html/predef/reference/version_definition_macros.html index c52ae47..8e70c48 100644 --- a/doc/html/predef/reference/version_definition_macros.html +++ b/doc/html/predef/reference/version_definition_macros.html @@ -4,7 +4,7 @@ Version definition macros - + diff --git a/doc/html/predef/to_do.html b/doc/html/predef/to_do.html index 200e3ce..c5f8252 100644 --- a/doc/html/predef/to_do.html +++ b/doc/html/predef/to_do.html @@ -4,8 +4,8 @@ To Do - - + + diff --git a/doc/html/predef/using_the_predefs.html b/doc/html/predef/using_the_predefs.html index 7ce9d04..c659ce6 100644 --- a/doc/html/predef/using_the_predefs.html +++ b/doc/html/predef/using_the_predefs.html @@ -4,8 +4,8 @@ Using the predefs - - + + diff --git a/doc/predef.qbk b/doc/predef.qbk index 75ec39d..e8b5f9d 100644 --- a/doc/predef.qbk +++ b/doc/predef.qbk @@ -1,6 +1,6 @@ [article Predef [quickbook 1.7] - [version 1.1] + [version 1.2] [authors [Rivera, Rene]] [copyright 2005, 2008-2014 Rene Rivera] [purpose Identification and specification of predefined macros.] @@ -576,7 +576,7 @@ This library would be an incoherent mess if it weren't for Boost community that provided invaluable feedback for the eight years that it took to polish into a useable form. In particular I would like to thank: Mathias Gaunard, -Robert Stewart, Joël Lamotte, Lars Viklund, Nathan Ridge, +Robert Stewart, Jo��l Lamotte, Lars Viklund, Nathan Ridge, Artyom Beilis, Joshua Boyce, Gottlob Frege, Thomas Heller, Edward Diener, Dave Abrahams, Iain Denniston, Dan Price, Ioannis Papadopoulos, and Robert Ramey. And thanks to diff --git a/include/boost/predef/os/haiku.h b/include/boost/predef/os/haiku.h index 2748ed2..4d741cf 100644 --- a/include/boost/predef/os/haiku.h +++ b/include/boost/predef/os/haiku.h @@ -1,5 +1,6 @@ /* Copyright Jessica Hamilton 2014 +Copyright Rene Rivera 2014 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) @@ -23,7 +24,7 @@ http://www.boost.org/LICENSE_1_0.txt) ] */ -#define BOOST_OS_BEOS BOOST_VERSION_NUMBER_NOT_AVAILABLE +#define BOOST_OS_HAIKU BOOST_VERSION_NUMBER_NOT_AVAILABLE #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ defined(__HAIKU__) \ diff --git a/include/boost/predef/version.h b/include/boost/predef/version.h index 1e85df7..0439b2c 100644 --- a/include/boost/predef/version.h +++ b/include/boost/predef/version.h @@ -10,6 +10,6 @@ http://www.boost.org/LICENSE_1_0.txt) #include -#define BOOST_PREDEF_VERSION BOOST_VERSION_NUMBER(1,1,0) +#define BOOST_PREDEF_VERSION BOOST_VERSION_NUMBER(1,2,0) #endif From 5912dd7e629f8c713da3db8964a9c436d9eebec1 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 29 Dec 2014 23:20:36 -0600 Subject: [PATCH 04/17] Add Android OS header for endian definition. And some platforms don't define all of the *BYTE_ORDER *_ENDIAN macros so need to guard for that case. (Thanks to mstahl@redhat.com for pointing those out). --- doc/html/predef/acknoledgements.html | 8 ++++---- doc/html/predef/to_do.html | 9 +++++++-- doc/predef.qbk | 2 +- doc/todo.qbk | 1 + include/boost/predef/other/endian.h | 15 ++++++++------- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/doc/html/predef/acknoledgements.html b/doc/html/predef/acknoledgements.html index 90439da..9f73605 100644 --- a/doc/html/predef/acknoledgements.html +++ b/doc/html/predef/acknoledgements.html @@ -27,10 +27,10 @@ This library would be an incoherent mess if it weren't for Boost community that provided invaluable feedback for the eight years that it took to polish into a useable form. In particular I would like to thank: Mathias Gaunard, - Robert Stewart, Jo��l Lamotte, Lars Viklund, Nathan Ridge, Artyom Beilis, - Joshua Boyce, Gottlob Frege, Thomas Heller, Edward Diener, Dave Abrahams, Iain - Denniston, Dan Price, Ioannis Papadopoulos, and Robert Ramey. And thanks to - Joel Falcou for managing the review of this library. + Robert Stewart, Joël Lamotte, Lars Viklund, Nathan Ridge, Artyom Beilis, Joshua + Boyce, Gottlob Frege, Thomas Heller, Edward Diener, Dave Abrahams, Iain Denniston, + Dan Price, Ioannis Papadopoulos, and Robert Ramey. And thanks to Joel Falcou + for managing the review of this library.

diff --git a/doc/html/predef/to_do.html b/doc/html/predef/to_do.html index c5f8252..7c01101 100644 --- a/doc/html/predef/to_do.html +++ b/doc/html/predef/to_do.html @@ -17,9 +17,14 @@ -
  • +
      +
    • Improve reference documentation. -
    +
  • +
  • + Provide BOOST_WORKAROUND style macros for public use. +
  • +
diff --git a/doc/predef.qbk b/doc/predef.qbk index e8b5f9d..4626830 100644 --- a/doc/predef.qbk +++ b/doc/predef.qbk @@ -576,7 +576,7 @@ This library would be an incoherent mess if it weren't for Boost community that provided invaluable feedback for the eight years that it took to polish into a useable form. In particular I would like to thank: Mathias Gaunard, -Robert Stewart, Jo��l Lamotte, Lars Viklund, Nathan Ridge, +Robert Stewart, Joël Lamotte, Lars Viklund, Nathan Ridge, Artyom Beilis, Joshua Boyce, Gottlob Frege, Thomas Heller, Edward Diener, Dave Abrahams, Iain Denniston, Dan Price, Ioannis Papadopoulos, and Robert Ramey. And thanks to diff --git a/doc/todo.qbk b/doc/todo.qbk index 12f7db5..aa1c845 100644 --- a/doc/todo.qbk +++ b/doc/todo.qbk @@ -8,5 +8,6 @@ http://www.boost.org/LICENSE_1_0.txt) [section To Do] * Improve reference documentation. +* Provide BOOST_WORKAROUND style macros for public use. [endsect] diff --git a/include/boost/predef/other/endian.h b/include/boost/predef/other/endian.h index fd73364..85a028d 100644 --- a/include/boost/predef/other/endian.h +++ b/include/boost/predef/other/endian.h @@ -13,6 +13,7 @@ http://www.boost.org/LICENSE_1_0.txt) #include #include #include +#include /*` [heading `BOOST_ENDIAN_*`] @@ -53,7 +54,7 @@ information and acquired knowledge: */ #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD -# if BOOST_LIB_C_GNU +# if BOOST_LIB_C_GNU || BOOST_OS_ANDROID # include # else # if BOOST_OS_MACOS @@ -69,29 +70,29 @@ information and acquired knowledge: # endif # endif # if defined(__BYTE_ORDER) -# if (__BYTE_ORDER == __BIG_ENDIAN) +# if defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN) # undef BOOST_ENDIAN_BIG_BYTE # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE # endif -# if (__BYTE_ORDER == __LITTLE_ENDIAN) +# if defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN) # undef BOOST_ENDIAN_LITTLE_BYTE # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE # endif -# if (__BYTE_ORDER == __PDP_ENDIAN) +# if defined(__PDP_ENDIAN) && (__BYTE_ORDER == __PDP_ENDIAN) # undef BOOST_ENDIAN_LITTLE_WORD # define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE # endif # endif # if !defined(__BYTE_ORDER) && defined(_BYTE_ORDER) -# if (_BYTE_ORDER == _BIG_ENDIAN) +# if defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN) # undef BOOST_ENDIAN_BIG_BYTE # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE # endif -# if (_BYTE_ORDER == _LITTLE_ENDIAN) +# if defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN) # undef BOOST_ENDIAN_LITTLE_BYTE # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE # endif -# if (_BYTE_ORDER == _PDP_ENDIAN) +# if defined(_PDP_ENDIAN) && (_BYTE_ORDER == _PDP_ENDIAN) # undef BOOST_ENDIAN_LITTLE_WORD # define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE # endif From e0e11e05a6157291c5541eaf8ea067e8f8ecd10d Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 29 Dec 2014 23:23:52 -0600 Subject: [PATCH 05/17] Update history doc for Android LibreOffice fixes. --- doc/history.qbk | 1 + doc/html/index.html | 2 +- doc/html/predef/history.html | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/history.qbk b/doc/history.qbk index 3af8394..3441fbd 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -12,6 +12,7 @@ http://www.boost.org/LICENSE_1_0.txt) * Account for skip in Visual Studio product version vs. compiler version. This supports version of VS 2015 an onward. * Add detection of Haiku OS (from Jessica Hamilton). +* Some fixes to endian detection for Android (from mstahl-at-redhat.com). [heading 1.1] diff --git a/doc/html/index.html b/doc/html/index.html index cdff0db..6e585eb 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -52,7 +52,7 @@
- +

Last revised: December 29, 2014 at 17:24:18 GMT

Last revised: December 30, 2014 at 05:22:51 GMT


diff --git a/doc/html/predef/history.html b/doc/html/predef/history.html index 384339c..b65b9c2 100644 --- a/doc/html/predef/history.html +++ b/doc/html/predef/history.html @@ -29,6 +29,9 @@
  • Add detection of Haiku OS (from Jessica Hamilton).
  • +
  • + Some fixes to endian detection for Android (from mstahl-at-redhat.com). +
  • From 84967e3d0a85a1413fa1a1739a80d038d07b00fa Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 30 Dec 2014 08:13:18 -0600 Subject: [PATCH 06/17] Add missing BOOST_PREDEF_MAKE_0X_VVRRPP macro (thanks ro Erik Lindahl for finding it). --- doc/history.qbk | 1 + doc/html/index.html | 2 +- doc/html/predef/history.html | 4 ++++ doc/html/predef/reference/version_definition_macros.html | 3 +++ include/boost/predef/make.h | 2 ++ test/make.cpp | 1 + 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/history.qbk b/doc/history.qbk index 3441fbd..f8c0b47 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -13,6 +13,7 @@ http://www.boost.org/LICENSE_1_0.txt) This supports version of VS 2015 an onward. * Add detection of Haiku OS (from Jessica Hamilton). * Some fixes to endian detection for Android (from mstahl-at-redhat.com). +* Add missing `BOOST_PREDEF_MAKE_0X_VVRRPP` macro (from Erik Lindahl). [heading 1.1] diff --git a/doc/html/index.html b/doc/html/index.html index 6e585eb..603afa7 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -52,7 +52,7 @@ - +

    Last revised: December 30, 2014 at 05:22:51 GMT

    Last revised: December 30, 2014 at 14:12:07 GMT


    diff --git a/doc/html/predef/history.html b/doc/html/predef/history.html index b65b9c2..d7dc619 100644 --- a/doc/html/predef/history.html +++ b/doc/html/predef/history.html @@ -32,6 +32,10 @@
  • Some fixes to endian detection for Android (from mstahl-at-redhat.com).
  • +
  • + Add missing BOOST_PREDEF_MAKE_0X_VVRRPP + macro (from Erik Lindahl). +
  • diff --git a/doc/html/predef/reference/version_definition_macros.html b/doc/html/predef/reference/version_definition_macros.html index 8e70c48..84fed35 100644 --- a/doc/html/predef/reference/version_definition_macros.html +++ b/doc/html/predef/reference/version_definition_macros.html @@ -105,6 +105,9 @@

    BOOST_PREDEF_MAKE_0X_VRRPP000(V)

    +

    + BOOST_PREDEF_MAKE_0X_VVRRPP(V) +

    BOOST_PREDEF_MAKE_10_VPPP(V)

    diff --git a/include/boost/predef/make.h b/include/boost/predef/make.h index d327906..f8c28d1 100644 --- a/include/boost/predef/make.h +++ b/include/boost/predef/make.h @@ -42,6 +42,8 @@ Macros are: #define BOOST_PREDEF_MAKE_0X_VVRRP(V) BOOST_VERSION_NUMBER((V&0xFF000)>>12,(V&0xFF0)>>4,(V&0xF)) /*` `BOOST_PREDEF_MAKE_0X_VRRPP000(V)` */ #define BOOST_PREDEF_MAKE_0X_VRRPP000(V) BOOST_VERSION_NUMBER((V&0xF0000000)>>28,(V&0xFF00000)>>20,(V&0xFF000)>>12) +/*` `BOOST_PREDEF_MAKE_0X_VVRRPP(V)` */ +#define BOOST_PREDEF_MAKE_0X_VVRRPP(V) BOOST_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF)) /*` `BOOST_PREDEF_MAKE_10_VPPP(V)` */ #define BOOST_PREDEF_MAKE_10_VPPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000) /*` `BOOST_PREDEF_MAKE_10_VRP(V)` */ diff --git a/test/make.cpp b/test/make.cpp index 9dbd4a8..3ae8192 100644 --- a/test/make.cpp +++ b/test/make.cpp @@ -36,6 +36,7 @@ void test_BOOST_VERSION_NUMBER() PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRRPPPP(0xFFFFFFF) == BOOST_VERSION_NUMBER(0xF,0xFF,0xFFFF)); PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VVRRP(0xFFFFF) == BOOST_VERSION_NUMBER(0xFF,0xFF,0xF)); PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRRPP000(0xFFFFF000) == BOOST_VERSION_NUMBER(0xF,0xFF,0xFF)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VVRRPP(0xFFFFFF) == BOOST_VERSION_NUMBER(0xFF,0xFF,0xFF)); PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRP(999) == BOOST_VERSION_NUMBER(9,9,9)); PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VPPP(9999) == BOOST_VERSION_NUMBER(9,0,999)); From 3766bba8d0708777f2824fd3e22a20ef5d78f230 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Thu, 22 Jan 2015 13:27:14 -0600 Subject: [PATCH 07/17] Fix QNX compile warnings and errors from extra careful C compiler. --- test/info_as_c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/info_as_c.c b/test/info_as_c.c index fe26e84..ba84947 100644 --- a/test/info_as_c.c +++ b/test/info_as_c.c @@ -13,8 +13,8 @@ http://www.boost.org/LICENSE_1_0.txt) typedef struct predef_info { unsigned tag; - char * name; - char * description; + const char * name; + const char * description; unsigned value; } predef_info; @@ -46,7 +46,7 @@ int main() if (*i == 0x67890DEF) { predef_count += 1; - predefs = realloc(predefs,predef_count*sizeof(predef_info*)); + predefs = (predef_info**)realloc(predefs,predef_count*sizeof(predef_info*)); predefs[predef_count-1] = (predef_info*)i; } } From 211a868b803fb3885e1f8174b5a8bb17b6577c3a Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 27 Jan 2015 08:28:37 -0600 Subject: [PATCH 08/17] Add general predef_check utility program and BBv2 support for using it. --- check/build.jam | 9 +++ check/predef.jam | 98 ++++++++++++++++++++++++++ check/predef_check_as_c.c | 119 ++++++++++++++++++++++++++++++++ check/predef_check_as_cpp.cpp | 1 + check/predef_check_as_objc.m | 1 + check/predef_check_as_objcpp.mm | 1 + doc/html/index.html | 2 +- test/build.jam | 6 +- 8 files changed, 234 insertions(+), 3 deletions(-) create mode 100644 check/build.jam create mode 100644 check/predef.jam create mode 100644 check/predef_check_as_c.c create mode 100644 check/predef_check_as_cpp.cpp create mode 100644 check/predef_check_as_objc.m create mode 100644 check/predef_check_as_objcpp.mm diff --git a/check/build.jam b/check/build.jam new file mode 100644 index 0000000..1ce4f11 --- /dev/null +++ b/check/build.jam @@ -0,0 +1,9 @@ +# Copyright Rene Rivera 2015 +# 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) + +exe predef_check_as_c : predef_check_as_c.c : ../include ; +exe predef_check_as_cpp : predef_check_as_cpp.cpp : ../include ; +exe predef_check_as_objc : predef_check_as_objc.m : ../include ; +exe predef_check_as_objcpp : predef_check_as_objcpp.mm : ../include ; diff --git a/check/predef.jam b/check/predef.jam new file mode 100644 index 0000000..65c3451 --- /dev/null +++ b/check/predef.jam @@ -0,0 +1,98 @@ +# Copyright Rene Rivera 2015 +# 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) + +# Defines rules that provide requirements based on checking +# conditions using Boost Predef definitions and version numbers. + +import modules ; +import project ; +import feature ; +import string ; +import toolset ; +import modules ; +import path ; + +# Create a project for our targets. +project.extension predef check ; + +# Feature to pass check expressions to check programs. +feature.feature predef-expression : : free ; + +# Check programs. Each needs to be compiled for different languages +# even though they are all the same source code. +local rule check_target ( language : ext ) +{ + # Need to use absolute paths because we don't know the + # context of the invocation which affects where the paths + # originate from. + local source_path + = [ path.root $(__name__:D)/predef_check_as_$(language).$(ext) [ path.pwd ] ] ; + local include_path + = [ path.root $(__name__:D)/../include [ path.pwd ] ] ; + _check_exe_($(language)) = [ + exe predef_check_as_$(language) + : $(source_path) + : $(include_path) ] ; + explicit predef_check_as_$(language) ; +} +check_target c : c ; +check_target cpp : cpp ; +check_target objc : m ; +check_target objcpp : mm ; + +# Checks the expressions and when used evaluates to the true-properties +# if the expressions are all true. Otherwise evaluates to the +# false-properties. +rule check ( expressions + : language ? : true-properties * : false-properties * ) +{ + # Default to C++ on the check context. + language ?= cpp ; + + local project_target = [ project.target $(__name__) ] ; + project.push-current $(project_target) ; + local result ; + for expression in $(expressions) + { + # The check program to use. + local exe_target = [ $(_check_exe_($(language))).name ] ; + exe_target = /check/predef//$(exe_target) ; + + # Create the check run if we don't have one yet. + local key = [ MD5 $(language)::$(expression) ] ; + if ! ( $(key) in $(_checks_) ) + { + _checks_ += $(key) ; + make + $(key).txt : + $(exe_target) : + @$(__name__).predef_check_action : + $(expression) ; + explicit + $(key).txt ; + } + + local check_target = [ check-target-builds + /check/predef//$(key).txt $(expression) + : $(true-properties) + : $(false-properties) ] ; + + result += $(check_target) ; + } + project.pop-current ; + return $(result) ; +} + +# Checks the expressions and when used evaluates to no +# if the expressions are all false. Otherwise evaluates to the +# nothing. +rule require ( expressions + : language ? ) +{ + return [ check $(expressions) : $(language) : : no ] ; +} + +actions predef_check_action bind PREDEF_CHECK_EXPRESSION +{ + $(>) "$(PREDEF_CHECK_EXPRESSION)" > $(<) +} diff --git a/check/predef_check_as_c.c b/check/predef_check_as_c.c new file mode 100644 index 0000000..340cd23 --- /dev/null +++ b/check/predef_check_as_c.c @@ -0,0 +1,119 @@ +/* +Copyright Rene Rivera 2011-2012 +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) +*/ +#include +#include +#include + +#define BOOST_PREDEF_INTERNAL_GENERATE_TESTS + +typedef struct predef_info +{ + unsigned tag; + const char * name; + const char * description; + unsigned value; +} predef_info; + +predef_info first_predef_info = { 0x43210DEF , "-" , "-" , 0xFFFFFFFF }; + +#define BOOST_PREDEF_DECLARE_TEST(x,s) \ + predef_info x##_predef_info = { 0x67890DEF , #x , s , x }; +#include + +predef_info last_predef_info = { 0xFFFFFFFF , "-" , "-" , 0x43210DEF }; + +int predef_info_compare(const void * a, const void * b) +{ + const predef_info ** i = (const predef_info **)a; + const predef_info ** j = (const predef_info **)b; + return strcmp((*i)->name,(*j)->name); +} + +const char * str_token(const char ** str, const char * space) +{ + unsigned span; + char * token; + for (; **str != 0; *str += 1) + { + if (0 == strchr(space, **str)) + { + break; + } + } + span = strcspn(*str, space); + token = (char *)malloc(span+1); + strncpy(token, *str, span); + token[span] = 0; + for (*str += span; **str != 0; *str += 1) + { + if (0 == strchr(space, **str)) + { + break; + } + } + return token; +} + +const char * whitespace = " "; +const char * dot = "."; + +int main(int argc, const char ** argv) +{ + unsigned x = 0; + unsigned argi = 1; + predef_info ** predefs = 0; + unsigned predef_count = 0; + unsigned * i = &first_predef_info.tag; + unsigned * e = &last_predef_info.tag; + while (i < e) + { + i += 1; + if (*i == 0x67890DEF) + { + predef_count += 1; + predefs = (predef_info**)realloc(predefs,predef_count*sizeof(predef_info*)); + predefs[predef_count-1] = (predef_info*)i; + } + } + qsort(predefs,predef_count,sizeof(predef_info*),predef_info_compare); + for (argi = 1; argi < argc; ++argi) + { + const char * exp = argv[argi]; + const char * exp_name = str_token(&exp, whitespace); + const char * exp_op = str_token(&exp, whitespace); + const char * exp_val = str_token(&exp, whitespace); + unsigned exp_version = 0; + if (*exp_val != 0) + { + exp = exp_val; + const char * exp_val_a = str_token(&exp, dot); + const char * exp_val_b = str_token(&exp, dot); + const char * exp_val_c = str_token(&exp, dot); + exp_version = BOOST_VERSION_NUMBER(atoi(exp_val_a), atoi(exp_val_b),atoi(exp_val_c)); + } + for (x = 0; x < predef_count; ++x) + { + if (*exp_op == 0 && + predefs[x]->value == 0 && + strcmp(exp_name, predefs[x]->name) == 0) + { + return argi; + } + else if (*exp_op != 0 && *exp_val != 0 && + strcmp(exp_name, predefs[x]->name) == 0) + { + if (0 == strcmp(">",exp_op) && !(predefs[x]->value > exp_version)) return argi; + if (0 == strcmp("<",exp_op) && !(predefs[x]->value < exp_version)) return argi; + if (0 == strcmp(">=",exp_op) && !(predefs[x]->value >= exp_version)) return argi; + if (0 == strcmp("<=",exp_op) && !(predefs[x]->value <= exp_version)) return argi; + if (0 == strcmp("==",exp_op) && !(predefs[x]->value == exp_version)) return argi; + if (0 == strcmp("!=",exp_op) && !(predefs[x]->value != exp_version)) return argi; + } + } + } + return 0; +} diff --git a/check/predef_check_as_cpp.cpp b/check/predef_check_as_cpp.cpp new file mode 100644 index 0000000..c58abe7 --- /dev/null +++ b/check/predef_check_as_cpp.cpp @@ -0,0 +1 @@ +#include "predef_check_as_c.c" diff --git a/check/predef_check_as_objc.m b/check/predef_check_as_objc.m new file mode 100644 index 0000000..c58abe7 --- /dev/null +++ b/check/predef_check_as_objc.m @@ -0,0 +1 @@ +#include "predef_check_as_c.c" diff --git a/check/predef_check_as_objcpp.mm b/check/predef_check_as_objcpp.mm new file mode 100644 index 0000000..c58abe7 --- /dev/null +++ b/check/predef_check_as_objcpp.mm @@ -0,0 +1 @@ +#include "predef_check_as_c.c" diff --git a/doc/html/index.html b/doc/html/index.html index 603afa7..fa8d249 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -52,7 +52,7 @@ - +

    Last revised: December 30, 2014 at 14:12:07 GMT

    Last revised: January 27, 2015 at 14:25:08 GMT


    diff --git a/test/build.jam b/test/build.jam index 10ba4f8..28e1473 100755 --- a/test/build.jam +++ b/test/build.jam @@ -4,6 +4,8 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +import ../check/predef : require : predef-require ; + local predef-include-root ; local predef-dependency ; @@ -53,6 +55,6 @@ test-suite predef : [ run info_as_objc.m : : : always_show_run_output ] [ run version.cpp ] [ run make.cpp ] - [ compile macos_endian.c ] - [ compile macos_vs_bsd.c ] + [ compile macos_endian.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] + [ compile macos_vs_bsd.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] ; From 44133dce99fb2a74ca1310f75aedd1beedbf693e Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 27 Jan 2015 10:22:37 -0600 Subject: [PATCH 09/17] Disable Mac check tests until the work on super layout. --- test/build.jam | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/build.jam b/test/build.jam index 28e1473..c6bee6a 100755 --- a/test/build.jam +++ b/test/build.jam @@ -55,6 +55,6 @@ test-suite predef : [ run info_as_objc.m : : : always_show_run_output ] [ run version.cpp ] [ run make.cpp ] - [ compile macos_endian.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] - [ compile macos_vs_bsd.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] + # [ compile macos_endian.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] + # [ compile macos_vs_bsd.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] ; From 65bb36c66d768cc54a39f26732c48c2269ba7ea9 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 27 Jan 2015 14:17:37 -0600 Subject: [PATCH 10/17] Fix incorrect path calculation for predef check program sources. Hence, re-enable the tests that use predef/check. --- check/predef.jam | 6 ++++-- test/build.jam | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/check/predef.jam b/check/predef.jam index 65c3451..f62aec7 100644 --- a/check/predef.jam +++ b/check/predef.jam @@ -27,10 +27,12 @@ local rule check_target ( language : ext ) # Need to use absolute paths because we don't know the # context of the invocation which affects where the paths # originate from. + local predef_jam + = [ modules.binding $(__name__) ] ; local source_path - = [ path.root $(__name__:D)/predef_check_as_$(language).$(ext) [ path.pwd ] ] ; + = [ path.root $(predef_jam:D)/predef_check_as_$(language).$(ext) [ path.pwd ] ] ; local include_path - = [ path.root $(__name__:D)/../include [ path.pwd ] ] ; + = [ path.root $(predef_jam:D)/../include [ path.pwd ] ] ; _check_exe_($(language)) = [ exe predef_check_as_$(language) : $(source_path) diff --git a/test/build.jam b/test/build.jam index c6bee6a..28e1473 100755 --- a/test/build.jam +++ b/test/build.jam @@ -55,6 +55,6 @@ test-suite predef : [ run info_as_objc.m : : : always_show_run_output ] [ run version.cpp ] [ run make.cpp ] - # [ compile macos_endian.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] - # [ compile macos_vs_bsd.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] + [ compile macos_endian.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] + [ compile macos_vs_bsd.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] ; From 2f5071dab68afa30f9577257f05940bb7677deea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Hunold?= Date: Wed, 28 Jan 2015 16:57:32 +0100 Subject: [PATCH 11/17] untabify --- check/predef_check_as_c.c | 106 +++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/check/predef_check_as_c.c b/check/predef_check_as_c.c index 340cd23..9806ae0 100644 --- a/check/predef_check_as_c.c +++ b/check/predef_check_as_c.c @@ -35,27 +35,27 @@ int predef_info_compare(const void * a, const void * b) const char * str_token(const char ** str, const char * space) { - unsigned span; - char * token; - for (; **str != 0; *str += 1) - { - if (0 == strchr(space, **str)) - { - break; - } - } - span = strcspn(*str, space); - token = (char *)malloc(span+1); - strncpy(token, *str, span); - token[span] = 0; - for (*str += span; **str != 0; *str += 1) - { - if (0 == strchr(space, **str)) - { - break; - } - } - return token; + unsigned span; + char * token; + for (; **str != 0; *str += 1) + { + if (0 == strchr(space, **str)) + { + break; + } + } + span = strcspn(*str, space); + token = (char *)malloc(span+1); + strncpy(token, *str, span); + token[span] = 0; + for (*str += span; **str != 0; *str += 1) + { + if (0 == strchr(space, **str)) + { + break; + } + } + return token; } const char * whitespace = " "; @@ -82,38 +82,38 @@ int main(int argc, const char ** argv) qsort(predefs,predef_count,sizeof(predef_info*),predef_info_compare); for (argi = 1; argi < argc; ++argi) { - const char * exp = argv[argi]; - const char * exp_name = str_token(&exp, whitespace); - const char * exp_op = str_token(&exp, whitespace); - const char * exp_val = str_token(&exp, whitespace); - unsigned exp_version = 0; - if (*exp_val != 0) - { - exp = exp_val; - const char * exp_val_a = str_token(&exp, dot); - const char * exp_val_b = str_token(&exp, dot); - const char * exp_val_c = str_token(&exp, dot); - exp_version = BOOST_VERSION_NUMBER(atoi(exp_val_a), atoi(exp_val_b),atoi(exp_val_c)); - } - for (x = 0; x < predef_count; ++x) - { - if (*exp_op == 0 && - predefs[x]->value == 0 && - strcmp(exp_name, predefs[x]->name) == 0) - { - return argi; - } - else if (*exp_op != 0 && *exp_val != 0 && - strcmp(exp_name, predefs[x]->name) == 0) - { - if (0 == strcmp(">",exp_op) && !(predefs[x]->value > exp_version)) return argi; - if (0 == strcmp("<",exp_op) && !(predefs[x]->value < exp_version)) return argi; - if (0 == strcmp(">=",exp_op) && !(predefs[x]->value >= exp_version)) return argi; - if (0 == strcmp("<=",exp_op) && !(predefs[x]->value <= exp_version)) return argi; - if (0 == strcmp("==",exp_op) && !(predefs[x]->value == exp_version)) return argi; - if (0 == strcmp("!=",exp_op) && !(predefs[x]->value != exp_version)) return argi; - } - } + const char * exp = argv[argi]; + const char * exp_name = str_token(&exp, whitespace); + const char * exp_op = str_token(&exp, whitespace); + const char * exp_val = str_token(&exp, whitespace); + unsigned exp_version = 0; + if (*exp_val != 0) + { + exp = exp_val; + const char * exp_val_a = str_token(&exp, dot); + const char * exp_val_b = str_token(&exp, dot); + const char * exp_val_c = str_token(&exp, dot); + exp_version = BOOST_VERSION_NUMBER(atoi(exp_val_a), atoi(exp_val_b),atoi(exp_val_c)); + } + for (x = 0; x < predef_count; ++x) + { + if (*exp_op == 0 && + predefs[x]->value == 0 && + strcmp(exp_name, predefs[x]->name) == 0) + { + return argi; + } + else if (*exp_op != 0 && *exp_val != 0 && + strcmp(exp_name, predefs[x]->name) == 0) + { + if (0 == strcmp(">",exp_op) && !(predefs[x]->value > exp_version)) return argi; + if (0 == strcmp("<",exp_op) && !(predefs[x]->value < exp_version)) return argi; + if (0 == strcmp(">=",exp_op) && !(predefs[x]->value >= exp_version)) return argi; + if (0 == strcmp("<=",exp_op) && !(predefs[x]->value <= exp_version)) return argi; + if (0 == strcmp("==",exp_op) && !(predefs[x]->value == exp_version)) return argi; + if (0 == strcmp("!=",exp_op) && !(predefs[x]->value != exp_version)) return argi; + } + } } return 0; } From 1e9ad49f157404450e48d59b08aa9a0969e21457 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Wed, 28 Jan 2015 11:54:00 -0600 Subject: [PATCH 12/17] Fix repeated path parts in source and include paths because they are already absolute and don't need to be pwd rooted again. Also update copyright on C source. --- check/predef.jam | 4 ++-- check/predef_check_as_c.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/check/predef.jam b/check/predef.jam index f62aec7..b1b8b2c 100644 --- a/check/predef.jam +++ b/check/predef.jam @@ -30,9 +30,9 @@ local rule check_target ( language : ext ) local predef_jam = [ modules.binding $(__name__) ] ; local source_path - = [ path.root $(predef_jam:D)/predef_check_as_$(language).$(ext) [ path.pwd ] ] ; + = $(predef_jam:D)/predef_check_as_$(language).$(ext) ; local include_path - = [ path.root $(predef_jam:D)/../include [ path.pwd ] ] ; + = $(predef_jam:D)/../include ; _check_exe_($(language)) = [ exe predef_check_as_$(language) : $(source_path) diff --git a/check/predef_check_as_c.c b/check/predef_check_as_c.c index 9806ae0..a737533 100644 --- a/check/predef_check_as_c.c +++ b/check/predef_check_as_c.c @@ -1,5 +1,5 @@ /* -Copyright Rene Rivera 2011-2012 +Copyright Rene Rivera 2011-2015 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) From 47168857191c956a7cdbf0393449d2dcf708a4d2 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Wed, 28 Jan 2015 12:54:01 -0600 Subject: [PATCH 13/17] Remove tabs. --- check/predef.jam | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/check/predef.jam b/check/predef.jam index b1b8b2c..d65a771 100644 --- a/check/predef.jam +++ b/check/predef.jam @@ -13,7 +13,7 @@ import string ; import toolset ; import modules ; import path ; - + # Create a project for our targets. project.extension predef check ; @@ -28,16 +28,16 @@ local rule check_target ( language : ext ) # context of the invocation which affects where the paths # originate from. local predef_jam - = [ modules.binding $(__name__) ] ; - local source_path - = $(predef_jam:D)/predef_check_as_$(language).$(ext) ; - local include_path - = $(predef_jam:D)/../include ; - _check_exe_($(language)) = [ - exe predef_check_as_$(language) - : $(source_path) - : $(include_path) ] ; - explicit predef_check_as_$(language) ; + = [ modules.binding $(__name__) ] ; + local source_path + = $(predef_jam:D)/predef_check_as_$(language).$(ext) ; + local include_path + = $(predef_jam:D)/../include ; + _check_exe_($(language)) = [ + exe predef_check_as_$(language) + : $(source_path) + : $(include_path) ] ; + explicit predef_check_as_$(language) ; } check_target c : c ; check_target cpp : cpp ; @@ -65,20 +65,20 @@ rule check ( expressions + : language ? : true-properties * : false-properties * local key = [ MD5 $(language)::$(expression) ] ; if ! ( $(key) in $(_checks_) ) { - _checks_ += $(key) ; - make - $(key).txt : - $(exe_target) : - @$(__name__).predef_check_action : - $(expression) ; - explicit - $(key).txt ; - } + _checks_ += $(key) ; + make + $(key).txt : + $(exe_target) : + @$(__name__).predef_check_action : + $(expression) ; + explicit + $(key).txt ; + } local check_target = [ check-target-builds - /check/predef//$(key).txt $(expression) - : $(true-properties) - : $(false-properties) ] ; + /check/predef//$(key).txt $(expression) + : $(true-properties) + : $(false-properties) ] ; result += $(check_target) ; } @@ -91,7 +91,7 @@ rule check ( expressions + : language ? : true-properties * : false-properties * # nothing. rule require ( expressions + : language ? ) { - return [ check $(expressions) : $(language) : : no ] ; + return [ check $(expressions) : $(language) : : no ] ; } actions predef_check_action bind PREDEF_CHECK_EXPRESSION From 7c3bbb1fe6021dfcc0c8f93f10bdce5a3207ce06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Hunold?= Date: Wed, 28 Jan 2015 21:26:33 +0100 Subject: [PATCH 14/17] Fix signed/unsigned mismatch Detected by msvc/gcc/clang --- check/predef_check_as_c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check/predef_check_as_c.c b/check/predef_check_as_c.c index a737533..dcb7d6a 100644 --- a/check/predef_check_as_c.c +++ b/check/predef_check_as_c.c @@ -64,7 +64,7 @@ const char * dot = "."; int main(int argc, const char ** argv) { unsigned x = 0; - unsigned argi = 1; + int argi = 1; predef_info ** predefs = 0; unsigned predef_count = 0; unsigned * i = &first_predef_info.tag; From 00eb018794c838097992a0ebcc69f0a813c90d2c Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Thu, 29 Jan 2015 15:41:56 -0600 Subject: [PATCH 15/17] Initial docs for predef_check. --- doc/history.qbk | 4 +- doc/html/index.html | 3 +- doc/html/predef/check_utility.html | 32 +++++ doc/html/predef/history.html | 10 +- .../reference/version_definition_macros.html | 6 +- doc/predef.qbk | 127 ++++++++++++++++++ 6 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 doc/html/predef/check_utility.html diff --git a/doc/history.qbk b/doc/history.qbk index f8c0b47..5df5bf1 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -1,5 +1,5 @@ [/ -Copyright 2014 Rene Rivera +Copyright 2014-2015 Rene Rivera 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) @@ -14,6 +14,8 @@ http://www.boost.org/LICENSE_1_0.txt) * Add detection of Haiku OS (from Jessica Hamilton). * Some fixes to endian detection for Android (from mstahl-at-redhat.com). * Add missing `BOOST_PREDEF_MAKE_0X_VVRRPP` macro (from Erik Lindahl). +* Add `predef_check` program and BBv2 integration for build configuration + checks. [heading 1.1] diff --git a/doc/html/index.html b/doc/html/index.html index fa8d249..8a4dde7 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -45,6 +45,7 @@
    Version definition macros
    +
    Check Utilities
    History
    To Do
    Acknoledgements
    @@ -52,7 +53,7 @@ - +

    Last revised: January 27, 2015 at 14:25:08 GMT

    Last revised: January 29, 2015 at 21:39:36 GMT


    diff --git a/doc/html/predef/check_utility.html b/doc/html/predef/check_utility.html new file mode 100644 index 0000000..5302f24 --- /dev/null +++ b/doc/html/predef/check_utility.html @@ -0,0 +1,32 @@ + + + +Check Utility + + + + + + + + +
    +PrevUpHomeNext +
    + + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/predef/history.html b/doc/html/predef/history.html index d7dc619..883817d 100644 --- a/doc/html/predef/history.html +++ b/doc/html/predef/history.html @@ -6,12 +6,12 @@ - +
    -PrevUpHomeNext +PrevUpHomeNext

    @@ -36,6 +36,10 @@ Add missing BOOST_PREDEF_MAKE_0X_VVRRPP macro (from Erik Lindahl). +
  • + Add predef_check program + and BBv2 integration for build configuration checks. +
  • @@ -88,7 +92,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/predef/reference/version_definition_macros.html b/doc/html/predef/reference/version_definition_macros.html index 84fed35..0451ca1 100644 --- a/doc/html/predef/reference/version_definition_macros.html +++ b/doc/html/predef/reference/version_definition_macros.html @@ -7,11 +7,11 @@ - +
    -PrevUpHomeNext +PrevUpHomeNext

    @@ -181,7 +181,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/predef.qbk b/doc/predef.qbk index 4626830..07807cd 100644 --- a/doc/predef.qbk +++ b/doc/predef.qbk @@ -558,6 +558,133 @@ and "Y", "M", "D" for dates. [endsect] +[section Check Utilities] + +The `predef_check` utility provides a facility for building a +program that will check a given set of expressions against +the definitions it detected when it was built. + +[heading [^predef_check] programs] + +Even though there is only one `predef_check` program, there +are variations for each of the languages that are detected +by Predef to match the convention for sources files. For all +of them one invokes with a list of expression arguments. The +expressions are evaluated within the context of the particular +[^predef_check] program and if they all are true zero (0) is returned. +Otherwise the index of the first false expression is returned. + +The expression syntax is simple: + +[teletype] +`` +predef-definition [ relational-operator version-value ] +`` +[c++] + +[~predef-definition] can be any of the Predef definitions. For +example `BOOST_COMP_GCC`. + +[~relational-operator] can be any of: [^>], [^<], [^>=], [^<=], +[^==] and [^!=]. + +[~version-number] can be a full or partial version triplet value. +If it's a partial version triple it is completed with zeros. That +is [^x.y] is equivalent to [^x.y.0] and [^x] is equivalent to +[^x.0.0]. + +The [~relations-operator] and [~version-number] can be ommited. In +which case it is equivalent to: + +[teletype] +`` +predef-definition > 0.0.0 +`` +[c++] + +[heading Using with Boost.Build] + +You can use the [^predef_check] programs directly from Boost Build +to configure target requirements. This is useful for controlling +what gets built as part of your project based on the detailed +version information available in Predef. The basic use is simple: + +[teletype] +`` +import path-to-predef-src/check/predef + : check require + : predef-check predef-require ; + +exe my_windows_program : windows_source.cpp + : [ predef-require "BOOST_OS_WINDOWS" ] ; +`` +[c++] + +That simple use case will skip building the [^my_windows_program] +unless one is building for Windows. Like the direct [^predef_check] +you can pass mutiple expressions using relational comparisons. +For example: + +[teletype] +`` +import path-to-predef-src/check/predef + : check require + : predef-check predef-require ; + +lib my_special_lib : source.cpp + : [ predef-require "BOOST_OS_WINDOWS != 0" "BOOST_OS_VMS != 0"] ; +`` +[c++] + +And in that case the [^my_special_lib] is built only when the OS is +not Windows or VMS. The [^requires] rule is a special case of the +[^check] rule. And is defined in terms of it: + +[teletype] +`` +rule require ( expressions + : language ? ) +{ + return [ check $(expressions) : $(language) : : no ] ; +} +`` +[c++] + +You can use the [^check] rule for more control and to implement +something other than control of what gets built. The definition +for the [^check] rule is: + +[teletype] +`` +rule check ( expressions + : language ? : true-properties * : false-properties * ) +`` +[c++] + +When invoked as a reuirement of a Boost Build target this rule +will add the [^true-properties] to the target if all the [^expressions] +evaluate to true. Otherwise the [^false-properties] get added as +requirements. For example you could use it to enable or disable +features in your programs: + +[teletype] +`` +import path-to-predef-src/check/predef + : check require + : predef-check predef-require ; + +exe my_special_exe : source.cpp + : [ predef-check "BOOST_OS_WINDOWS == 0" + : ENABLE_WMF=0 + : ENABLE_WMF=1 ] ; +`` +[c++] + +For both [^check] and [^require] the [^language] argument controls +which variant of the [^predef_check] program is used to check the +expressions. It defaults to "c++", but can be any of: "c", "cpp", +"objc", and "objcpp". + +[endsect] + [include history.qbk] [include todo.qbk] From 1ed4e62903a5bd2de867ae8fc2c060a7ac31464e Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Thu, 29 Jan 2015 15:52:21 -0600 Subject: [PATCH 16/17] Add missing file. --- doc/html/predef/check_utilities.html | 148 +++++++++++++++++++++++++++ doc/html/predef/check_utility.html | 32 ------ 2 files changed, 148 insertions(+), 32 deletions(-) create mode 100644 doc/html/predef/check_utilities.html delete mode 100644 doc/html/predef/check_utility.html diff --git a/doc/html/predef/check_utilities.html b/doc/html/predef/check_utilities.html new file mode 100644 index 0000000..1664b19 --- /dev/null +++ b/doc/html/predef/check_utilities.html @@ -0,0 +1,148 @@ + + + +Check Utilities + + + + + + + + +
    +PrevUpHomeNext +
    +
    + +

    + The predef_check utility provides + a facility for building a program that will check a given set of expressions + against the definitions it detected when it was built. +

    +

    + + predef_check + programs +

    +

    + Even though there is only one predef_check + program, there are variations for each of the languages that are detected by + Predef to match the convention for sources files. For all of them one invokes + with a list of expression arguments. The expressions are evaluated within the + context of the particular predef_check program and if they + all are true zero (0) is returned. Otherwise the index of the first false expression + is returned. +

    +

    + The expression syntax is simple: +

    +
    predef-definition [ relational-operator version-value ]
    +
    +

    + predef-definition can be any of the Predef definitions. + For example BOOST_COMP_GCC. +

    +

    + relational-operator can be any of: >, + <, >=, <=, + == and !=. +

    +

    + version-number can be a full or partial version + triplet value. If it's a partial version triple it is completed with zeros. + That is x.y is equivalent to x.y.0 and + x is equivalent to x.0.0. +

    +

    + The relations-operator and version-number + can be ommited. In which case it is equivalent to: +

    +
    predef-definition > 0.0.0
    +
    +

    + + Using + with Boost.Build +

    +

    + You can use the predef_check programs directly from Boost + Build to configure target requirements. This is useful for controlling what + gets built as part of your project based on the detailed version information + available in Predef. The basic use is simple: +

    +
    import path-to-predef-src/check/predef
    +    : check require
    +    : predef-check predef-require ;
    +
    +exe my_windows_program : windows_source.cpp
    +    : [ predef-require "BOOST_OS_WINDOWS" ] ;
    +
    +

    + That simple use case will skip building the my_windows_program + unless one is building for Windows. Like the direct predef_check + you can pass mutiple expressions using relational comparisons. For example: +

    +
    import path-to-predef-src/check/predef
    +    : check require
    +    : predef-check predef-require ;
    +
    +lib my_special_lib : source.cpp
    +    : [ predef-require "BOOST_OS_WINDOWS != 0" "BOOST_OS_VMS != 0"] ;
    +
    +

    + And in that case the my_special_lib is built only when the + OS is not Windows or VMS. The requires rule is a special + case of the check rule. And is defined in terms of it: +

    +
    rule require ( expressions + : language ? )
    +{
    +    return [ check $(expressions) : $(language) : : <build>no ] ;
    +}
    +
    +

    + You can use the check rule for more control and to implement + something other than control of what gets built. The definition for the check + rule is: +

    +
    rule check ( expressions + : language ? : true-properties * : false-properties * )
    +
    +

    + When invoked as a reuirement of a Boost Build target this rule will add the + true-properties to the target if all the expressions + evaluate to true. Otherwise the false-properties get added + as requirements. For example you could use it to enable or disable features + in your programs: +

    +
    import path-to-predef-src/check/predef
    +    : check require
    +    : predef-check predef-require ;
    +
    +exe my_special_exe : source.cpp
    +    : [ predef-check "BOOST_OS_WINDOWS == 0"
    +        : <define>ENABLE_WMF=0
    +        : <define>ENABLE_WMF=1 ] ;
    +
    +

    + For both check and require the language + argument controls which variant of the predef_check program + is used to check the expressions. It defaults to "c++", but can be + any of: "c", "cpp", "objc", and "objcpp". +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/predef/check_utility.html b/doc/html/predef/check_utility.html deleted file mode 100644 index 5302f24..0000000 --- a/doc/html/predef/check_utility.html +++ /dev/null @@ -1,32 +0,0 @@ - - - -Check Utility - - - - - - - - -
    -PrevUpHomeNext -
    - - - - -
    -
    -
    -PrevUpHomeNext -
    - - From 25d0738035fb4fbe20473f0e1b6a43e22ed404c1 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sun, 1 Feb 2015 14:33:12 -0600 Subject: [PATCH 17/17] Fix missing expressions from predef_check invocation. --- check/predef.jam | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/check/predef.jam b/check/predef.jam index d65a771..0638703 100644 --- a/check/predef.jam +++ b/check/predef.jam @@ -94,6 +94,12 @@ rule require ( expressions + : language ? ) return [ check $(expressions) : $(language) : : no ] ; } +rule predef_check_action ( targets + : sources + : props * ) +{ + PREDEF_CHECK_EXPRESSION on $(targets) + = [ feature.get-values : $(props) ] ; +} + actions predef_check_action bind PREDEF_CHECK_EXPRESSION { $(>) "$(PREDEF_CHECK_EXPRESSION)" > $(<)