Call C preprocessor with -std=c11 on posix#21372
Conversation
|
Thanks for your pull request and interest in making D better, @the-horo! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#21372" |
| // https://issues.dlang.org/show_bug.cgi?id=24187 | ||
|
|
||
| #ifdef linux | ||
| #ifdef __linux__ |
There was a problem hiding this comment.
Ah okay, so that's what made -std=gnu11 required with the GNU cpp?
There was a problem hiding this comment.
Basically, yes:
[happy@happypc] ~ % gcc -E -std=gnu11 -dD -xc /dev/null | grep linux
#define __gnu_linux__ 1
#define __linux 1
#define __linux__ 1
#define linux 1
[happy@happypc] ~ % gcc -E -std=c11 -dD -xc /dev/null | grep linux
#define __gnu_linux__ 1
#define __linux 1
#define __linux__ 1
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 <[email protected]>
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 <[email protected]>
Don't rely on the default -std value since gcc/clang updates may lead to breakages. Additionally, the default value for both compiler vendors, on linux at least, is a gnu variant rather then the ISO standard. Closes: dlang#21311 Signed-off-by: Andrei Horodniceanu <[email protected]>
46203a9 to
d1aeeb7
Compare
Like #21349 but uses
-std=c11instead of-std=gnu11