]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES) |
2 | ||
3 | #if BOOST_WORKAROUND(__GNUC__, == 3) || (BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0) | |
4 | #include <boost/proto/transform/detail/preprocessed/make_gcc_workaround.hpp> | |
5 | #endif | |
6 | ||
7 | #elif !defined(BOOST_PP_IS_ITERATING) | |
8 | ||
9 | #define BOOST_PROTO_EXPR_MAKE_ARG(Z, M, DATA) \ | |
10 | detail::as_lvalue( \ | |
11 | typename when<_, BOOST_PP_CAT(A, M)>::template impl<Expr, State, Data>()(e, s, d) \ | |
12 | ) \ | |
13 | /**/ | |
14 | ||
15 | #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) | |
16 | #pragma wave option(preserve: 2, line: 0, output: "preprocessed/make_gcc_workaround.hpp") | |
17 | #endif | |
18 | ||
19 | /////////////////////////////////////////////////////////////////////////////// | |
20 | /// \file make_gcc_workaround.hpp | |
21 | /// Special workaround code to make the make\<\> transform work on certain | |
22 | /// versions of gcc. | |
23 | // | |
24 | // Copyright 2008 Eric Niebler. Distributed under the Boost | |
25 | // Software License, Version 1.0. (See accompanying file | |
26 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
27 | ||
28 | #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) | |
29 | #pragma wave option(preserve: 1) | |
30 | #endif | |
31 | ||
32 | #if BOOST_WORKAROUND(__GNUC__, == 3) || (BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0) || \ | |
33 | (defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)) | |
34 | ||
35 | #define BOOST_PP_ITERATION_PARAMS_1 \ | |
36 | (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/make_gcc_workaround.hpp>)) | |
37 | #include BOOST_PP_ITERATE() | |
38 | ||
39 | #endif | |
40 | ||
41 | #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) | |
42 | #pragma wave option(output: null) | |
43 | #endif | |
44 | ||
45 | #undef BOOST_PROTO_EXPR_MAKE_ARG | |
46 | ||
47 | #else | |
48 | ||
49 | #define N BOOST_PP_ITERATION() | |
50 | ||
51 | // work around GCC bug | |
52 | template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> | |
53 | struct make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> | |
54 | : transform<make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> > | |
55 | { | |
56 | template<typename Expr, typename State, typename Data> | |
57 | struct impl : transform_impl<Expr, State, Data> | |
58 | { | |
59 | typedef proto::expr<Tag, Args, Arity> result_type; | |
60 | ||
61 | BOOST_FORCEINLINE | |
62 | result_type operator ()( | |
63 | typename impl::expr_param e | |
64 | , typename impl::state_param s | |
65 | , typename impl::data_param d | |
66 | ) const | |
67 | { | |
68 | return proto::expr<Tag, Args, Arity>::make( | |
69 | BOOST_PP_ENUM(N, BOOST_PROTO_EXPR_MAKE_ARG, DATA) | |
70 | ); | |
71 | } | |
72 | }; | |
73 | }; | |
74 | ||
75 | template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> | |
76 | struct make<proto::basic_expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> | |
77 | : transform<make<proto::basic_expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> > | |
78 | { | |
79 | template<typename Expr, typename State, typename Data> | |
80 | struct impl : transform_impl<Expr, State, Data> | |
81 | { | |
82 | typedef proto::basic_expr<Tag, Args, Arity> result_type; | |
83 | ||
84 | BOOST_FORCEINLINE | |
85 | result_type operator ()( | |
86 | typename impl::expr_param e | |
87 | , typename impl::state_param s | |
88 | , typename impl::data_param d | |
89 | ) const | |
90 | { | |
91 | return proto::basic_expr<Tag, Args, Arity>::make( | |
92 | BOOST_PP_ENUM(N, BOOST_PROTO_EXPR_MAKE_ARG, DATA) | |
93 | ); | |
94 | } | |
95 | }; | |
96 | }; | |
97 | ||
98 | #undef N | |
99 | ||
100 | #endif |