Skip to content

Commit fa79511

Browse files
committed
fix use of __GNUC__ for gcc detection
1 parent 57cdd78 commit fa79511

File tree

8 files changed

+27
-15
lines changed

8 files changed

+27
-15
lines changed

include/boost/parser/detail/printing_impl.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33

44
#include <boost/parser/detail/printing.hpp>
55

6+
#include <boost/config.hpp>
7+
68
#if __has_include(<boost/type_index.hpp>)
7-
#if defined(__GNUC__) || defined(__clang__)
9+
#if defined(BOOST_GCC) || defined(__clang__)
810
#pragma GCC diagnostic push
911
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1012
#endif
1113
#include <boost/type_index.hpp>
1214
#define BOOST_PARSER_HAVE_BOOST_TYPEINDEX 1
1315
#define BOOST_PARSER_TYPE_NAME_NS boost_type_index
14-
#if defined(__GNUC__) || defined(__clang__)
16+
#if defined(BOOST_GCC) || defined(__clang__)
1517
#pragma GCC diagnostic pop
1618
#endif
1719
#else

include/boost/parser/detail/stl_interfaces/view_adaptor.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <boost/parser/detail/detection.hpp>
1313

14+
#include <boost/config.hpp>
1415
#include <tuple>
1516
#include <type_traits>
1617

@@ -24,8 +25,9 @@
2425
#define BOOST_PARSER_USE_CPP23_STD_RANGE_ADAPTOR_CLOSURE 0
2526
#endif
2627

27-
#if !BOOST_PARSER_USE_CPP23_STD_RANGE_ADAPTOR_CLOSURE && \
28-
BOOST_PARSER_DETAIL_STL_INTERFACES_USE_CONCEPTS && defined(__GNUC__) && 12 <= __GNUC__
28+
#if !BOOST_PARSER_USE_CPP23_STD_RANGE_ADAPTOR_CLOSURE && \
29+
BOOST_PARSER_DETAIL_STL_INTERFACES_USE_CONCEPTS && \
30+
defined(BOOST_LIBSTDCXX_VERSION) && 13000 > BOOST_LIBSTDCXX_VERSION
2931
#define BOOST_PARSER_USE_LIBSTDCPP_GCC12_RANGE_ADAPTOR_CLOSURE 1
3032
#else
3133
#define BOOST_PARSER_USE_LIBSTDCPP_GCC12_RANGE_ADAPTOR_CLOSURE 0

include/boost/parser/detail/text/detail/all_t.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <boost/parser/detail/text/detail/begin_end.hpp>
1111
#include <boost/parser/detail/detection.hpp>
1212

13+
#include <boost/config.hpp>
1314
#include <array>
1415
#if BOOST_PARSER_USE_CONCEPTS
1516
#include <ranges>
@@ -42,7 +43,8 @@ namespace boost::parser::detail::text::detail {
4243
template<typename R>
4344
constexpr bool view =
4445
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS || \
45-
(defined(__cpp_lib_concepts) && (!defined(__GNUC__) || 12 <= __GNUC__))
46+
(defined(__cpp_lib_concepts) && \
47+
!(defined(BOOST_LIBSTDCXX_VERSION) && 13000 > BOOST_LIBSTDCXX_VERSION))
4648
std::ranges::view<R>
4749
#else
4850
range_<R> && !container_<R> &&

include/boost/parser/parser.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <boost/parser/detail/text/trie_map.hpp>
2222
#include <boost/parser/detail/text/unpack.hpp>
2323

24+
#include <boost/config.hpp>
2425
#include <type_traits>
2526
#include <variant>
2627
#include <vector>
@@ -9539,7 +9540,7 @@ namespace boost { namespace parser {
95399540
{
95409541
// This code chokes older GCCs. I can't figure out why, and this
95419542
// is an optional check, so I'm disabling it for those GCCs.
9542-
#if !defined(__GNUC__) || 13 <= __GNUC__
9543+
#if !(defined(BOOST_GCC) && 13 <= __GNUC__)
95439544
using context_t = parse_context<
95449545
false,
95459546
false,

include/boost/parser/transform_replace.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
#include <boost/parser/replace.hpp>
55

6+
#include <boost/config.hpp>
7+
68
#if (!defined(_MSC_VER) || BOOST_PARSER_USE_CONCEPTS) && \
7-
(!defined(__GNUC__) || 12 <= __GNUC__ || !BOOST_PARSER_USE_CONCEPTS)
9+
(!(defined(BOOST_GCC) && 12 <= __GNUC__) || !BOOST_PARSER_USE_CONCEPTS)
810

911

1012
namespace boost::parser {

include/boost/parser/tuple.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@
1212

1313
#if BOOST_PARSER_USE_STD_TUPLE
1414

15+
#include <boost/config.hpp>
1516
#include <tuple>
1617

1718
#else
1819

1920
// Silence very verbose warnings about std::is_pod/std::is_literal being
2021
// deprecated.
21-
#if defined(__GNUC__) || defined(__clang__)
22+
#if defined(BOOST_GCC) || defined(__clang__)
2223
# pragma GCC diagnostic push
2324
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2425
# pragma GCC diagnostic ignored "-Wunused-value"
2526
#endif
2627
#include <boost/hana.hpp>
27-
#if defined(__GNUC__) || defined(__clang__)
28+
#if defined(BOOST_GCC) || defined(__clang__)
2829
# pragma GCC diagnostic pop
2930
#endif
3031

@@ -185,7 +186,7 @@ namespace boost { namespace parser {
185186
template<typename T>
186187
operator T() const && noexcept
187188
{
188-
#if defined(__GNUC__) && __GNUC__ < 13
189+
#if defined(BOOST_GCC) && __GNUC__ < 13
189190
// Yuck.
190191
std::remove_reference_t<T> * ptr = nullptr;
191192
ptr += 1; // warning mitigation

test/replace.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <boost/parser/replace.hpp>
1010

11+
#include <boost/config.hpp>
1112
#include <boost/core/lightweight_test.hpp>
1213

1314
#include "ill_formed.hpp"
@@ -134,7 +135,7 @@ int main()
134135
}
135136
BOOST_TEST(count == 4);
136137
}
137-
#if !defined(__GNUC__) || 12 <= __GNUC__
138+
#if !(defined(BOOST_LIBSTDCXX_VERSION) && 13000 > BOOST_LIBSTDCXX_VERSION)
138139
// Older GCCs don't like the use of temporaries like the
139140
// std::string("foo") below.
140141
{
@@ -380,7 +381,7 @@ int main()
380381
}
381382
}
382383

383-
#if BOOST_PARSER_USE_CONCEPTS && (!defined(__GNUC__) || 12 <= __GNUC__)
384+
#if BOOST_PARSER_USE_CONCEPTS && !(defined(BOOST_LIBSTDCXX_VERSION) && 13000 > BOOST_LIBSTDCXX_VERSION)
384385
// Older GCCs don't like the use of temporaries like the std::string("foo")
385386
// below. This causes | join to break.
386387
// join_compat)
@@ -453,7 +454,7 @@ int main()
453454
std::cout << "\n";
454455
assert(count == 3);
455456
}
456-
#if BOOST_PARSER_USE_CONCEPTS && (!defined(__GNUC__) || 12 <= __GNUC__)
457+
#if BOOST_PARSER_USE_CONCEPTS && !(defined(BOOST_LIBSTDCXX_VERSION) && 13000 > BOOST_LIBSTDCXX_VERSION)
457458
{
458459
namespace bp = boost::parser;
459460
auto card_number = bp::int_ >> bp::repeat(3)['-' >> bp::int_];

test/transform_replace.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88

99
#include <boost/parser/transform_replace.hpp>
1010

11+
#include <boost/config.hpp>
1112
#include <boost/core/lightweight_test.hpp>
1213

1314
#include "ill_formed.hpp"
1415

1516
#include <list>
1617

1718
#if (!defined(_MSC_VER) || BOOST_PARSER_USE_CONCEPTS) && \
18-
(!defined(__GNUC__) || 12 <= __GNUC__ || !BOOST_PARSER_USE_CONCEPTS)
19+
(!(defined(BOOST_GCC) && 12 <= __GNUC__) || !BOOST_PARSER_USE_CONCEPTS)
1920

2021
namespace bp = boost::parser;
2122

@@ -681,7 +682,7 @@ int main()
681682
}
682683
}
683684

684-
#if BOOST_PARSER_USE_CONCEPTS && (!defined(__GNUC__) || 12 <= __GNUC__)
685+
#if BOOST_PARSER_USE_CONCEPTS && !(defined(BOOST_LIBSTDCXX_VERSION) && 13000 > BOOST_LIBSTDCXX_VERSION)
685686
// Older GCCs don't like the use of temporaries like the std::string("foo")
686687
// below. This causes | join to break.
687688
// join_compat)

0 commit comments

Comments
 (0)