-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] allow const structs/unions/arrays to be constant expressions …
…for C For code like: struct foo { ... }; struct bar { struct foo foo; }; const struct foo my_foo = { ... }; struct bar my_bar = { .foo = my_foo }; Eli Friedman points out the relevant part of the C standard seems to have some flexibility in what is considered a constant expression: 6.6 paragraph 10: An implementation may accept other forms of constant expressions. GCC 8 added support for these, so clang not supporting them has been a constant thorn in the side of source code portability within the Linux kernel. Fixes: #44502 Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D76096 (cherry picked from commit 610ec95)
- Loading branch information
1 parent
3ada195
commit 0b2d5b9
Showing
6 changed files
with
77 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters