From 8c3d7f629726dbb7cbccfe81523eca365fbdf97b Mon Sep 17 00:00:00 2001 From: Ludovic 'Archivist' Lagouardette Date: Fri, 9 Apr 2021 14:33:55 +0200 Subject: [PATCH] Fixed misplaced function --- Makefile | 8 ++++---- blacklist.txt | 2 +- include/gp/algorithms/min_of.hpp | 9 ++------- include/gp/functional/identity.hpp | 9 +++++++++ include/gp/math/rendering/renderer.hpp | 1 + 5 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 include/gp/functional/identity.hpp diff --git a/Makefile b/Makefile index 42b48cd..6c9e79f 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ -CXX= g++ +CXX= clang++ CXXFLAGS= --std=c++20 -O0 -g -pthread -DGP_TESTS -DFUZZ_STRENGTH=100000 -DNO_BENCH=0 -pedantic \ - -# -fprofile-instr-generate -fcoverage-mapping -Wno-unknown-attributes -fno-omit-frame-pointer \ + -fprofile-instr-generate -fcoverage-mapping -Wno-unknown-attributes -fno-omit-frame-pointer \ + +# -fsanitize=address -fsanitize-blacklist=blacklist.txt EVERY_USEFUL_FILE= $(shell find include/ -name "*.hpp" -type "f") EVERY_TEST_FILE= $(shell find tests/ -name "*.cpp" -type "f") -# -fsanitize=address -fsanitize-blacklist=blacklist.txt all: tests docs: $(EVERY_USEFUL_FILE) diff --git a/blacklist.txt b/blacklist.txt index 1581d42..186fee5 100644 --- a/blacklist.txt +++ b/blacklist.txt @@ -1,3 +1,3 @@ src:gp/system/scheduler.hpp src:gp/system/platforms/gcc-x86_64.hpp -fun:gp::specifics::platform_data::push(void*) \ No newline at end of file +fun:gp::system::specifics::platform_data::push(void*) \ No newline at end of file diff --git a/include/gp/algorithms/min_of.hpp b/include/gp/algorithms/min_of.hpp index 74d2056..ffddabd 100644 --- a/include/gp/algorithms/min_of.hpp +++ b/include/gp/algorithms/min_of.hpp @@ -3,15 +3,10 @@ #include "gp_config.hpp" #include "gp/algorithms/move.hpp" +#include "gp/functional/identity.hpp" -namespace gp{ - - // TODO: this goes in functional - template - T identity(T v){return v;} - template - T& identity(T& v){return v;} +namespace gp{ template auto&& min_of(it beg, it end, transform fn = identity) { diff --git a/include/gp/functional/identity.hpp b/include/gp/functional/identity.hpp new file mode 100644 index 0000000..0fc30e3 --- /dev/null +++ b/include/gp/functional/identity.hpp @@ -0,0 +1,9 @@ +#pragma once + +namespace gp { + template + T identity(T v){return v;} + + template + T& identity(T& v){return v;} +} \ No newline at end of file diff --git a/include/gp/math/rendering/renderer.hpp b/include/gp/math/rendering/renderer.hpp index b32edd1..0b97876 100644 --- a/include/gp/math/rendering/renderer.hpp +++ b/include/gp/math/rendering/renderer.hpp @@ -10,6 +10,7 @@ #include "gp/math/rendering_math.hpp" // TODO: Namespace this correctly +// BUG: The rendering behaves improperly, I don't know why namespace gp { namespace math {