0025-Get-rid-of-spurious-trailing-space-in-__clang_versio.patch (1334B)
1 From 6034012a6645830a453a48561480f3e8c2291fec Mon Sep 17 00:00:00 2001 2 From: q66 <q66@chimera-linux.org> 3 Date: Sat, 4 Nov 2023 09:20:52 +0100 4 Subject: [PATCH 25/29] Get rid of spurious trailing space in __clang_version__ 5 6 --- 7 clang/lib/Frontend/InitPreprocessor.cpp | 10 +++++++--- 8 1 file changed, 7 insertions(+), 3 deletions(-) 9 10 diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp 11 index c239342fa..3ee01ac9a 100644 12 --- a/clang/lib/Frontend/InitPreprocessor.cpp 13 +++ b/clang/lib/Frontend/InitPreprocessor.cpp 14 @@ -866,9 +866,13 @@ static void InitializePredefinedMacros(const TargetInfo &TI, 15 Builder.defineMacro("__clang_patchlevel__", TOSTR(CLANG_VERSION_PATCHLEVEL)); 16 #undef TOSTR 17 #undef TOSTR2 18 - Builder.defineMacro("__clang_version__", 19 - "\"" CLANG_VERSION_STRING " " 20 - + getClangFullRepositoryVersion() + "\""); 21 + auto fullver = getClangFullRepositoryVersion(); 22 + if (!fullver.empty()) { 23 + Builder.defineMacro("__clang_version__", 24 + "\"" CLANG_VERSION_STRING " " + fullver + "\""); 25 + } else { 26 + Builder.defineMacro("__clang_version__", "\"" CLANG_VERSION_STRING "\""); 27 + } 28 29 if (LangOpts.GNUCVersion != 0) { 30 // Major, minor, patch, are given two decimal places each, so 4.2.1 becomes 31 -- 32 2.49.0 33