Skip to content

Commit

Permalink
Merge pull request ornladios#4293 from anagainaru/check_parser_lexer
Browse files Browse the repository at this point in the history
Fixing parser/lexer related errors

(cherry picked from commit ce65895)
  • Loading branch information
anagainaru authored and vicentebolea committed Oct 24, 2024
1 parent d3cd941 commit bd53291
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
12 changes: 7 additions & 5 deletions source/adios2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ if (ADIOS2_HAVE_Derived_Variable)
find_package(BISON "3.8.2")
find_package(FLEX)

if(NOT BISON_FOUND OR NOT FLEX_FOUND)
if(NOT BISON_FOUND OR NOT FLEX_FOUND OR (NOT BISON_VERSION VERSION_GREATER_EQUAL "3.8.2"))
include(ADIOSBisonFlexSub)
SETUP_ADIOS_BISON_FLEX_SUB()
else()
Expand All @@ -155,13 +155,15 @@ if (ADIOS2_HAVE_Derived_Variable)
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/lexer.h)
ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp PROPERTIES COMPILE_FLAGS -Wno-sign-compare)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/parser.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/parser.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM")
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/parser.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
SET_SOURCE_FILES_PROPERTIES(toolkit/derived/Expression.cpp toolkit/derived/Function.cpp PROPERTIES COMPILE_FLAGS "/wd4005 /wd4065 /wd4267 -DYY_NO_UNISTD_H")
endif()
add_library(adios2_core_derived
Expand Down
1 change: 1 addition & 0 deletions source/adios2/toolkit/derived/parser/ASTDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ASTDriver::ASTDriver(const std::string input) { ASTDriver::parse(input); }

ASTDriver::~ASTDriver()
{
ASTDriver::destroy_lex_structures();
while (holding.size() > 0)
{
delete holding.top();
Expand Down
1 change: 1 addition & 0 deletions source/adios2/toolkit/derived/parser/ASTDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ASTDriver

// Defined in lexer.l
void parse(const std::string input);
void destroy_lex_structures();

ASTNode *getAST();

Expand Down
6 changes: 6 additions & 0 deletions source/adios2/toolkit/derived/parser/lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,9 @@ adios2::detail::ASTDriver::parse (const std::string input)
parse.set_debug_level (trace_parsing);
parse ();
}

void
adios2::detail::ASTDriver::destroy_lex_structures ()
{
yylex_destroy();
}
6 changes: 6 additions & 0 deletions source/adios2/toolkit/derived/parser/pregen-source/lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,3 +1903,9 @@ adios2::detail::ASTDriver::parse (const std::string input)
parse.set_debug_level (trace_parsing);
parse ();
}

void
adios2::detail::ASTDriver::destroy_lex_structures ()
{
yylex_destroy();
}

0 comments on commit bd53291

Please sign in to comment.