Add missing source file and fix license incorrectly saying GPL Affero instead of just GPL
This commit is contained in:
parent
8a3b5045cd
commit
7cfe707bc3
@ -15,7 +15,7 @@ option(ENABLE_PROFILING "Enable asan" OFF)
|
|||||||
option(BUILD_TESTS "Enable testing" OFF)
|
option(BUILD_TESTS "Enable testing" OFF)
|
||||||
mark_as_advanced(ENABLE_PROFILING)
|
mark_as_advanced(ENABLE_PROFILING)
|
||||||
|
|
||||||
set(SOURCE_LIST "src/filerd.cpp" "src/string.cpp" "src/binary.cpp" "src/static_string.cpp" "src/threadpool.cpp")
|
set(SOURCE_LIST "src/filerd.cpp" "src/string.cpp" "src/binary.cpp" "src/static_string.cpp" "src/threadpool.cpp" "src/demangle.cpp")
|
||||||
add_library(ensure OBJECT "src/ensure.cpp")
|
add_library(ensure OBJECT "src/ensure.cpp")
|
||||||
target_compile_options(ensure PRIVATE -Wall -Wextra -pedantic -std=c++20)
|
target_compile_options(ensure PRIVATE -Wall -Wextra -pedantic -std=c++20)
|
||||||
if(ENABLE_SHARED)
|
if(ENABLE_SHARED)
|
||||||
|
|||||||
@ -3,16 +3,16 @@
|
|||||||
Copyright (C) 2021 rexy712
|
Copyright (C) 2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -3,16 +3,16 @@
|
|||||||
Copyright (C) 2021 rexy712
|
Copyright (C) 2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -65,6 +65,21 @@
|
|||||||
template<class... Args>
|
template<class... Args>
|
||||||
print(Args&&...) -> print<Args&&...>;
|
print(Args&&...) -> print<Args&&...>;
|
||||||
#ifdef REXY_ENABLE_COLOR_DEBUG
|
#ifdef REXY_ENABLE_COLOR_DEBUG
|
||||||
|
template<class... Args>
|
||||||
|
struct print_succ{
|
||||||
|
explicit print_succ(Args&&... args, const rexy::source_location& loc = rexy::source_location::current()){
|
||||||
|
std::fprintf(stderr, "%s", detail::color_green);
|
||||||
|
std::fprintf(stderr, "%s:%s:%d: ", loc.file_name(), loc.function_name(), loc.line());
|
||||||
|
std::fprintf(stderr, std::forward<Args>(args)...);
|
||||||
|
std::fprintf(stderr, "%s", detail::color_clear);
|
||||||
|
}
|
||||||
|
print_succ(const print_succ&) = delete;
|
||||||
|
print_succ(print_succ&&) = delete;
|
||||||
|
print_succ& operator=(const print_succ&) = delete;
|
||||||
|
print_succ& operator=(print_succ&&) = delete;
|
||||||
|
};
|
||||||
|
template<class... Args>
|
||||||
|
print_succ(Args&&...) -> print_succ<Args&&...>;
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
struct print_info{
|
struct print_info{
|
||||||
explicit print_info(Args&&... args, const rexy::source_location& loc = rexy::source_location::current()){
|
explicit print_info(Args&&... args, const rexy::source_location& loc = rexy::source_location::current()){
|
||||||
@ -111,6 +126,8 @@
|
|||||||
template<class... Args>
|
template<class... Args>
|
||||||
print_error(Args&&...) -> print_error<Args&&...>;
|
print_error(Args&&...) -> print_error<Args&&...>;
|
||||||
#else
|
#else
|
||||||
|
template<class... Args>
|
||||||
|
using print_succ = print<Args...>;
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
using print_info = print<Args...>;
|
using print_info = print<Args...>;
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
@ -124,6 +141,8 @@
|
|||||||
template<class... Args>
|
template<class... Args>
|
||||||
using print = rexy::debug::print<Args...>;
|
using print = rexy::debug::print<Args...>;
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
|
using print_succ = rexy::debug::print_succ<Args...>;
|
||||||
|
template<class... Args>
|
||||||
using print_info = rexy::debug::print_info<Args...>;
|
using print_info = rexy::debug::print_info<Args...>;
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
using print_warn = rexy::debug::print_warn<Args...>;
|
using print_warn = rexy::debug::print_warn<Args...>;
|
||||||
@ -133,22 +152,25 @@
|
|||||||
#else
|
#else
|
||||||
namespace verbose{
|
namespace verbose{
|
||||||
static constexpr inline void print(...){}
|
static constexpr inline void print(...){}
|
||||||
|
static constexpr inline void print_succ(...){}
|
||||||
|
static constexpr inline void print_info(...){}
|
||||||
static constexpr inline void print_warn(...){}
|
static constexpr inline void print_warn(...){}
|
||||||
static constexpr inline void print_error(...){}
|
static constexpr inline void print_error(...){}
|
||||||
static constexpr inline void print_info(...){}
|
|
||||||
}
|
}
|
||||||
#endif //REXY_ENABLE_DEBUG_VERBOSE_OUTPUT
|
#endif //REXY_ENABLE_DEBUG_VERBOSE_OUTPUT
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static constexpr inline void print(...){}
|
static constexpr inline void print(...){}
|
||||||
|
static constexpr inline void print_succ(...){}
|
||||||
|
static constexpr inline void print_info(...){}
|
||||||
static constexpr inline void print_warn(...){}
|
static constexpr inline void print_warn(...){}
|
||||||
static constexpr inline void print_error(...){}
|
static constexpr inline void print_error(...){}
|
||||||
static constexpr inline void print_info(...){}
|
|
||||||
namespace verbose{
|
namespace verbose{
|
||||||
static constexpr inline void print(...){}
|
static constexpr inline void print(...){}
|
||||||
|
static constexpr inline void print_succ(...){}
|
||||||
|
static constexpr inline void print_info(...){}
|
||||||
static constexpr inline void print_warn(...){}
|
static constexpr inline void print_warn(...){}
|
||||||
static constexpr inline void print_error(...){}
|
static constexpr inline void print_error(...){}
|
||||||
static constexpr inline void print_info(...){}
|
|
||||||
}
|
}
|
||||||
#endif //REXY_ENABLE_DEBUG_OUTPUT
|
#endif //REXY_ENABLE_DEBUG_OUTPUT
|
||||||
|
|
||||||
|
|||||||
48
src/demangle.cpp
Normal file
48
src/demangle.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
This file is a part of rexy's general purpose library
|
||||||
|
Copyright (C) 2022 rexy712
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "rexy/demangle.hpp"
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && !defined(_MSC_VER)
|
||||||
|
|
||||||
|
#include <cstdlib> //free
|
||||||
|
#include <string>
|
||||||
|
#include <memory> //unique_ptr
|
||||||
|
#include <cxxabi.h> //__cxa_demangle
|
||||||
|
|
||||||
|
namespace util{
|
||||||
|
std::string demangle(const char* name){
|
||||||
|
int status = 0;
|
||||||
|
std::unique_ptr<char,void(*)(void*)> res{
|
||||||
|
abi::__cxa_demangle(name, nullptr, nullptr, &status),
|
||||||
|
std::free
|
||||||
|
};
|
||||||
|
return (status == 0) ? res.get() : name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
namespace util{
|
||||||
|
std::string demangle(const char* name){
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
x
Reference in New Issue
Block a user