Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:40:31

0001 // Copyright (C) 2020 T. Zachary Laine
0002 //
0003 // Distributed under the Boost Software License, Version 1.0. (See
0004 // accompanying file LICENSE_1_0.txt or copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 #ifndef BOOST_PARSER_CONFIG_HPP
0007 #define BOOST_PARSER_CONFIG_HPP
0008 
0009 #include <boost/parser/detail/debug_assert.hpp>
0010 
0011 // Included for definition of __cpp_lib_concepts.
0012 #include <iterator>
0013 
0014 
0015 #ifdef BOOST_PARSER_DOXYGEN
0016 
0017 /** Boost.Parser uses assertions (`BOOST_ASSERT()`) in several places to
0018     indicate that your use of the library has an error in it.  All of those
0019     places could heve instead been ill-formed code, caught at compile time.
0020     It is far quicker and easier to determine exactly where in your code such
0021     an error is located if this is a runtime failure; you can just look at the
0022     stack in your favorite debugger.  However, if you want to make thes kinds
0023     of errors always ill-formed code, define this macro. */
0024 #    define BOOST_PARSER_NO_RUNTIME_ASSERTIONS
0025 
0026 /** Asserts that the given condition is true.  If
0027     `BOOST_PARSER_NO_RUNTIME_ASSERTIONS` macro is defined by the user,
0028     `BOOST_PARSER_ASSERT` expends to a compile-time `static_assert()`.
0029     Otherwise, it expands to a run-time `BOOST_ASSERT()`.  Note that defining
0030     `BOOST_DISABLE_ASSERTS` disables the use of C `assert`, even when
0031     `BOOST_ASSERT` is unavailble. */
0032 #    define BOOST_PARSER_ASSERT(condition)
0033 
0034 /** Boost.Parser will automatically use concepts to constrain templates when
0035     building in C++20 mode, if the compiler defines `__cpp_lib_concepts`.  To
0036     disable the use of concepts, define this macro. */
0037 #    define BOOST_PARSER_DISABLE_CONCEPTS
0038 
0039 /** Define this macro to use `boost::hana::tuple` instead of `std::tuple`
0040     throughout Boost.Parser. */
0041 #    define BOOST_PARSER_USE_HANA_TUPLE
0042 
0043 /** Boost.Parser automatically treats aggregate structs as if they were
0044     tuples.  It uses some metaprogramming to do this.  The technique used has
0045     a hard limit on the number of data members a struct can have.  Re-define
0046     this macro to change the hard limit.  Note that large values may increase
0047     compile times. */
0048 #    define BOOST_PARSER_MAX_AGGREGATE_SIZE 25
0049 
0050 /** The subrange template that is used throughout Boost.Parser.  This will be
0051     `boost::parser::subrange` in C++17 builds, and `std::ranges::subrange` in
0052     all other builds. */
0053 #    define BOOST_PARSER_SUBRANGE
0054 
0055 /** If you are using Visual Studio to run your program, and don't have a
0056     terminal in which to observe the output when parsing with `trace::on`,
0057     define this macro and you'll see the trace output in the Visual Studio
0058     debugger's output panel.  This macro has no effect when `_MSC_VER` is not
0059     also defined. */
0060 #    define BOOST_PARSER_TRACE_TO_VS_OUTPUT
0061 
0062 #else
0063 
0064 #    ifdef BOOST_PARSER_NO_RUNTIME_ASSERTIONS
0065 #        define BOOST_PARSER_ASSERT(condition) static_assert(condition)
0066 #    elif defined(BOOST_PARSER_HAVE_BOOST_ASSERT)
0067 #        define BOOST_PARSER_ASSERT(condition) BOOST_ASSERT(condition)
0068 #    elif BOOST_DISABLE_ASSERTS
0069 #        define BOOST_PARSER_ASSERT(condition) ((void)0)
0070 #    else
0071 #        define BOOST_PARSER_ASSERT(condition) assert(condition)
0072 #    endif
0073 
0074 #endif
0075 
0076 // Follows logic in boost/config/detail/select_compiler_config.hpp.
0077 #if defined(__clang__) && !defined(__ibmxl__) && !defined(__CODEGEARC__)
0078 #elif defined(__GNUC__) && !defined(__ibmxl__)
0079 #define BOOST_PARSER_GCC
0080 #endif
0081 
0082 #if defined(__cpp_lib_constexpr_algorithms)
0083 #    define BOOST_PARSER_ALGO_CONSTEXPR constexpr
0084 #else
0085 #    define BOOST_PARSER_ALGO_CONSTEXPR
0086 #endif
0087 
0088 #if defined(__cpp_lib_concepts) && !defined(BOOST_PARSER_DISABLE_CONCEPTS) &&  \
0089     (!defined(__clang_major__) || 16 <= __clang_major__)
0090 #    define BOOST_PARSER_USE_CONCEPTS 1
0091 #else
0092 #    define BOOST_PARSER_USE_CONCEPTS 0
0093 #endif
0094 
0095 #if defined(__cpp_lib_ranges) && BOOST_PARSER_USE_CONCEPTS
0096 #    define BOOST_PARSER_SUBRANGE std::ranges::subrange
0097 #else
0098 #    include <boost/parser/subrange.hpp>
0099 #    define BOOST_PARSER_SUBRANGE boost::parser::subrange
0100 #endif
0101 
0102 #if defined(BOOST_PARSER_USE_HANA_TUPLE)
0103 #    define BOOST_PARSER_USE_STD_TUPLE 0
0104 #else
0105 #    define BOOST_PARSER_USE_STD_TUPLE 1
0106 #endif
0107 
0108 #if !defined(BOOST_PARSER_MAX_AGGREGATE_SIZE)
0109 #    define BOOST_PARSER_MAX_AGGREGATE_SIZE 25
0110 #endif
0111 
0112 // VS2019 and VS2017 need conditional constexpr in some places, even in C++17 mode.
0113 #if !defined(_MSC_VER) || 1930 <= _MSC_VER
0114 #    define BOOST_PARSER_CONSTEXPR constexpr
0115 #else
0116 #    define BOOST_PARSER_CONSTEXPR
0117 #endif
0118 
0119 #if defined(_MSC_VER) && defined(BOOST_PARSER_TRACE_TO_VS_OUTPUT)
0120 #    define BOOST_PARSER_TRACE_OSTREAM boost::parser::detail::vs_cout
0121 #else
0122 #    define BOOST_PARSER_TRACE_OSTREAM std::cout
0123 #endif
0124 
0125 #endif