KEMBAR78
Run C preprocessor in C11 mode by kinke · Pull Request #4933 · ldc-developers/ldc · GitHub
Skip to content

Conversation

@kinke
Copy link
Member

@kinke kinke commented May 17, 2025

the-horo added 4 commits May 17, 2025 13:48
It should fix running clang-cpp on linux x86_64.

This involves moving some linux+aarch64 fixes to linux+clang since
clang was the actual issue.

See-also: dlang/dmd#15320
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
It happens with both clang and gcc. Tested with ldc2

Part of the full error:
```
Error: undefined identifier `__Float32x4_t`
Error: undefined identifier `__Float64x2_t`
Error: undefined identifier `__SVFloat32_t`
Error: undefined identifier `__SVFloat64_t`
Error: undefined identifier `__SVBool_t`
/usr/include/bits/math-vector.h(162): Error: undefined identifier `__Float32x4_t`
__attribute__ ((__aarch64_vector_pcs__)) __f32x4_t _ZGVnN4vv_atan2f (__f32x4_t, __f32x4_t);
                                                                                          ^
/usr/include/bits/math-vector.h(162): Error: undefined identifier `__Float32x4_t`
__attribute__ ((__aarch64_vector_pcs__)) __f32x4_t _ZGVnN4vv_atan2f (__f32x4_t, __f32x4_t);
                                                                                          ^
/usr/include/bits/math-vector.h(162): Error: undefined identifier `__Float32x4_t`
__attribute__ ((__aarch64_vector_pcs__)) __f32x4_t _ZGVnN4vv_atan2f (__f32x4_t, __f32x4_t);
                                                                                          ^
/usr/include/bits/math-vector.h(163): Error: undefined identifier `__Float32x4_t`
__attribute__ ((__aarch64_vector_pcs__)) __f32x4_t _ZGVnN4v_acosf (__f32x4_t);
                                                                             ^
/usr/include/bits/math-vector.h(163): Error: undefined identifier `__Float32x4_t`
__attribute__ ((__aarch64_vector_pcs__)) __f32x4_t _ZGVnN4v_acosf (__f32x4_t);
                                                                             ^
```

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
Stay consistent with the rest of the preprocessor conditionals by
checking for __linux__ instead of linux. Additionally, the former also
works with -std=c11 whereas the latter only works with -std=gnu11.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
With -std=c11, on linux, alloca no longer comes from stdlib.h.

Also fix the URL bug number which never pointed to the right one.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
@kinke kinke marked this pull request as ready for review May 17, 2025 12:24
@kinke kinke marked this pull request as draft May 17, 2025 13:15
@kinke kinke force-pushed the cpp_fixes branch 2 times, most recently from b6ce93b to c9bf59f Compare May 18, 2025 13:40
@kinke kinke marked this pull request as ready for review May 18, 2025 13:41
kinke added 2 commits May 18, 2025 16:50
Apparently needed with `/std:c11` and Microsoft cl.exe at least:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\setjmp.h(170): Error: extended-decl-modifier expected after `__declspec(`, saw `_Noreturn` instead
    __declspec(_Noreturn ) void  longjmp(
               ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\intrin.h(204): Error: extended-decl-modifier expected after `__declspec(`, saw `_Noreturn` instead
__declspec(_Noreturn) void __fastfail(unsigned int);
           ^
@kinke kinke enabled auto-merge May 18, 2025 15:01
@kinke
Copy link
Member Author

kinke commented May 18, 2025

Main reason for the eager cherry-pick: dlang/dmd#21311 - importC basically broke with gcc 15 and its changed default C standard. The upstream fixes land in v2.113 AFAICT.

@kinke kinke merged commit 2582b12 into ldc-developers:master May 18, 2025
19 of 20 checks passed
@kinke kinke deleted the cpp_fixes branch May 18, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants