Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing parser/lexer related errors #4293

Merged
merged 7 commits into from
Aug 8, 2024
Merged
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
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 @@ -154,3 +154,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();
}
5 changes: 5 additions & 0 deletions source/adios2/toolkit/derived/parser/pregen-source/lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1905,3 +1905,8 @@ adios2::detail::ASTDriver::parse (const std::string input)
parse ();
}

void
adios2::detail::ASTDriver::destroy_lex_structures ()
{
yylex_destroy();
}
8 changes: 8 additions & 0 deletions source/adios2/toolkit/format/bp5/BP5Deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,14 @@ void BP5Deserializer::FinalizeDerivedGets(std::vector<ReadRequest> &Reads)
CoreDims(), CoreDims(), CoreDims(), false, Req.MemSpace);
free(std::get<0>(DBlock));
}
// free the temporary blocks malloc'd in generateReadRequests
for (auto &entry : *nameToVarInfo)
{
for (auto &mbi : entry.second->BlocksInfo)
{
free(mbi.BufferP);
}
}
delete nameToVarInfo;
}
#endif
Expand Down