Skip to content

Commit

Permalink
TH_GDB: better feature check for build
Browse files Browse the repository at this point in the history
  • Loading branch information
adriweb committed Jun 10, 2024
1 parent cfe8746 commit fbb9b21
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ 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)

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")
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion Makefile.emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/TypeHandlers/TH_GDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <stdexcept>

#ifdef GDB_SUPPORT
#if defined(TH_GDB_SUPPORT) || defined(__cpp_lib_variant)

#include "../json.hpp"
using json = nlohmann::ordered_json;
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit fbb9b21

Please sign in to comment.