diff --git a/source/adios2/CMakeLists.txt b/source/adios2/CMakeLists.txt index 5bc3f9c121..99b413542c 100644 --- a/source/adios2/CMakeLists.txt +++ b/source/adios2/CMakeLists.txt @@ -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() @@ -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 diff --git a/source/adios2/toolkit/derived/parser/ASTDriver.cpp b/source/adios2/toolkit/derived/parser/ASTDriver.cpp index 53871e0db8..c3afaf576f 100644 --- a/source/adios2/toolkit/derived/parser/ASTDriver.cpp +++ b/source/adios2/toolkit/derived/parser/ASTDriver.cpp @@ -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(); diff --git a/source/adios2/toolkit/derived/parser/ASTDriver.h b/source/adios2/toolkit/derived/parser/ASTDriver.h index c1f2855800..9f4b01b790 100644 --- a/source/adios2/toolkit/derived/parser/ASTDriver.h +++ b/source/adios2/toolkit/derived/parser/ASTDriver.h @@ -27,6 +27,7 @@ class ASTDriver // Defined in lexer.l void parse(const std::string input); + void destroy_lex_structures(); ASTNode *getAST(); diff --git a/source/adios2/toolkit/derived/parser/lexer.l b/source/adios2/toolkit/derived/parser/lexer.l index 566e4a41c7..ffa52ed5ce 100644 --- a/source/adios2/toolkit/derived/parser/lexer.l +++ b/source/adios2/toolkit/derived/parser/lexer.l @@ -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(); +} diff --git a/source/adios2/toolkit/derived/parser/pregen-source/lexer.cpp b/source/adios2/toolkit/derived/parser/pregen-source/lexer.cpp index 598731e63c..abc36e278f 100644 --- a/source/adios2/toolkit/derived/parser/pregen-source/lexer.cpp +++ b/source/adios2/toolkit/derived/parser/pregen-source/lexer.cpp @@ -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(); +}