Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion include/boost/wave/util/cpp_macromap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,8 @@ macromap<ContextT>::rescan_replacement_list(token_type const &curr_token,
typename ContainerT::iterator begin_it = replacement_list.begin();
typename ContainerT::iterator end_it = replacement_list.end();

// An object-like macro's replacement list does not contain the tokens
// following its invocation, which may complete __has_include(...).
expand_whole_tokensequence(
expanded, begin_it, end_it,
expand_operator_defined, expand_operator_has_include);
Expand Down Expand Up @@ -1643,7 +1645,8 @@ macromap<ContextT>::expand_macro(ContainerT &expanded,
rescan_replacement_list(
curr_token, macro_def, replacement_list,
expanded_list, expand_operator_defined,
expand_operator_has_include, first, last);
expand_operator_has_include && macro_def.is_functionlike,
first, last);

ctx.get_hooks().rescanned_macro(ctx.derived(), expanded_list);

Expand Down
34 changes: 34 additions & 0 deletions test/testwave/testfiles/t_2_034.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
http://www.boost.org/

Copyright (c) 2026 Martin Medler. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/

// An object like macro can be used as alias to the special macro __has_include

//O --c++17
//O -Werror

// point system path to this directory
//O -S.

#define HAS_INCLUDE __has_include
#if HAS_INCLUDE(<t_2_034.cpp>)
#define FOUND_SELF_VIA_ALIAS
#else
#warning has_include could not find this file through an alias
#endif

//H 10: t_2_034.cpp(18): #define
//H 08: t_2_034.cpp(18): HAS_INCLUDE=__has_include
//H 10: t_2_034.cpp(19): #if
//H 01: t_2_034.cpp(18): HAS_INCLUDE
//H 02: __has_include
//H 03: __has_include
//H 11: t_2_034.cpp(19): #if HAS_INCLUDE(<t_2_034.cpp>): 1
//H 10: t_2_034.cpp(20): #define
//H 08: t_2_034.cpp(20): FOUND_SELF_VIA_ALIAS=
//H 10: t_2_034.cpp(21): #else
34 changes: 34 additions & 0 deletions test/testwave/testfiles/t_2_035.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
http://www.boost.org/

Copyright (c) 2026 Martin Medler. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/

// A function like macro can be used as alias to the special macro __has_include

//O --c++17
//O -Werror

// point system path to this directory
//O -S.

#define HAS_INCLUDE(x) __has_include(x)
#if HAS_INCLUDE(<t_2_035.cpp>)
#define FOUND_SELF_VIA_ALIAS
#else
#warning has_include could not find this file through an alias
#endif

//H 10: t_2_035.cpp(18): #define
//H 08: t_2_035.cpp(18): HAS_INCLUDE(x)=__has_include(x)
//H 10: t_2_035.cpp(19): #if
//H 00: t_2_035.cpp(19): HAS_INCLUDE(<t_2_035.cpp>), [t_2_035.cpp(18): HAS_INCLUDE(x)=__has_include(x)]
//H 02: __has_include(<t_2_035.cpp>)
//H 03: 1
//H 11: t_2_035.cpp(19): #if HAS_INCLUDE(<t_2_035.cpp>): 1
//H 10: t_2_035.cpp(20): #define
//H 08: t_2_035.cpp(20): FOUND_SELF_VIA_ALIAS=
//H 10: t_2_035.cpp(21): #else
2 changes: 2 additions & 0 deletions test/testwave/testfiles/test.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ t_2_030.cpp
t_2_031.cpp
t_2_032.cpp
t_2_033.cpp
t_2_034.cpp
t_2_035.cpp

#
# t_3: Predefined macros
Expand Down
Loading