From fdd98a596827e1441125a06346bea704443d0d83 Mon Sep 17 00:00:00 2001 From: grafikrobot Date: Thu, 3 Jan 2013 21:37:59 -0600 Subject: [PATCH] Use epoc date as basis for standards, c, c++, etc. version number. --- include/boost/predef/language/objc.h | 2 +- include/boost/predef/language/stdc.h | 8 ++++---- include/boost/predef/language/stdcpp.h | 14 ++++++-------- include/boost/predef/make.h | 4 +++- test/make.cpp | 6 +++++- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/include/boost/predef/language/objc.h b/include/boost/predef/language/objc.h index 06441df..8a6789f 100644 --- a/include/boost/predef/language/objc.h +++ b/include/boost/predef/language/objc.h @@ -19,7 +19,7 @@ http://www.boost.org/LICENSE_1_0.txt) [table [[__predef_symbol__] [__predef_version__]] - [[``] [__predef_detection__]] + [[`__OBJC__`] [__predef_detection__]] [[``] [V.R.P]] ] diff --git a/include/boost/predef/language/stdc.h b/include/boost/predef/language/stdc.h index 7242432..f7842ca 100644 --- a/include/boost/predef/language/stdc.h +++ b/include/boost/predef/language/stdc.h @@ -15,14 +15,14 @@ http://www.boost.org/LICENSE_1_0.txt) [heading `BOOST_LANG_STDC`] [@http://en.wikipedia.org/wiki/C_(programming_language) Standard C] language. -If available, the year of the standard is detected as YYYY.1.1 from the Epoc date. +If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. [table [[__predef_symbol__] [__predef_version__]] - [[``] [__predef_detection__]] + [[`__STDC__`] [__predef_detection__]] - [[``] [V.R.P]] + [[`__STDC_VERSION__`] [V.R.P]] ] */ @@ -32,7 +32,7 @@ If available, the year of the standard is detected as YYYY.1.1 from the Epoc dat # undef BOOST_LANG_STDC # if defined(__STDC_VERSION__) # if (__STDC_VERSION__ > 100) -# define BOOST_LANG_STDC BOOST_PREDEF_MAKE_YYYY(__STDC_VERSION__) +# define BOOST_LANG_STDC BOOST_PREDEF_MAKE_YYYYMM(__STDC_VERSION__) # else # define BOOST_LANG_STDC BOOST_VERSION_NUMBER(0,0,1) # endif diff --git a/include/boost/predef/language/stdcpp.h b/include/boost/predef/language/stdcpp.h index a3e3aef..9f23b1b 100644 --- a/include/boost/predef/language/stdcpp.h +++ b/include/boost/predef/language/stdcpp.h @@ -1,5 +1,5 @@ /* -Copyright Redshift Software Inc. 2011-2012 +Copyright Redshift Software Inc. 2011-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) @@ -22,10 +22,8 @@ Specifically the defined versions are: [table Detected Version Number vs. C++ Standard Year [[Detected Version Number] [Standard Year] [C++ Standard]] - [[0.0.1997] [1998] [ISO/IEC 14882:1998]] - [[0.0.?] [2003] [ISO/IEC 14882:2003]] - [[0.0.?] [2007] [ISO/IEC TR 19768:2007]] - [[0.0.2011] [2011] [ISO/IEC 14882:2011]] + [[27.11.1] [1998] [ISO/IEC 14882:1998]] + [[41.12.1] [2011] [ISO/IEC 14882:2011]] ] [table @@ -42,7 +40,7 @@ Specifically the defined versions are: #if defined(__cplusplus) # undef BOOST_LANG_STDCPP # if (__cplusplus > 100) -# define BOOST_LANG_STDCPP BOOST_VERSION_NUMBER(0,0,__cplusplus/100) +# define BOOST_LANG_STDCPP BOOST_PREDEF_MAKE_YYYYMM(__cplusplus) # else # define BOOST_LANG_STDCPP BOOST_VERSION_NUMBER(0,0,1) # endif @@ -58,7 +56,7 @@ BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDCPP,BOOST_LANG_STDCPP_NAME) [heading `BOOST_LANG_STDCPPCLI`] [@http://en.wikipedia.org/wiki/C%2B%2B/CLI Standard C++/CLI] language. -If available, the year of the standard is detected as 0.0.YYYY. +If available, the year of the standard is detected as YYYY.MM.1. */ #define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER(0,0,0) @@ -66,7 +64,7 @@ If available, the year of the standard is detected as 0.0.YYYY. #if defined(__cplusplus_cli) # undef BOOST_LANG_STDCPPCLI # if (__cplusplus_cli > 100) -# define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER(0,0,__cplusplus_cli/100) +# define BOOST_LANG_STDCPPCLI BOOST_PREDEF_MAKE_YYYYMM(__cplusplus_cli) # else # define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER(0,0,1) # endif diff --git a/include/boost/predef/make.h b/include/boost/predef/make.h index 19bf1d5..bafcce1 100644 --- a/include/boost/predef/make.h +++ b/include/boost/predef/make.h @@ -1,5 +1,5 @@ /* -Copyright Redshift Software, Inc. 2008-2012 +Copyright Redshift Software, Inc. 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) @@ -81,5 +81,7 @@ If the day is not available, but the month is, the 1st of the month is used as t #define BOOST_PREDEF_MAKE_YYYYMMDD(V) BOOST_PREDEF_MAKE_DATE(((V)/10000)%10000,((V)/100)%100,(V)%100) /*` `BOOST_PREDEF_MAKE_YYYY(V)` */ #define BOOST_PREDEF_MAKE_YYYY(V) BOOST_PREDEF_MAKE_DATE(V,1,1) +/*` `BOOST_PREDEF_MAKE_YYYYMM(V)` */ +#define BOOST_PREDEF_MAKE_YYYYMM(V) BOOST_PREDEF_MAKE_DATE((V)/100,(V),1) #endif diff --git a/test/make.cpp b/test/make.cpp index 37bb0ca..a25d722 100644 --- a/test/make.cpp +++ b/test/make.cpp @@ -1,5 +1,5 @@ /* -Copyright Redshift Software Inc 2011-2012 +Copyright Redshift Software Inc 2011-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) @@ -51,9 +51,13 @@ void test_BOOST_VERSION_NUMBER() PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR0PPPP(999909999) == BOOST_VERSION_NUMBER(99,99,9999)); PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRR(999) == BOOST_VERSION_NUMBER(9,99,00)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_DATE(1971,1,1) == BOOST_VERSION_NUMBER(1,1,1)); PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMMDD(19700101) == BOOST_VERSION_NUMBER(0,1,1)); PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMMDD(19710101) == BOOST_VERSION_NUMBER(1,1,1)); PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMMDD(20691231) == BOOST_VERSION_NUMBER(99,12,31)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMM(197001) == BOOST_VERSION_NUMBER(0,1,1)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMM(197101) == BOOST_VERSION_NUMBER(1,1,1)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMM(206912) == BOOST_VERSION_NUMBER(99,12,1)); } int main()