Skip to content

Commit

Permalink
Merge pull request #194 from boostorg/develop
Browse files Browse the repository at this point in the history
Changes for 1.84
  • Loading branch information
jefftrull authored Oct 26, 2023
2 parents 0e0c35e + abe718a commit e02cda6
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 13 deletions.
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Generated by `boostdep --cmake wave`
# Copyright 2020 Peter Dimov
# Copyright 2020, 2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt

cmake_minimum_required(VERSION 3.5...3.16)
cmake_minimum_required(VERSION 3.8...3.20)

project(boost_wave VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)

add_library(boost_wave
src/instantiate_cpp_exprgrammar.cpp
src/instantiate_cpp_grammar.cpp
src/instantiate_cpp_literalgrs.cpp
src/instantiate_re2c_lexer.cpp
src/token_ids.cpp
src/instantiate_defined_grammar.cpp
src/instantiate_cpp_literalgrs.cpp
src/instantiate_cpp_exprgrammar.cpp
src/instantiate_has_include_grammar.cpp
src/instantiate_predef_macros.cpp
src/instantiate_re2c_lexer.cpp
src/instantiate_re2c_lexer_str.cpp
src/token_ids.cpp
src/instantiate_cpp_grammar.cpp
src/wave_config_constant.cpp

src/cpplexer/re2clex/aq.cpp
Expand All @@ -34,6 +34,7 @@ target_link_libraries(boost_wave
Boost::config
Boost::core
Boost::filesystem
Boost::format
Boost::iterator
Boost::lexical_cast
Boost::mpl
Expand All @@ -49,6 +50,8 @@ target_link_libraries(boost_wave
Boost::type_traits
)

target_compile_features(boost_wave PUBLIC cxx_std_11)

target_compile_definitions(boost_wave
PUBLIC BOOST_WAVE_NO_LIB
PRIVATE BOOST_WAVE_SOURCE
Expand Down
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ TODO (known issues):

CHANGELOG

Boost V1.84:
- Fixed #188: Segmentation fault when "#pragma\n" is encountered

Boost V1.82:
- Fixed #182: cpp_re.hpp has a memmove that passes 0/null as arguments

Expand Down
6 changes: 2 additions & 4 deletions include/boost/wave/util/cpp_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2427,10 +2427,9 @@ pp_iterator_functor<ContextT>::on_pragma(
const_tree_iterator_t last = make_ref_transform_iterator(end, get_value);

expanded.push_back(result_type(T_PP_PRAGMA, "#pragma", act_token.get_position()));
expanded.push_back(result_type(T_SPACE, " ", act_token.get_position()));

while (++first != last && IS_CATEGORY(*first, WhiteSpaceTokenType))
expanded.push_back(*first); // skip whitespace
while (first != last && IS_CATEGORY(*first, WhiteSpaceTokenType))
expanded.push_back(*first++); // skip whitespace

if (first != last) {
if (T_IDENTIFIER == token_id(*first) &&
Expand All @@ -2456,7 +2455,6 @@ pp_iterator_functor<ContextT>::on_pragma(
#endif
}
}
expanded.push_back(result_type(T_NEWLINE, "\n", act_token.get_position()));

// the queues should be empty at this point
BOOST_ASSERT(unput_queue.empty());
Expand Down
20 changes: 18 additions & 2 deletions include/boost/wave/util/filesystem_compatibility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,32 @@ namespace boost { namespace wave { namespace util
inline std::string leaf(boost::filesystem::path const& p)
{
#if BOOST_FILESYSTEM_VERSION >= 3
#if BOOST_VERSION >= 108400
return p.filename().string();
#else
return p.leaf().string();
#endif
#else
return p.leaf();
#endif
}

inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
{
#if BOOST_FILESYSTEM_VERSION >= 3 && BOOST_VERSION >= 108400
return p.parent_path();
#else
return p.branch_path();
#endif
}

inline boost::filesystem::path normalize(boost::filesystem::path& p)
{
#if BOOST_FILESYSTEM_VERSION >= 3 && BOOST_VERSION >= 108400
return p.lexically_normal().make_preferred();
#else
return p.normalize().make_preferred();
#endif
}

inline std::string native_file_string(boost::filesystem::path const& p)
Expand All @@ -75,7 +87,9 @@ namespace boost { namespace wave { namespace util
boost::filesystem::path const& p)
{
#if BOOST_FILESYSTEM_VERSION >= 3
#if BOOST_VERSION >= 105000
#if BOOST_VERSION >= 108400
return boost::filesystem::absolute(p, initial_path());
#elif BOOST_VERSION >= 105000
return boost::filesystem::complete(p, initial_path());
#else
return boost::filesystem3::complete(p, initial_path());
Expand All @@ -89,7 +103,9 @@ namespace boost { namespace wave { namespace util
boost::filesystem::path const& p, boost::filesystem::path const& base)
{
#if BOOST_FILESYSTEM_VERSION >= 3
#if BOOST_VERSION >= 105000
#if BOOST_VERSION >= 108400
return boost::filesystem::absolute(p, base);
#elif BOOST_VERSION >= 105000
return boost::filesystem::complete(p, base);
#else
return boost::filesystem3::complete(p, base);
Expand Down
5 changes: 5 additions & 0 deletions test/testwave/testfiles/t_2_006.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
//R #line 25 "t_2_006.cpp"
//R #pragma STDC preprocessed pragma body
#pragma STDC PRAGMA_BODY
// also test pragma without a body (allowed per https://eel.is/c++draft/cpp.pragma)
//R #line 29 "t_2_006.cpp"
//R #pragma
#pragma

//H 10: t_2_006.cpp(12): #define
//H 08: t_2_006.cpp(12): PRAGMA_BODY=preprocessed pragma body
Expand All @@ -36,3 +40,4 @@
//H 01: t_2_006.cpp(12): PRAGMA_BODY
//H 02: preprocessed pragma body
//H 03: preprocessed pragma body
//H 10: t_2_006.cpp(29): #pragma

0 comments on commit e02cda6

Please sign in to comment.