From 82c3ed5b32a579b7c6cfd1f5a7a1cddc2f75f5db Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sun, 28 Sep 2025 22:38:09 +0800 Subject: [PATCH] fix: fix compile error in gcc. - remove __attribute__(format) checker for UTF8 char type printf becuase it forcely require the type of format string is const char*, rather than const char8_t*, and I can not use any switches to remove this. - delete useless macro and header in clap manual. --- src/yycc/carton/clap/manual.cpp | 2 -- src/yycc/string/op.hpp | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/yycc/carton/clap/manual.cpp b/src/yycc/carton/clap/manual.cpp index 98addce..1849907 100644 --- a/src/yycc/carton/clap/manual.cpp +++ b/src/yycc/carton/clap/manual.cpp @@ -2,13 +2,11 @@ #include "../termcolor.hpp" #include "../../patch/stream.hpp" #include "../../patch/format.hpp" -#include "../../string/op.hpp" #define CLAP ::yycc::carton::clap #define TABULATE ::yycc::carton::tabulate #define TERMCOLOR ::yycc::carton::termcolor #define FORMAT ::yycc::patch::format -#define OP ::yycc::carton::op using namespace ::yycc::patch::stream; diff --git a/src/yycc/string/op.hpp b/src/yycc/string/op.hpp index 3e6e8dd..bba8fd5 100644 --- a/src/yycc/string/op.hpp +++ b/src/yycc/string/op.hpp @@ -12,13 +12,19 @@ namespace yycc::string::op { #pragma region Printf + // YYC MARK: + // Shitty __attribute__((format(gnu_printf, (A), (B)))) force the type of format string is const char*. + // My function signature will cause compile error which can not be removed by any switches. + // I guess Clang may have same issue. + // So I sadly disable format string check for printf in UTF8 char type. + /** * @brief Perform an UTF8 string formatting operation. * @param[in] format The format string. * @param[in] ... Argument list of format string. * @return The formatted result. */ - std::u8string printf(YYCC_PRINTF_CHECK_FMTSTR const char8_t* format, ...) YYCC_PRINTF_CHECK_ATTR(1, 2); + std::u8string printf(/*YYCC_PRINTF_CHECK_FMTSTR*/ const char8_t* format, ...) /*YYCC_PRINTF_CHECK_ATTR(1, 2)*/; /** * @brief Perform an UTF8 string formatting operation. * @param[in] format The format string.