|
Boost : |
From: Steve Cornett (boost_at_[hidden])
Date: 2006-02-17 16:16:23
The file boost/preprocessor/stringize.hpp contains a trivial bug, for which I have attached a proposed patch. The problem is that
there are three incorrect usages of the ## operator. The proposed fix is to simply remove the ## operators, as they are
unnecessary.
The ## operator joins two tokens and makes a new single token. But all three usages of ## in this file attempt to join an
identifier with '(', which does not result in a single token. The action taken by most C/C++ translators in this situation is to
rescan the invalid text back into two tokens, which makes the incorrect ## usage innocuous in most situations. However, the
behavior is undefined by the C++ and C standards. With our code coverage tool, this improper ## usage results in a warning.
*** stringize.hpp.orig Fri Feb 17 10:16:41 2006
--- stringize.hpp Fri Feb 17 10:18:36 2006
***************
*** 20,30 ****
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_A((text))
! # define BOOST_PP_STRINGIZE_A(arg) BOOST_PP_STRINGIZE_B ## (arg)
! # define BOOST_PP_STRINGIZE_B(arg) BOOST_PP_STRINGIZE_I ## arg
# elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_OO((text))
! # define BOOST_PP_STRINGIZE_OO(par) BOOST_PP_STRINGIZE_I ## par
# else
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_I(text)
# endif
--- 20,30 ----
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_A((text))
! # define BOOST_PP_STRINGIZE_A(arg) BOOST_PP_STRINGIZE_B(arg)
! # define BOOST_PP_STRINGIZE_B(arg) BOOST_PP_STRINGIZE_I arg
# elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_OO((text))
! # define BOOST_PP_STRINGIZE_OO(par) BOOST_PP_STRINGIZE_I par
# else
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_I(text)
# endif
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk