Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-10-08 15:39:41


Posted on behalf of Ellis Cohen.

/Jaakko

--------------

I'm getting an unexpected diagnostic message when using the
Boost preprocessor library. The compiler environment is the
HP-UX C++ compiler (aCC, version "HP ANSI C++ B3910B A.03.34").
The generated output -- see the last line of "Compiler output",
below -- *is* correct. I'm using Boost_1_28_0.

Can someone please help me answer whether
   . my use of the preprocessor library is incorrect
   . there a bug in aCC
   . there is a problem in the preprocessor library?

Thank you.

Ellis Cohen

========================================================================

Example code fragment triggering the diagnostic:

   #include <boost/preprocessor/cat.hpp>
   #include <boost/preprocessor/comma_if.hpp>
   #include <boost/preprocessor/repeat.hpp>
   #include <boost/preprocessor/tuple/elem.hpp>

   #define FOO0 (0, double, some_value)
   #define FOO1 (0, double, some_other_value)
   #define FOO2 (0, double, some_other_other_value)

   #define FOO_CNT 3

   #define PPV(I) FOO##I
   #define PPV_FLAG(I) BOOST_PP_TUPLE_ELEM(3,0,PPV(I))
   #define PPV_TYPE(I) BOOST_PP_TUPLE_ELEM(3,1,PPV(I))
   #define PPV_NAME(I) BOOST_PP_TUPLE_ELEM(3,2,PPV(I))

   #define BOOST_PP_DEF(I,_) BOOST_PP_COMMA_IF(I) BOOST_PP_CAT(d_,PPV_NAME(I))(BOOST_PP_CAT(other.d_,PPV_NAME(I)))
   BOOST_PP_REPEAT(FOO_CNT, BOOST_PP_DEF, _)
   #undef BOOST_PP_DEF

========================================================================

Compiler command:

   /opt/aCC/bin/aCC \
         -Iboost_includes \
         -Wc,-ansi_for_scope,on \
         -Aa \
         +inst_compiletime +inst_v \
         -E -c Isrc/boost_bug.C -o boost_bug.o

========================================================================

Compiler output:

   Warning (anachronism) 823: "Isrc/boost_bug.C", line 18 # Redundant preprocessing concatenation operation results in two
         valid preprocessing tokens. Depending on this implementation defined behavior will result in non-portable code.
       BOOST_PP_REPEAT(FOO_CNT, BOOST_PP_DEF, _)
       ^^^^^^^^^^^^^^^
   Warning (anachronism) 823: "Isrc/boost_bug.C", line 18 # Redundant preprocessing concatenation operation results in two
         valid preprocessing tokens. Depending on this implementation defined behavior will result in non-portable code.
       BOOST_PP_REPEAT(FOO_CNT, BOOST_PP_DEF, _)
       ^^^^^^^^^^^^^^^
   Warning (anachronism) 823: "Isrc/boost_bug.C", line 18 # Redundant preprocessing concatenation operation results in two
         valid preprocessing tokens. Depending on this implementation defined behavior will result in non-portable code.
       BOOST_PP_REPEAT(FOO_CNT, BOOST_PP_DEF, _)
       ^^^^^^^^^^^^^^^
   #line 1 "Isrc/boost_bug.C"
   #line 1 "boost_includes/boost/preprocessor/cat.hpp"
   #line 2 "Isrc/boost_bug.C"
   #line 1 "boost_includes/boost/preprocessor/comma_if.hpp"
   #line 1 "boost_includes/boost/preprocessor/comma.hpp"
   #line 17 "boost_includes/boost/preprocessor/comma_if.hpp"
   #line 1 "boost_includes/boost/preprocessor/empty.hpp"
   #line 18 "boost_includes/boost/preprocessor/comma_if.hpp"
   #line 1 "boost_includes/boost/preprocessor/if.hpp"
   #line 1 "boost_includes/boost/preprocessor/logical/bool.hpp"
   #line 17 "boost_includes/boost/preprocessor/if.hpp"
   #line 1 "boost_includes/boost/preprocessor/tuple/elem.hpp"
   #line 18 "boost_includes/boost/preprocessor/if.hpp"
   #line 19 "boost_includes/boost/preprocessor/comma_if.hpp"
   #line 3 "Isrc/boost_bug.C"
   #line 1 "boost_includes/boost/preprocessor/repeat.hpp"
   #line 4 "Isrc/boost_bug.C"

   #line 18
    d_some_value( other.d_some_value) , d_some_other_value( other.d_some_other_value) , d_some_other_other_value( other.d_some_other_other_value)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk