Boost logo

Boost Users :

From: Ellis Cohen (ellis_cohen_at_[hidden])
Date: 2002-08-29 18:42:08


Using the Boost preprocessor library, I'm getting an unexpected diagnostic from
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.

Is my use of the preprocessor library incorrect?

Ellis Cohen

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

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-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net