Fix Intel C/C++ compiler version specification.

Add `BOOST_VERSION_NUMBER_MAJOR`, `BOOST_VERSION_NUMBER_MINOR`,
`BOOST_VERSION_NUMBER_PATCH` macros to extract components from valid
version numbers.
This commit is contained in:
Rene Rivera
2017-01-03 22:07:48 -06:00
parent e7e3a2ac38
commit 822d09f19b
6 changed files with 60 additions and 6 deletions

View File

@ -7,6 +7,13 @@ http://www.boost.org/LICENSE_1_0.txt)
[section History] [section History]
[heading 1.5]
* Fix Intel C/C++ compiler version specification.
* Add `BOOST_VERSION_NUMBER_MAJOR`, `BOOST_VERSION_NUMBER_MINOR`,
`BOOST_VERSION_NUMBER_PATCH` macros to extract components from valid version
numbers.
[heading 1.4.1] [heading 1.4.1]
* Small fixes for some redefinition errors, and mispelled macros. * Small fixes for some redefinition errors, and mispelled macros.

View File

@ -1,8 +1,8 @@
[article Boost.Predef [article Boost.Predef
[quickbook 1.7] [quickbook 1.7]
[version 1.4.1] [version 1.5]
[authors [Rivera, Rene]] [authors [Rivera, Rene]]
[copyright 2005, 2008-2016 Rene Rivera] [copyright 2005-2016 Rene Rivera]
[copyright 2015 Charly Chevalier] [copyright 2015 Charly Chevalier]
[copyright 2015 Joel Falcou] [copyright 2015 Joel Falcou]
[purpose Identification and specification of predefined macros.] [purpose Identification and specification of predefined macros.]

View File

@ -25,7 +25,8 @@ Version number available as major, minor, and patch.
[[`__ICC`] [__predef_detection__]] [[`__ICC`] [__predef_detection__]]
[[`__ECC`] [__predef_detection__]] [[`__ECC`] [__predef_detection__]]
[[`__INTEL_COMPILER`] [V.R.P]] [[`__INTEL_COMPILER`] [V.R]]
[[`__INTEL_COMPILER` and `__INTEL_COMPILER_UPDATE`] [V.R.P]]
] ]
*/ */
@ -33,8 +34,14 @@ Version number available as major, minor, and patch.
#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || \ #if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || \
defined(__ECC) defined(__ECC)
# if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
# define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER( \
BOOST_VERSION_NUMBER_MAJOR(BOOST_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \
BOOST_VERSION_NUMBER_MINOR(BOOST_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \
__INTEL_COMPILER_UPDATE)
# endif
# if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) # if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER)
# define BOOST_COMP_INTEL_DETECTION BOOST_PREDEF_MAKE_10_VRP(__INTEL_COMPILER) # define BOOST_COMP_INTEL_DETECTION BOOST_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)
# endif # endif
# if !defined(BOOST_COMP_INTEL_DETECTION) # if !defined(BOOST_COMP_INTEL_DETECTION)
# define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER_AVAILABLE # define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER_AVAILABLE

View File

@ -10,6 +10,6 @@ http://www.boost.org/LICENSE_1_0.txt)
#include <boost/predef/version_number.h> #include <boost/predef/version_number.h>
#define BOOST_PREDEF_VERSION BOOST_VERSION_NUMBER(1,4,1) #define BOOST_PREDEF_VERSION BOOST_VERSION_NUMBER(1,5,0)
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
Copyright Rene Rivera 2005, 2008-2013 Copyright Rene Rivera 2005-2016
Distributed under the Boost Software License, Version 1.0. Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) http://www.boost.org/LICENSE_1_0.txt)
@ -50,4 +50,23 @@ Defines standard version numbers, with these properties:
#define BOOST_VERSION_NUMBER_NOT_AVAILABLE \ #define BOOST_VERSION_NUMBER_NOT_AVAILABLE \
BOOST_VERSION_NUMBER_ZERO BOOST_VERSION_NUMBER_ZERO
/*`
``
BOOST_VERSION_NUMBER_MAJOR(N), BOOST_VERSION_NUMBER_MINOR(N), BOOST_VERSION_NUMBER_PATCH(N)
``
The macros extract the major, minor, and patch portion from a well formed
version number resulting in a preprocessor expression in the range of
\[0,99\] or \[0,99999\] for the major and minor, or patch numbers
respectively.
*/
#define BOOST_VERSION_NUMBER_MAJOR(N) \
( ((N)/10000000)%100 )
#define BOOST_VERSION_NUMBER_MINOR(N) \
( ((N)/100000)%100 )
#define BOOST_VERSION_NUMBER_PATCH(N) \
( (N)%100000 )
#endif #endif

View File

@ -34,6 +34,27 @@ void test_BOOST_VERSION_NUMBER()
PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) != 1009999999L); PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) != 1009999999L);
PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) == 9999999L); PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) == 9999999L);
PREDEF_CHECK(BOOST_VERSION_NUMBER(100,100,100000) == 0L); PREDEF_CHECK(BOOST_VERSION_NUMBER(100,100,100000) == 0L);
PREDEF_CHECK(
BOOST_VERSION_NUMBER_MAJOR(BOOST_VERSION_NUMBER(0,0,0)) == 0);
PREDEF_CHECK(
BOOST_VERSION_NUMBER_MAJOR(BOOST_VERSION_NUMBER(3,3,3)) == 3);
PREDEF_CHECK(
BOOST_VERSION_NUMBER_MAJOR(BOOST_VERSION_NUMBER(99,99,99999)) == 99);
PREDEF_CHECK(
BOOST_VERSION_NUMBER_MINOR(BOOST_VERSION_NUMBER(0,0,0)) == 0);
PREDEF_CHECK(
BOOST_VERSION_NUMBER_MINOR(BOOST_VERSION_NUMBER(3,3,3)) == 3);
PREDEF_CHECK(
BOOST_VERSION_NUMBER_MINOR(BOOST_VERSION_NUMBER(99,99,99999)) == 99);
PREDEF_CHECK(
BOOST_VERSION_NUMBER_PATCH(BOOST_VERSION_NUMBER(0,0,0)) == 0);
PREDEF_CHECK(
BOOST_VERSION_NUMBER_PATCH(BOOST_VERSION_NUMBER(3,3,3)) == 3);
PREDEF_CHECK(
BOOST_VERSION_NUMBER_PATCH(BOOST_VERSION_NUMBER(99,99,99999)) == 99999);
} }
int main() int main()