<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108325>108325</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[cmake][llvm version] using an hyphen for suffix breaks libc build
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DunskiPhilippe
</td>
</tr>
</table>
<pre>
Hello,
It's a very good thing to define the LLVM version in a separate file (currently in <base project dir>/cmake/modules/LLVMVersion.cmake).
And it's a great idea to add a suffix like rcXXX when tagging release candidates, especially when they are four of them.
But this suffix is used in (libc/CMakeLists.txt) to define `default_namespace` as `__llvm_libc_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}_${LLVM_VERSION_PATCH}_${LLVM_VERSION_SUFFIX}`, which, will be used to define (still in libc/CMakeLists.txt) `LIBC_NAMESPACE` as the same value, then as preprocessor definition for LIBC_NAMESPACE and, finally used to define `LIBC_NAMESPACE_DECL` as being something like
`#define LIBC_NAMESPACE_DECL [[gnu::visibility("hidden")]] LIBC_NAMESPACE`
which will expend to
`[[gnu::visibility("hidden")]]_llvm_libc_19_1_0_-rc4`
to get the surrounding namespace for all all files in libc/src and its subdirectories
Problem is that single hyphen leads to multiple build error like
```
error: expected'{'
15 | namespace LIBC_NAMESPACE_DECL {
| ^
/home/philippe/Documents/projects/apogee/3rdParty/llvm-project/libc/src/__support/macros/config.h:39:59: note:expanded from macro 'LIBC_NAMESPACE_DECL'
39 | #define LIBC_NAMESPACE_DECL [[gnu::visibility("hidden")]] LIBC_NAMESPACE
| ^
<command line>:1:43: note: expanded from macro 'LIBC_NAMESPACE'
1 | #define LIBC_NAMESPACE __llvm_libc_19_1_0_-rc4
| ^
```
I'm not sure if this hyphen is mandatory for some part of the complete build process, but I know it should not appear in this case because hyphens aren't allowed when defining an identifier in C++
So, I don't know what will be better:
Should you simply consider to define the suffix as rc4 in LLVMVersion.cmake file and maybe add it in some way where it is required?
Should you consider to keep it in LLVMVersion.cmake file and remove it locally to define the default_namespace variable in libc/CMakeLists ?
Maybe could you consider to remove the _${LLVM_VERSION_SUFFIX} part when declaring the default_namespace? But, if you do, what about people building both rc3 and rc4 versions?
Choice is yours, but I really thing that something has to be done ;)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vltv4zgP_TXKCzGBI-fSPOQhlwaTD-1MMf120LdAluhYW9ny6tI2_35B2emkbTrYfVggNZJSJnkOD0kJ7_WhQVywyYpNNgMRQ2XdYhMb_6jvKm102-KgsOq4-IrGWMbXLNuwbLkLjM88CHhCd4SDtQpCpZsDBAsKS90ghArh5ubnLR3x2jagGxDgsRVOBIRSGwTGr2R0DptgjmRn-boQHqF19k-UAZR2LL9mfCtr8YiMb2urokHP-JZc_-w8D3vrfNgl1z2XjQJ9SvPgUATQCgVlKJSiVGJZ6hcw-hHByYeHB3iusIEgDgdC4tAg5SJFo7QSgaKuAX2LUgtjjv3pCo8gHEJpowNb0j_qN3msYiBu_Cme9hA9qgSXXxldSMa361vxiDfaBz8ML4Hx-RmRbJopLEU0Yd-IGn0rJLJpBsKTab835qnek58942M2WxEz-5_XP-5337_tb5f_-_6DzTYXbbtvn9rulv9ff_3Edv_Hdrt7YLMNm2bEyXOlZZW-aGOgwA7fGQB-5QOZdAOf4mXT7Ga3Wu-_LW-v7--W6-seIsnIixrhSZiIFCUQ78JD67B1VqL31nWhdCCdldbBW1cgGkVvlrpJlXuf3_vQ-831-qaPXyCJwdsaO4EnufT1Jfh57wQuuIDUVqtDE1m-ZPnySXtdaKPDkfErxnmllcKGcc74nE02bLKBDxx0oRLFHb_40mJD6f9K4t9GOZPMaL4f7bP9FyfHr8GChQOGjvnonI2NIuSv4ksMC2PSH_WxP6usd5LoBh1I8YXSDmWwTqM_b4o7ZwuDNTVDqEQAr5uDQaiOLRXXoFCeClRHE3RrEIqojQJ0zrpUgV_Yu0_6mcwsXyaKZE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