diff --git a/CMakeLists.txt b/CMakeLists.txt index 247d9c1..deca1ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,9 @@ option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF) set(CMAKE_CXX_STANDARD 20) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads) + option(BUILD_PARSE OFF) option(BUILD_PROFILING OFF) option(BUILD_NBT OFF) @@ -23,6 +26,16 @@ add_executable(insane_dns ${PROJECT_BUILD_FILES}) target_link_libraries(insane_dns BLT) +if(THREADS_HAVE_PTHREAD_ARG) + # annoying hack for asio on sandcastle + set_property(TARGET insane_dns PROPERTY COMPILE_OPTIONS "-pthread") + set_property(TARGET insane_dns PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread") +endif() +if(CMAKE_THREAD_LIBS_INIT) + target_link_libraries(insane_dns "${CMAKE_THREAD_LIBS_INIT}") +endif() + + target_compile_options(insane_dns PRIVATE -Wall -Werror -Wpedantic -Wno-comment -Wno-format) target_link_options(insane_dns PRIVATE -Wall -Werror -Wpedantic -Wno-comment -Wno-format) diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index 3206d26..824fa23 100644 Binary files a/cmake-build-debug/.ninja_deps and b/cmake-build-debug/.ninja_deps differ diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log index 3b59e14..c8d324d 100644 --- a/cmake-build-debug/.ninja_log +++ b/cmake-build-debug/.ninja_log @@ -4,7 +4,7 @@ 6 7548 1698352014994362013 CMakeFiles/insane_dns.dir/src/main.cpp.o 727da43cdbc82421 8 4855 1698249273492987213 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler_v2.cpp.o 4f10bd0279063873 8 4299 1698249272936972914 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 66984105eaba6834 -0 51 1698362776514136027 build.ninja 6eaded2198e1472a +0 51 1698364327441880111 build.ninja 6eaded2198e1472a 5 2141 1698249270784916812 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/format.cpp.o 9a4151eb8a13165e 8 4025 1698351288619677206 libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o 30865d3aadfb703 2075 2313 1698352009762451033 libraries/BLT/libBLT.a 806d74f40324f232 @@ -15,3 +15,10 @@ 8 3589 1698249272228954565 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o 741b5851e86130d2 5 1734 1698249270376906050 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o 5171d83ac5d9e0dc 7 1711 1698352009170461123 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o 2ae218d9777469fd +8 1374 1698364331181784570 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o 2e3de5470fa27489 +7 1462 1698364331269782326 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o 5171d83ac5d9e0dc +8 2274 1698364332077761730 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o 3bb9d28d25c10d3b +7 2341 1698364332145759998 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o 2ae218d9777469fd +10 3017 1698364332817742883 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o 741b5851e86130d2 +9 3821 1698364333617722522 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 66984105eaba6834 +10 4201 1698364333993712955 libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o 30865d3aadfb703 diff --git a/cmake-build-debug/CMakeCache.txt b/cmake-build-debug/CMakeCache.txt index 2e89a06..38d05b6 100644 --- a/cmake-build-debug/CMakeCache.txt +++ b/cmake-build-debug/CMakeCache.txt @@ -384,6 +384,8 @@ CMAKE_GENERATOR_INSTANCE:INTERNAL= CMAKE_GENERATOR_PLATFORM:INTERNAL= //Name of generator toolset. CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Test CMAKE_HAVE_LIBC_PTHREAD +CMAKE_HAVE_LIBC_PTHREAD:INTERNAL=1 //Source directory with the top level CMakeLists.txt file for this // project CMAKE_HOME_DIRECTORY:INTERNAL=/home/brett/Documents/code/c++/Insane_DNS @@ -447,6 +449,8 @@ CMAKE_STRIP-ADVANCED:INTERNAL=1 CMAKE_UNAME:INTERNAL=/usr/bin/uname //ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 +//Details about finding Threads +FIND_PACKAGE_MESSAGE_DETAILS_Threads:INTERNAL=[TRUE][v()] //ADVANCED property for variable: ZLIB_INCLUDE_DIR ZLIB_INCLUDE_DIR-ADVANCED:INTERNAL=1 //ADVANCED property for variable: ZLIB_LIBRARY_DEBUG diff --git a/cmake-build-debug/CMakeFiles/clion-Debug-log.txt b/cmake-build-debug/CMakeFiles/clion-Debug-log.txt index 5e966de..3612730 100644 --- a/cmake-build-debug/CMakeFiles/clion-Debug-log.txt +++ b/cmake-build-debug/CMakeFiles/clion-Debug-log.txt @@ -1,4 +1,7 @@ /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/opt/brett/jetbrains/clion-install/bin/ninja/linux/x64/ninja -D ENABLE_ADDRSAN=ON -G Ninja -S /home/brett/Documents/code/c++/Insane_DNS -B /home/brett/Documents/code/c++/Insane_DNS/cmake-build-debug +-- Performing Test CMAKE_HAVE_LIBC_PTHREAD +-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success +-- Found Threads: TRUE Found Parallel Hashmaps Standard Files /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/src/blt/std/assert.cpp;/home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/src/blt/std/filesystem.cpp;/home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/src/blt/std/format.cpp;/home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/src/blt/std/loader.cpp;/home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/src/blt/std/logging.cpp;/home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/src/blt/std/string.cpp;/home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/src/blt/std/system.cpp Profiler Files /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/src/blt/profiling/profiler.cpp;/home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/src/blt/profiling/profiler_v2.cpp diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index 6a45074..e454060 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Oct 26 19:26 EDT +Start testing: Oct 26 19:52 EDT ---------------------------------------------------------- -End testing: Oct 26 19:26 EDT +End testing: Oct 26 19:52 EDT diff --git a/cmake-build-debug/build.ninja b/cmake-build-debug/build.ninja index e1abe50..19856a1 100644 --- a/cmake-build-debug/build.ninja +++ b/cmake-build-debug/build.ninja @@ -270,14 +270,14 @@ build libraries/BLT/all: phony libraries/BLT/libBLT.a ############################################# # Re-run CMake if any of its inputs changed. -build build.ninja: RERUN_CMAKE | /home/brett/Documents/code/c++/Insane_DNS/CMakeLists.txt /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/CMakeLists.txt /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/include/blt/config.h.in /usr/share/cmake-3.25/Modules/CMakeCInformation.cmake /usr/share/cmake-3.25/Modules/CMakeCXXInformation.cmake /usr/share/cmake-3.25/Modules/CMakeCommonLanguageInclude.cmake /usr/share/cmake-3.25/Modules/CMakeGenericSystem.cmake /usr/share/cmake-3.25/Modules/CMakeInitializeConfigs.cmake /usr/share/cmake-3.25/Modules/CMakeLanguageInformation.cmake /usr/share/cmake-3.25/Modules/CMakeSystemSpecificInformation.cmake /usr/share/cmake-3.25/Modules/CMakeSystemSpecificInitialize.cmake /usr/share/cmake-3.25/Modules/Compiler/CMakeCommonCompilerMacros.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU-C.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU-CXX.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU.cmake /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake /usr/share/cmake-3.25/Modules/FindPackageMessage.cmake /usr/share/cmake-3.25/Modules/FindZLIB.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU-C.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU-CXX.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU.cmake /usr/share/cmake-3.25/Modules/Platform/Linux.cmake /usr/share/cmake-3.25/Modules/Platform/UnixPaths.cmake /usr/share/cmake-3.25/Modules/SelectLibraryConfigurations.cmake CMakeCache.txt CMakeFiles/3.25.1/CMakeCCompiler.cmake CMakeFiles/3.25.1/CMakeCXXCompiler.cmake CMakeFiles/3.25.1/CMakeSystem.cmake +build build.ninja: RERUN_CMAKE | /home/brett/Documents/code/c++/Insane_DNS/CMakeLists.txt /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/CMakeLists.txt /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/include/blt/config.h.in /usr/share/cmake-3.25/Modules/CMakeCInformation.cmake /usr/share/cmake-3.25/Modules/CMakeCXXInformation.cmake /usr/share/cmake-3.25/Modules/CMakeCommonLanguageInclude.cmake /usr/share/cmake-3.25/Modules/CMakeGenericSystem.cmake /usr/share/cmake-3.25/Modules/CMakeInitializeConfigs.cmake /usr/share/cmake-3.25/Modules/CMakeLanguageInformation.cmake /usr/share/cmake-3.25/Modules/CMakeSystemSpecificInformation.cmake /usr/share/cmake-3.25/Modules/CMakeSystemSpecificInitialize.cmake /usr/share/cmake-3.25/Modules/CheckCSourceCompiles.cmake /usr/share/cmake-3.25/Modules/CheckIncludeFile.cmake /usr/share/cmake-3.25/Modules/CheckLibraryExists.cmake /usr/share/cmake-3.25/Modules/Compiler/CMakeCommonCompilerMacros.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU-C.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU-CXX.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU.cmake /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake /usr/share/cmake-3.25/Modules/FindPackageMessage.cmake /usr/share/cmake-3.25/Modules/FindThreads.cmake /usr/share/cmake-3.25/Modules/FindZLIB.cmake /usr/share/cmake-3.25/Modules/Internal/CheckSourceCompiles.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU-C.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU-CXX.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU.cmake /usr/share/cmake-3.25/Modules/Platform/Linux.cmake /usr/share/cmake-3.25/Modules/Platform/UnixPaths.cmake /usr/share/cmake-3.25/Modules/SelectLibraryConfigurations.cmake CMakeCache.txt CMakeFiles/3.25.1/CMakeCCompiler.cmake CMakeFiles/3.25.1/CMakeCXXCompiler.cmake CMakeFiles/3.25.1/CMakeSystem.cmake pool = console ############################################# # A missing CMake input file is not an error. -build /home/brett/Documents/code/c++/Insane_DNS/CMakeLists.txt /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/CMakeLists.txt /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/include/blt/config.h.in /usr/share/cmake-3.25/Modules/CMakeCInformation.cmake /usr/share/cmake-3.25/Modules/CMakeCXXInformation.cmake /usr/share/cmake-3.25/Modules/CMakeCommonLanguageInclude.cmake /usr/share/cmake-3.25/Modules/CMakeGenericSystem.cmake /usr/share/cmake-3.25/Modules/CMakeInitializeConfigs.cmake /usr/share/cmake-3.25/Modules/CMakeLanguageInformation.cmake /usr/share/cmake-3.25/Modules/CMakeSystemSpecificInformation.cmake /usr/share/cmake-3.25/Modules/CMakeSystemSpecificInitialize.cmake /usr/share/cmake-3.25/Modules/Compiler/CMakeCommonCompilerMacros.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU-C.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU-CXX.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU.cmake /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake /usr/share/cmake-3.25/Modules/FindPackageMessage.cmake /usr/share/cmake-3.25/Modules/FindZLIB.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU-C.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU-CXX.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU.cmake /usr/share/cmake-3.25/Modules/Platform/Linux.cmake /usr/share/cmake-3.25/Modules/Platform/UnixPaths.cmake /usr/share/cmake-3.25/Modules/SelectLibraryConfigurations.cmake CMakeCache.txt CMakeFiles/3.25.1/CMakeCCompiler.cmake CMakeFiles/3.25.1/CMakeCXXCompiler.cmake CMakeFiles/3.25.1/CMakeSystem.cmake: phony +build /home/brett/Documents/code/c++/Insane_DNS/CMakeLists.txt /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/CMakeLists.txt /home/brett/Documents/code/c++/Insane_DNS/libraries/BLT/include/blt/config.h.in /usr/share/cmake-3.25/Modules/CMakeCInformation.cmake /usr/share/cmake-3.25/Modules/CMakeCXXInformation.cmake /usr/share/cmake-3.25/Modules/CMakeCommonLanguageInclude.cmake /usr/share/cmake-3.25/Modules/CMakeGenericSystem.cmake /usr/share/cmake-3.25/Modules/CMakeInitializeConfigs.cmake /usr/share/cmake-3.25/Modules/CMakeLanguageInformation.cmake /usr/share/cmake-3.25/Modules/CMakeSystemSpecificInformation.cmake /usr/share/cmake-3.25/Modules/CMakeSystemSpecificInitialize.cmake /usr/share/cmake-3.25/Modules/CheckCSourceCompiles.cmake /usr/share/cmake-3.25/Modules/CheckIncludeFile.cmake /usr/share/cmake-3.25/Modules/CheckLibraryExists.cmake /usr/share/cmake-3.25/Modules/Compiler/CMakeCommonCompilerMacros.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU-C.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU-CXX.cmake /usr/share/cmake-3.25/Modules/Compiler/GNU.cmake /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake /usr/share/cmake-3.25/Modules/FindPackageMessage.cmake /usr/share/cmake-3.25/Modules/FindThreads.cmake /usr/share/cmake-3.25/Modules/FindZLIB.cmake /usr/share/cmake-3.25/Modules/Internal/CheckSourceCompiles.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU-C.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU-CXX.cmake /usr/share/cmake-3.25/Modules/Platform/Linux-GNU.cmake /usr/share/cmake-3.25/Modules/Platform/Linux.cmake /usr/share/cmake-3.25/Modules/Platform/UnixPaths.cmake /usr/share/cmake-3.25/Modules/SelectLibraryConfigurations.cmake CMakeCache.txt CMakeFiles/3.25.1/CMakeCCompiler.cmake CMakeFiles/3.25.1/CMakeCXXCompiler.cmake CMakeFiles/3.25.1/CMakeSystem.cmake: phony ############################################# diff --git a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o index 78ad2ae..76d3e1e 100644 Binary files a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o and b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o differ diff --git a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o index 8c8d202..e466129 100644 Binary files a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o and b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o differ diff --git a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o index 288b219..5da4535 100644 Binary files a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o and b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o differ diff --git a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o index f505d15..356e929 100644 Binary files a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o and b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o differ diff --git a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o index a25e157..e85ba61 100644 Binary files a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o and b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o differ diff --git a/src/main.cpp b/src/main.cpp index 1a03219..cf3608c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,7 +66,7 @@ static constexpr bool NON_STRICT_REPLACE_ALL = true; // was going to add TCP and ad blocking support // that also isn't going to happen now. /** list of web address to download the ad block lists from */ -static constexpr std::vector BLOCK_LISTS{}; +static BLT_CPP20_CONSTEXPR std::vector BLOCK_LISTS{}; /** true -> block ad DNS requests ; false -> do nothing */ static constexpr bool BLOCK_ADS = false; /** true -> send back the REPLACEMENT_IP() ; false -> send back a fail state in the DNS request. */