Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69595 - in sandbox/local: . boost/local boost/local/aux_/preprocessor/sign/parse_params_
From: lorcaminiti_at_[hidden]
Date: 2011-03-05 19:55:45


Author: lcaminiti
Date: 2011-03-05 19:55:44 EST (Sat, 05 Mar 2011)
New Revision: 69595
URL: http://svn.boost.org/trac/boost/changeset/69595

Log:
Added BOOST_LOCAL_CONFIG_COMPLIANT (to disable variadic macros and empty macro parameters).
Text files modified:
   sandbox/local/TODO.txt | 4 ----
   sandbox/local/boost/local/aux_/preprocessor/sign/parse_params_/is_void.hpp | 10 +++++++++-
   sandbox/local/boost/local/block.hpp | 3 ++-
   sandbox/local/boost/local/config.hpp | 18 ++++++++++++++++++
   sandbox/local/boost/local/exit.hpp | 3 ++-
   sandbox/local/boost/local/function.hpp | 3 ++-
   6 files changed, 33 insertions(+), 8 deletions(-)

Modified: sandbox/local/TODO.txt
==============================================================================
--- sandbox/local/TODO.txt (original)
+++ sandbox/local/TODO.txt 2011-03-05 19:55:44 EST (Sat, 05 Mar 2011)
@@ -15,10 +15,6 @@
 
 * Code: Try seriously to make nested locals to work...
 
-* Code: Add `BOOST_LOCAL_CONFIG_COMPLIANT` macro (#undef by default) that forces 100% C++ standard compliant if #defined -- no variadic and no empy macro params. Similar to Boost.Typeof COMPLIANT -- but programmers must also #define Boost.Typeof COMPLIANT separately if they wish to do so.
-
-* Code: Make the member variable with the local function name used for recursion const so body cannot change it -- or better, make the body funciton const so it cannot change anything about the object (if possible)...
-
 * Code: Optimize macro expansion code for C++0x, C++03, etc. From John Bytheway:
> Yes, in C++0x local structs can be passed as template parameters.
> Obviously, in C++0x there are lambdas too, so you might think your

Modified: sandbox/local/boost/local/aux_/preprocessor/sign/parse_params_/is_void.hpp
==============================================================================
--- sandbox/local/boost/local/aux_/preprocessor/sign/parse_params_/is_void.hpp (original)
+++ sandbox/local/boost/local/aux_/preprocessor/sign/parse_params_/is_void.hpp 2011-03-05 19:55:44 EST (Sat, 05 Mar 2011)
@@ -7,6 +7,7 @@
 #ifndef BOOST_LOCAL_AUX_PP_SIGN_PARSE_PARAMS_IS_VOID_HPP_
 #define BOOST_LOCAL_AUX_PP_SIGN_PARSE_PARAMS_IS_VOID_HPP_
 
+#include "../../../config.hpp"
 #include <boost/detail/preprocessor/keyword/void.hpp>
 #include <boost/preprocessor/detail/is_unary.hpp>
 #include <boost/preprocessor/control/iif.hpp>
@@ -16,9 +17,16 @@
 
 // Private API.
 
+#if defined(BOOST_LOCAL_CONFIG_COMPLIANT)
+# define BOOST_LOCAL_AUX_PP_SIGN_PARASE_PARAMS_IS_VOID_TOKEN_ALLOW_EMPTY_ 0
+#else
+# define BOOST_LOCAL_AUX_PP_SIGN_PARASE_PARAMS_IS_VOID_TOKEN_ALLOW_EMPTY_ 1
+#endif
+
 #define BOOST_LOCAL_AUX_PP_SIGN_PARSE_PARAMS_IS_VOID_TOKEN_(token) \
     BOOST_PP_IIF(BOOST_PP_IS_EMPTY(token), \
- 1 /* handles empty params `()` as no params (C99 only) */ \
+ /* handles empty params `()` as no params (C99 only) */ \
+ BOOST_LOCAL_AUX_PP_SIGN_PARASE_PARAMS_IS_VOID_TOKEN_ALLOW_EMPTY_ \
         BOOST_PP_EMPTY \
     , \
         BOOST_DETAIL_PP_KEYWORD_IS_VOID_FRONT \

Modified: sandbox/local/boost/local/block.hpp
==============================================================================
--- sandbox/local/boost/local/block.hpp (original)
+++ sandbox/local/boost/local/block.hpp 2011-03-05 19:55:44 EST (Sat, 05 Mar 2011)
@@ -12,11 +12,12 @@
 #ifndef BOOST_LOCAL_BLOCK_HPP_
 #define BOOST_LOCAL_BLOCK_HPP_
 
+#include "config.hpp"
 #include "function.hpp"
 #include "aux_/block.hpp"
 #include <boost/config.hpp> // For variadic macros.
 
-#if defined(BOOST_NO_VARIADIC_MACROS)
+#if defined(BOOST_NO_VARIADIC_MACROS) || defined(BOOST_LOCAL_CONFIG_COMPLIANT)
 
 /**
  * @brief This macro starts the declaration of a local block.

Modified: sandbox/local/boost/local/config.hpp
==============================================================================
--- sandbox/local/boost/local/config.hpp (original)
+++ sandbox/local/boost/local/config.hpp 2011-03-05 19:55:44 EST (Sat, 05 Mar 2011)
@@ -13,6 +13,24 @@
 #define BOOST_LOCAL_CONFIG_HPP_
 
 /**
+ * @brief Force to use C++ standard feature only.
+ *
+ * @Note If programmers leave this macro #undefined, its default value is
+ * undefined.
+ *
+ * If this macro is defined, variadic macros and empty macro parameters are not
+ * supported.
+ * Variadic macros, are supported by most recent compilers (like MSVC and GCC)
+ * and they were first introduced by the C99 preprocessor.
+ * However, they are not part of the official ISO C++ standard.
+ *
+ * @See @RefSect{Tutorial} section.
+ */
+#ifndef BOOST_LOCAL_CONFIG_COMPLIANT
+#undef BOOST_LOCAL_CONFIG_COMPLIANT
+#endif
+
+/**
  * @brief Maximum number of function parameters supported for the local
  * functions.
  *

Modified: sandbox/local/boost/local/exit.hpp
==============================================================================
--- sandbox/local/boost/local/exit.hpp (original)
+++ sandbox/local/boost/local/exit.hpp 2011-03-05 19:55:44 EST (Sat, 05 Mar 2011)
@@ -12,11 +12,12 @@
 #ifndef BOOST_LOCAL_EXIT_HPP_
 #define BOOST_LOCAL_EXIT_HPP_
 
+#include "config.hpp"
 #include "function.hpp"
 #include "aux_/exit.hpp"
 #include <boost/config.hpp> // For variadic macros.
 
-#if defined(BOOST_NO_VARIADIC_MACROS)
+#if defined(BOOST_NO_VARIADIC_MACROS) || defined(BOOST_LOCAL_CONFIG_COMPLIANT)
 
 /**
  * @brief This macro starts the declaration of a local exit.

Modified: sandbox/local/boost/local/function.hpp
==============================================================================
--- sandbox/local/boost/local/function.hpp (original)
+++ sandbox/local/boost/local/function.hpp 2011-03-05 19:55:44 EST (Sat, 05 Mar 2011)
@@ -12,6 +12,7 @@
 #ifndef BOOST_LOCAL_FUNCTION_HPP_
 #define BOOST_LOCAL_FUNCTION_HPP_
 
+#include "config.hpp"
 #include "aux_/function_macros/params.hpp"
 #include "aux_/function_macros/name.hpp"
 #include <boost/preprocessor/facilities/empty.hpp>
@@ -22,7 +23,7 @@
 // Pass a parenthesized params seq `()()...` on C++. If variadic macros (C99,
 // GCC, MVSC, etc) you can also pass a variable length tuple `..., ...` for
 // params and nothing `` for no params.
-#if defined(BOOST_NO_VARIADIC_MACROS)
+#if defined(BOOST_NO_VARIADIC_MACROS) || defined(BOOST_LOCAL_CONFIG_COMPLIANT)
 
 #define BOOST_LOCAL_FUNCTION_PARAMS(parameter_list) \
     BOOST_LOCAL_AUX_FUNCTION_PARAMS(parameter_list, \


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk