Skip to content

libc/cmake: don't fail if LLVM_VERSION_SUFFIX isn't defined #126359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 13, 2025

Conversation

sylvestre
Copy link
Collaborator

Closes: #126358

cc @samvangysegem

@llvmbot
Copy link
Member

llvmbot commented Feb 8, 2025

@llvm/pr-subscribers-libc

Author: Sylvestre Ledru (sylvestre)

Changes

Closes: #126358

cc @samvangysegem


Full diff: https://github.com/llvm/llvm-project/pull/126359.diff

1 Files Affected:

  • (modified) libc/CMakeLists.txt (+5-1)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 1c4c0cd5aa22ba..d44769721c918f 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -51,7 +51,11 @@ set(LIBC_KERNEL_HEADERS "/usr/include" CACHE STRING "Path to Linux kernel header
 # Defining a global namespace to enclose all libc functions.
 set(default_namespace "__llvm_libc")
 if(LLVM_VERSION_MAJOR)
-  string(REPLACE "-" "" NS_LLVM_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
+  if(DEFINED LLVM_VERSION_SUFFIX AND NOT "${LLVM_VERSION_SUFFIX}" STREQUAL "")
+    string(REPLACE "-" "" NS_LLVM_VERSION_SUFFIX "${LLVM_VERSION_SUFFIX}")
+  else()
+    set(NS_LLVM_VERSION_SUFFIX "")
+  endif()
   set(default_namespace "__llvm_libc_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}_${LLVM_VERSION_PATCH}_${NS_LLVM_VERSION_SUFFIX}")
 endif()
 set(LIBC_NAMESPACE ${default_namespace}

@nickdesaulniers
Copy link
Member

Thanks @sylvestre for the patch! Sorry I missed that this would be an issue in my review of #126193. Note: that got backported to release/20.x, so this will need to be backported as well. As such, I'll tag #126358 as a release blocker. Sorry for the mess; or rather thank you for cleaning up my mess!

@sylvestre sylvestre merged commit c81139f into llvm:main Feb 13, 2025
11 of 12 checks passed
@sylvestre
Copy link
Collaborator Author

sorry for the latency, crazy week

@sylvestre sylvestre deleted the issue-126358 branch February 13, 2025 17:42
@jhuber6
Copy link
Contributor

jhuber6 commented Feb 13, 2025

/cherry-pick c81139f

@llvmbot
Copy link
Member

llvmbot commented Feb 13, 2025

/pull-request #127099

joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Feb 14, 2025
swift-ci pushed a commit to swiftlang/llvm-project that referenced this pull request Feb 14, 2025
)

Closes: llvm#126358

cc @samvangysegem

---------

Co-authored-by: Joseph Huber <[email protected]>
(cherry picked from commit c81139f)
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

libc/CMakeLists.txt: string sub-command REPLACE requires at least four arguments.
4 participants