From 3f6adb9e04e9da01a2f80b379e14efd58855092a Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sat, 20 Dec 2025 22:32:18 +0800 Subject: [PATCH] fix: fix clang compile error - fix the include of stacktrace error. - fix env include issues. - fix wrong include for libcxx enumerate patch. --- src/yycc/carton/clap/manual.cpp | 2 +- src/yycc/carton/tabulate.cpp | 2 +- src/yycc/env.cpp | 12 +++++------- src/yycc/panic.cpp | 7 ++++++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/yycc/carton/clap/manual.cpp b/src/yycc/carton/clap/manual.cpp index 092cc88..ebf03d6 100644 --- a/src/yycc/carton/clap/manual.cpp +++ b/src/yycc/carton/clap/manual.cpp @@ -2,7 +2,7 @@ #include "../termcolor.hpp" #include "../../patch/stream.hpp" #include "../../patch/format.hpp" -#include "../../patch/libcxx/stacktrace.hpp" +#include "../../patch/libcxx/enumerate.hpp" #include "../../string/op.hpp" #include "../../env.hpp" #include diff --git a/src/yycc/carton/tabulate.cpp b/src/yycc/carton/tabulate.cpp index 77bf475..fab7f36 100644 --- a/src/yycc/carton/tabulate.cpp +++ b/src/yycc/carton/tabulate.cpp @@ -2,7 +2,7 @@ #include "wcwidth.hpp" #include "../num/safe_op.hpp" #include "../patch/stream.hpp" -#include "../patch/libcxx/stacktrace.hpp" +#include "../patch/libcxx/enumerate.hpp" #include #include diff --git a/src/yycc/env.cpp b/src/yycc/env.cpp index 833e3a1..59e8ee8 100644 --- a/src/yycc/env.cpp +++ b/src/yycc/env.cpp @@ -1,5 +1,8 @@ #include "env.hpp" #include "macro/os_detector.hpp" +#include "string/reinterpret.hpp" +#include "num/safe_op.hpp" +#include "num/safe_cast.hpp" #include #include #include @@ -8,8 +11,6 @@ #if defined(YYCC_OS_WINDOWS) #include "encoding/windows.hpp" -#include "num/safe_op.hpp" -#include "num/safe_cast.hpp" #include "windows/winfct.hpp" #include "windows/import_guard_head.hpp" #include @@ -18,15 +19,12 @@ #include // For getting commandline argument. #include "windows/import_guard_tail.hpp" #elif defined(YYCC_OS_LINUX) -#include "string/reinterpret.hpp" #include #include #include // For reading commandline argument. #include #include // For reading symlink target. #elif defined(YYCC_OS_MACOS) -#include "string/reinterpret.hpp" -#include "num/safe_cast.hpp" #include #include #include @@ -331,7 +329,7 @@ namespace yycc::env { #elif defined(YYCC_OS_LINUX) // Reference: https://www.man7.org/linux/man-pages/man5/proc_pid_exe.5.html auto target = read_symlink_target("/proc/self/exe"); - if () return rv = std::move(target.value()); + if (target.has_value()) return rv = std::move(target.value()); else return std::unexpected(PathError::SysCall); #elif defined(YYCC_OS_MACOS) // TODO: This is AI generated and don't have test and reference. @@ -388,7 +386,7 @@ namespace yycc::env { class CommandLineArgvDeleter { public: CommandLineArgvDeleter() {} - void operator()(LPWSTR* ptr) { + void operator()(LPWSTR *ptr) { if (ptr != nullptr) { LocalFree(ptr); } diff --git a/src/yycc/panic.cpp b/src/yycc/panic.cpp index 06a5310..27e6b99 100644 --- a/src/yycc/panic.cpp +++ b/src/yycc/panic.cpp @@ -1,11 +1,16 @@ #include "panic.hpp" +#include "macro/stl_detector.hpp" #include "carton/termcolor.hpp" #include "patch/stream.hpp" -#include "patch/libcxx/stacktrace.hpp" #include #include #include + +#if defined(YYCC_STL_CLANGSTL) +#include "patch/libcxx/stacktrace.hpp" +#else #include +#endif #define TERMCOLOR ::yycc::carton::termcolor