Skip to content

deBOOST #150: remove boost::wave compile-time dependency#163

Merged
yanyh15 merged 8 commits into
devfrom
issue/150
Jul 2, 2026
Merged

deBOOST #150: remove boost::wave compile-time dependency#163
yanyh15 merged 8 commits into
devfrom
issue/150

Conversation

@yanyh15

@yanyh15 yanyh15 commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Defines ROSE_SKIP_COMPILATION_OF_WAVE 1 in rose_attributes_list.h as the single change that removes the compile-time libboost_wave dependency from librose.so
  • Removes #include <boost/wave.hpp> and #include <boost/wave/cpplexer/cpp_lex_token.hpp> from the header
  • Adds a minimal RoseToken struct as a clean, self-documenting replacement for boost::wave::cpplexer::lex_token<> — same public API (get_value(), get_position().get_file/line/column())
  • Moves token_type / token_container typedefs outside the wave guard so they remain stable public types

Background

The boost::wave preprocessor runtime path was commented out in 2020 (see attachPreprocessingInfo.C:385). All wave-specific code throughout the codebase is already gated behind #ifndef ROSE_SKIP_COMPILATION_OF_WAVE guards. This PR defines that macro, making those guards take effect.

src/Makefile.am already lacks $(BOOST_WAVE_LIB) in librose_la_LIBADD (prior cleanup). After this source change + rebuild, ldd librose.so | grep wave will return nothing.

Dead code left for follow-up

The #ifndef ROSE_SKIP_COMPILATION_OF_WAVE blocks in:

  • rose_attributes_list.h (wave member vars, wave constructors)
  • rose_attributes_list.C (wave constructor implementations)
  • attachPreprocessingInfo.C (wave runtime path)
  • doCompleteMapping.C / unparseMacro.C / sageInterface.C

…can all be removed in a follow-up cleanup PR. They are now unreachable dead code.

Test plan

  • Build librose.so from this branch: make -C src -j$(nproc)
  • Verify no wave linkage: ldd librose.so | grep wave → empty
  • Smoke test: rose-compiler --rose:openmp:lowering hello_omp.c
  • CI passes

Closes #150

yanyh15 added 8 commits June 30, 2026 22:29
Define ROSE_SKIP_COMPILATION_OF_WAVE in rose_attributes_list.h so that
all #ifndef ROSE_SKIP_COMPILATION_OF_WAVE guards across the codebase
exclude the wave-specific code from compilation. The wave runtime path
has been disabled since 2020 (see attachPreprocessingInfo.C:385), so
those code blocks are already dead; this commit removes the compile-time
dependency so librose.so no longer links libboost_wave.

Changes in rose_attributes_list.h:
- Define ROSE_SKIP_COMPILATION_OF_WAVE 1 at the top of the file
- Remove #include <boost/wave.hpp> and #include <boost/wave/cpplexer/cpp_lex_token.hpp>
- Add #include <string>, <vector>, <list> (formerly implicit via boost/wave)
- Add minimal RoseToken struct as a clean API replacement for
  boost::wave::cpplexer::lex_token<> (value + position, same accessors)
- Move token_type / token_container / token_list_container /
  token_container_container typedefs outside the wave guard so they
  remain available as stable public types
- Remove extern token_container wave_tokenStream (dead wave global)
Now that ROSE_SKIP_COMPILATION_OF_WAVE gates are no longer needed
(the macro itself is removed along with all guarded blocks), clean up
the dead wave code throughout the codebase.

Deleted files (pure wave code):
- src/frontend/SageIII/advanced_preprocessing_hooks.h
- src/frontend/SageIII/attributeListMap.h
- src/frontend/SageIII/attributeListMap.C

Removed #ifndef ROSE_SKIP_COMPILATION_OF_WAVE blocks from:
- rose_attributes_list.h: wave member vars, wave constructors, wave accessors
- rose_attributes_list.C: all 15 wave function implementations
- attachPreprocessingInfo.C: wave typedefs, wave includes, wave runtime branch
- astTokenStream/doCompleteMapping.{h,C}: wave separator functions
- astTokenStream/createMap.{h,C}: wave token stream constructor/accessor
- astTokenStream/unparseMacro.C: wave macro expansion block
- sageInterface/sageInterface.C: wave macro call expansion

Build system:
- Makefile.am: remove attributeListMap.C from libsage3Sources;
  remove dead header refs from EXTRA_DIST
- config/support-rose.m4: remove --with-wave-default configure option
…in ROSETTA

CMakeLists.txt was still listing attributeListMap.C (deleted in the
dead-code cleanup) causing a CMake error in CI. Remove it from
SAGE3_SOURCES.

Support.code had a ROSE_SKIP_COMPILATION_OF_WAVE define and a guarded
boost::wave block that was emitted verbatim into the generated
Cxx_Grammar.h. After the cleanup commit removed the macro definition
from rose_attributes_list.h, the guard evaluated true and caused a
build failure. Remove both the define and the boost::wave block;
regenerate Cxx_Grammar.h from the fixed template.

Verified locally: rose_attributes_list.lo and attachPreprocessingInfo.lo
compile cleanly after Cxx_Grammar.h regeneration.
ROSE_WAVE_DEFAULT was generated by the --with-wave-default configure
option in support-rose.m4, which was removed as part of the wave
cleanup. Replace the single usage with a literal false so that wave
is always off by default (user can still pass -rose:wave explicitly,
which will hit the ROSE_ABORT in attachPreprocessingInfo.C).
Wave support is gone, so there is no point keeping the -rose:wave
command-line option or any of its downstream state:

- cmdline.cpp: remove both isOption("-rose:wave") parsing blocks
  (SgFile and SgProject), along with the verbose get_wave() prints
- attachPreprocessingInfo.C: remove the dead get_wave() guard block
  and the usingWave local variable; simplify the call to
  buildCommentAndCppDirectiveList (drop the bool argument)
- attachPreprocessingInfoTraversal.h: remove the use_Wave member
  and drop bool use_Wave from the buildCommentAndCppDirectiveList
  signature
- attachPreprocessingInfoTraversal.C: remove use_Wave from the
  constructor and display(); drop bool use_Wave from the function
  definition; delete the dead else branch (use_Wave == true path)

Compiled and verified locally.
All remaining boost dependencies in src/ were dead code or build
artifacts with no actual usage:

Source files — remove unused includes:
- rtiHelpers.h: drop boost/lexical_cast.hpp (never called)
- rose_attributes_list.C: drop boost/algorithm/string/case_conv.hpp
  (Ada case comment, no actual to_lower/to_upper calls)
- attachPreprocessingInfo.C: drop boost/filesystem.hpp (comment said
  "exists()" but no boost::filesystem calls exist; std::filesystem
  is already included via FileSystem.h)

Build system — remove stale BOOST_CPPFLAGS / BOOST_THREAD_LIB:
- src/util/support/Makefile.am: none of the support sources include
  any boost header, so the thread flags served no purpose
- src/util/graphs/Makefile.am: same
- src/ROSETTA/src/CMakeLists.txt: ROSETTA sources use no boost
  headers; drop Boost_LIBRARIES from link_libs

FileHelper.h — replace legacy variable names and unqualified calls:
- Rename boostPath variables to inline std::filesystem::path(...)
- Qualify unqualified create_directories/remove_all calls with
  std::filesystem:: (C++17, already required)
- Remove the stale comment block about BOOST_FILESYSTEM_VERSION

Compiled and verified locally (rose_attributes_list.lo,
attachPreprocessingInfo.lo).
Build system:
- src/frontend/SageIII/virtualCFG/Makefile.am: remove $(BOOST_CPPFLAGS)
- exampleTranslators/*/CMakeLists.txt: remove ${Boost_LIBRARIES} from
  target_link_libraries (no find_package(Boost) ran, so already empty)
- tutorial/CMakeLists.txt, tutorial/outliner/CMakeLists.txt: same
- tests/nonsmoke/functional/CMakeLists.txt: remove ${Boost_INCLUDE_DIRS}
- tests/.../CompileTests/CMakeLists.txt: same
- tests/.../copyAST_tests/CMakeLists.txt: remove ${Boost_LIBRARIES}
- tests/.../translatorTests/CMakeLists.txt: remove ${Boost_INCLUDE_DIRS}

Test programs — migrate from boost to C++17:
- tests/smoke/unit/Utility/testBitOps.C: drop boost/lexical_cast.hpp,
  replace boost::lexical_cast<std::string>(x) with std::to_string(x)
- tests/smoke/unit/Utility/testToNumber.C: same
- tests/.../testFileNamesAndExtensions/translator.C: remove unused
  boost/algorithm and boost/filesystem includes (no functions called)

Remove parallelASTMerge.C:
- tests/nonsmoke/functional/parallelASTMerge.C: delete; never wired
  into any Makefile.am or CMakeLists.txt target; depends on
  boost::thread/mutex/filesystem which we are removing.

Note: libboost-all-dev removal from .github/workflows/cmake.yml is
in a separate commit (requires PAT workflow scope).
ROSE no longer requires boost at compile time. All boost headers and
link-time dependencies have been removed from src/. Remove
libboost-all-dev from the CI apt install list to verify this.
@yanyh15
yanyh15 merged commit 80e7ab7 into dev Jul 2, 2026
2 checks passed
@yanyh15
yanyh15 deleted the issue/150 branch July 2, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant