From 2b84a4000bdab22df2ac199644128d2379e1a117 Mon Sep 17 00:00:00 2001 From: Matthew Sanders Date: Tue, 9 Dec 2025 14:38:13 -0700 Subject: [PATCH 1/8] I added cmake. --- CMakeLists.txt | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..dbe07121 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.12) + +project(libtoolchain + VERSION 1.0.0 + LANGUAGES CXX C +) + +# Set C++ standard +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Platform detection +if(WIN32) + set(PLATFORM_NAME "win32") +elseif(APPLE) + set(PLATFORM_NAME "macos") +else() + set(PLATFORM_NAME "linux") +endif() + +# Output directories +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${PLATFORM_NAME}) + +# Collect source files from all subdirectories +file(GLOB_RECURSE TOOLCHAIN_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c +) + +# Create static library +add_library(toolchain STATIC ${TOOLCHAIN_SOURCES}) + +# Include directories +target_include_directories(toolchain + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +# Link dependencies +target_link_libraries(toolchain + PUBLIC + mbedtls + fmt +) + +# Compiler flags +if(NOT MSVC) + target_compile_options(toolchain PRIVATE -Wall -Wno-unused-value -Wno-unused-but-set-variable -fPIC) + if(APPLE) + target_compile_options(toolchain PRIVATE -Wno-unused-private-field) + endif() +endif() From 66ab8a51ac20c16ed009df0f698277c6c8b68dc4 Mon Sep 17 00:00:00 2001 From: Matthew Sanders Date: Tue, 9 Dec 2025 16:09:36 -0700 Subject: [PATCH 2/8] I fixed a build warning. --- include/tc/crypto/detail/CmacImpl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/tc/crypto/detail/CmacImpl.h b/include/tc/crypto/detail/CmacImpl.h index a4589510..8a208d8b 100644 --- a/include/tc/crypto/detail/CmacImpl.h +++ b/include/tc/crypto/detail/CmacImpl.h @@ -145,7 +145,7 @@ class CmacImpl if (mState == State::Initialized) { // finalise mac, and tranisition to done state - std::array M_last; + std::array M_last = {}; // 1) transform last unprocessed to M_last block if (mUnprocessedBlockPos == kBlockSize) From 7bad354b8f786a30236773bc96ed9608320cf7c0 Mon Sep 17 00:00:00 2001 From: Matthew Sanders Date: Tue, 9 Dec 2025 16:17:50 -0700 Subject: [PATCH 3/8] I fixed a Windows compilation warning. --- include/tc/types.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/tc/types.h b/include/tc/types.h index 8cdc8377..c6988143 100644 --- a/include/tc/types.h +++ b/include/tc/types.h @@ -20,7 +20,9 @@ #include #ifdef _WIN32 +#ifndef NOMINMAX #define NOMINMAX +#endif #endif /// Alias uint8_t to byte_t to more explicity indicate its role in memory related contexts @@ -62,4 +64,4 @@ namespace tc { /// Returns if a value of type uint64_t is too large to be stored as size_t. bool is_uint64_t_too_large_for_size_t(uint64_t val); -} \ No newline at end of file +} From d44bf84ccc797a8daff2d33366e280cb664c951f Mon Sep 17 00:00:00 2001 From: Matthew Sanders Date: Tue, 9 Dec 2025 16:19:24 -0700 Subject: [PATCH 4/8] I fixed another Windows compilation warning. --- include/tc/io/FileStream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/tc/io/FileStream.h b/include/tc/io/FileStream.h index bd557d25..99d2ea1f 100644 --- a/include/tc/io/FileStream.h +++ b/include/tc/io/FileStream.h @@ -26,7 +26,7 @@ #include #ifdef _WIN32 -#include +#include #else #include #endif From a8783d6a8ce5e4e4428771ac48b1e02014adf190 Mon Sep 17 00:00:00 2001 From: Matthew Sanders Date: Tue, 9 Dec 2025 16:21:24 -0700 Subject: [PATCH 5/8] I fixed another Windows compilation warning. --- src/io/FileStream.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/io/FileStream.cpp b/src/io/FileStream.cpp index 279694d2..68b149ac 100644 --- a/src/io/FileStream.cpp +++ b/src/io/FileStream.cpp @@ -198,7 +198,9 @@ void tc::io::FileStream::dispose() #ifdef _WIN32 +#ifdef _MSC_VER #pragma warning(disable : 4065) // disable warning for switch case with only default case +#endif void tc::io::FileStream::open_impl(const tc::io::Path& path, FileMode mode, FileAccess access) { From 28a851449414b14911aeea8b46413243b6c620a2 Mon Sep 17 00:00:00 2001 From: Matthew Sanders Date: Tue, 9 Dec 2025 16:23:09 -0700 Subject: [PATCH 6/8] I fixed another Windows compilation warning. --- src/io/LocalFileSystem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/io/LocalFileSystem.cpp b/src/io/LocalFileSystem.cpp index 0785ffe3..b50bf1c9 100644 --- a/src/io/LocalFileSystem.cpp +++ b/src/io/LocalFileSystem.cpp @@ -9,7 +9,9 @@ #include #include +#ifdef _MSC_VER #pragma warning(disable : 4065) // disable warning for switch case with only default case +#endif #else #include @@ -580,6 +582,8 @@ void tc::io::LocalFileSystem::getDirectoryChildren(const std::string& method_nam #ifdef _WIN32 +#ifdef _MSC_VER #pragma warning(default : 4065) // reenable warning for switch case with only default case +#endif -#endif \ No newline at end of file +#endif From 45554e5e48ef0ac33c82bef1ec44a28dfd8597f7 Mon Sep 17 00:00:00 2001 From: Matthew Sanders Date: Tue, 9 Dec 2025 16:23:56 -0700 Subject: [PATCH 7/8] I fixed another Windows compilation warning. --- src/io/FileStream.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/io/FileStream.cpp b/src/io/FileStream.cpp index 68b149ac..2f85b063 100644 --- a/src/io/FileStream.cpp +++ b/src/io/FileStream.cpp @@ -445,7 +445,9 @@ void tc::io::FileStream::flush_impl() } } +#ifdef _MSC_VER #pragma warning(default : 4065) // reenable warning for switch case with only default case +#endif #else void tc::io::FileStream::open_impl(const tc::io::Path& path, FileMode mode, FileAccess access) From 16bddce066adc2053efc4624dc52cc57125d4f06 Mon Sep 17 00:00:00 2001 From: Matthew Sanders Date: Tue, 9 Dec 2025 16:25:48 -0700 Subject: [PATCH 8/8] I fixed an operator precedence compilation warning. --- src/io/FileStream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io/FileStream.cpp b/src/io/FileStream.cpp index 2f85b063..fc0b35aa 100644 --- a/src/io/FileStream.cpp +++ b/src/io/FileStream.cpp @@ -274,7 +274,7 @@ void tc::io::FileStream::open_impl(const tc::io::Path& path, FileMode mode, File } // append can only open in write only mode - if (mode == tc::io::FileMode::Append && (access_flag & GENERIC_READ | GENERIC_WRITE) != GENERIC_WRITE) + if (mode == tc::io::FileMode::Append && (access_flag & (GENERIC_READ | GENERIC_WRITE)) != GENERIC_WRITE) { throw tc::ArgumentException(kClassName + "::open()", "Stream opened in Append mode can only work with Write access. ReadWrite is not permitted"); }