diff --git a/CMakeLists.txt b/CMakeLists.txt index b5c9f95..9519637 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,10 +12,9 @@ else() endif() if(COMPILER_SUPPORTS_CXX20) set(CMAKE_CXX_STANDARD 20) - add_definitions(-DGDB_SUPPORT=1) + add_definitions(-DTH_GDB_SUPPORT=1) else() set(CMAKE_CXX_STANDARD 11) - message(WARNING "Compiler ${CMAKE_CXX_COMPILER} has no C++20 support, will disable GDB vartype support.") endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -23,7 +22,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8 ") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wextra -Werror=write-strings -Werror=redundant-decls -Werror=format -Werror=format-security -Werror=date-time -Werror=return-type -Werror=pointer-arith -Winit-self ") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wextra -Werror=write-strings -Werror=redundant-decls -Werror=format -Werror=format-security -Werror=date-time -Werror=return-type -Werror=pointer-arith -Winit-self -Wno-unused-parameter ") endif() file(GLOB HEADER_FILES "src/*.h" "src/TypeHandlers/*.h") diff --git a/Makefile b/Makefile index 585d3e9..86a8b33 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CXXFLAGS := -O3 -std=c++2a -DGDB_SUPPORT=1 -W -Wall -Wextra -Werror=write-strings -Werror=redundant-decls -Werror=format -Werror=format-security -Werror=date-time -Werror=return-type -Werror=pointer-arith -Winit-self +CXXFLAGS := -O3 -std=c++2a -DTH_GDB_SUPPORT=1 -W -Wall -Wextra -Werror=write-strings -Werror=redundant-decls -Werror=format -Werror=format-security -Werror=date-time -Werror=return-type -Werror=pointer-arith -Winit-self SOURCES_COMMON := $(wildcard src/*.cpp) $(wildcard src/TypeHandlers/*.cpp) diff --git a/Makefile.emscripten b/Makefile.emscripten index 55e1ff8..10b2b54 100644 --- a/Makefile.emscripten +++ b/Makefile.emscripten @@ -3,7 +3,7 @@ CXX := em++ # Emscripten stuff EMFLAGS := --bind --memory-init-file 0 -s WASM=1 -s MODULARIZE=1 -s EXPORT_ES6=1 -s EXPORT_NAME="'TIVarsLib'" -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=0 -s DISABLE_EXCEPTION_CATCHING=1 -s EXPORTED_RUNTIME_METHODS="['FS']" --embed-file programs_tokens.csv -CXXFLAGS := -O3 -flto -std=c++2a -DGDB_SUPPORT=1 -W -Wall -Wextra +CXXFLAGS := -O3 -flto -std=c++2a -DTH_GDB_SUPPORT=1 -W -Wall -Wextra LFLAGS := -flto $(EMFLAGS) SOURCES := $(wildcard src/*.cpp) $(wildcard src/TypeHandlers/*.cpp) diff --git a/src/TypeHandlers/TH_GDB.cpp b/src/TypeHandlers/TH_GDB.cpp index c908bcf..a092fc8 100644 --- a/src/TypeHandlers/TH_GDB.cpp +++ b/src/TypeHandlers/TH_GDB.cpp @@ -10,7 +10,7 @@ #include -#ifdef GDB_SUPPORT +#if defined(TH_GDB_SUPPORT) || defined(__cpp_lib_variant) #include "../json.hpp" using json = nlohmann::ordered_json; @@ -553,6 +553,8 @@ namespace tivars #else +#warning "Compiler is too old to handle the GDB VarType support code so it will be disabled" + namespace tivars { data_t TH_GDB::makeDataFromString(const std::string&, const options_t&, const TIVarFile* _ctx) diff --git a/tests.cpp b/tests.cpp index 67a2dcc..0a6261a 100644 --- a/tests.cpp +++ b/tests.cpp @@ -560,7 +560,7 @@ End)"; assert(std::equal(firstVarEntry.varname, firstVarEntry.varname + 8, testThetaVarName)); } -#ifdef GDB_SUPPORT +#if defined(TH_GDB_SUPPORT) || defined(__cpp_lib_variant) /* { TIVarFile GDB1 = TIVarFile::loadFromFile("testData/GraphDataBase_Func.8xd");