-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang] allow restrict qualifier for array types with pointer types as element types #120896
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
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
295df25
[Clang] allow restrict qualifier for array types with pointer types a…
a-tarasyuk 2165846
Merge branch 'main' into fix/92847
a-tarasyuk 34d359e
Merge branch 'main' into fix/92847
a-tarasyuk 0bd41e6
Merge branch 'main' into fix/92847
a-tarasyuk 13ca652
Merge branch 'main' into fix/92847
a-tarasyuk d718e08
Merge branch 'main' into fix/92847
a-tarasyuk 4346935
Merge branch 'main' into fix/92847
a-tarasyuk 9e8dcdb
add additional tests
a-tarasyuk 1495465
Merge branch 'fix/92847' of https://github.com/a-tarasyuk/llvm-projec…
a-tarasyuk 700d23e
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk 7c85906
adjust array handling for clearer inner type check
a-tarasyuk 82a8cf1
Merge branch 'main' into fix/92847
a-tarasyuk 2dd3d22
eliminate recursion in type qualification handling
a-tarasyuk 67e045d
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk ec17c32
Merge branch 'fix/92847' of https://github.com/a-tarasyuk/llvm-projec…
a-tarasyuk 0f097e7
cleanup
a-tarasyuk 152ca6d
Merge branch 'main' into fix/92847
a-tarasyuk 10ed4c2
cleanup
a-tarasyuk 62f4c33
add additional test case
a-tarasyuk 90b92a5
Merge branch 'fix/92847' of https://github.com/a-tarasyuk/llvm-projec…
a-tarasyuk 31c0d88
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk 2554ca7
Merge branch 'main' into fix/92847
a-tarasyuk f66627b
add additional diagnostics
a-tarasyuk 78833ba
Merge branch 'fix/92847' of https://github.com/a-tarasyuk/llvm-projec…
a-tarasyuk a2b4193
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk b3fbbbd
update diagnostic messages
a-tarasyuk 417f3c9
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk 1bd2f01
update C2x diagnostic handling logic
a-tarasyuk e9fa671
Merge branch 'main' into fix/92847
a-tarasyuk 33c24e3
Merge branch 'main' into fix/92847
a-tarasyuk 707e807
Merge branch 'main' into fix/92847
a-tarasyuk 88b2b07
cleanup duplicate error messages
a-tarasyuk edaaeb1
update test to remove useless errors
a-tarasyuk bc9e0de
change code styles
a-tarasyuk 5891ded
Merge branch 'fix/92847' of https://github.com/a-tarasyuk/llvm-projec…
a-tarasyuk d7de475
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk ebf1dea
Merge branch 'main' into fix/92847
a-tarasyuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// RUN: %clang_cc1 -std=c23 -fsyntax-only -verify %s | ||
// RUN: %clang_cc1 -std=c17 -fsyntax-only -pedantic -verify=pedantic,expected %s | ||
// RUN: %clang_cc1 -std=c2x -fsyntax-only -Wpre-c2x-compat -verify=c2x-compat,expected %s | ||
|
||
typedef int (*T1)[2]; | ||
restrict T1 t1; | ||
|
||
typedef int *T2[2]; | ||
restrict T2 t2; // pedantic-warning {{'restrict' qualifier on an array of pointers is a C23 extension}} \ | ||
// c2x-compat-warning {{'restrict' qualifier on an array of pointers is incompatible with C standards before C23}} | ||
|
||
typedef int *T3[2][2]; | ||
restrict T3 t3; // pedantic-warning {{'restrict' qualifier on an array of pointers is a C23 extension}} \ | ||
// c2x-compat-warning {{'restrict' qualifier on an array of pointers is incompatible with C standards before C23}} | ||
|
||
typedef int (*t4)(); // pedantic-warning {{a function declaration without a prototype is deprecated in all versions of C}} | ||
typedef t4 t5[2]; | ||
typedef t5 restrict t6; // // expected-error-re {{pointer to function type 'int {{\((void)?\)}}' may not be 'restrict' qualified}} | ||
|
||
typedef int t7[2]; | ||
typedef t7 restrict t8; // expected-error {{restrict requires a pointer or reference ('t7' (aka 'int[2]') is invalid)}} |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// RUN: %clang_cc1 -std=c2y -fsyntax-only -verify -pedantic %s | ||
|
||
typedef int (*T1)[2]; | ||
restrict T1 t1; | ||
static_assert(_Generic(typeof (t1), int (*restrict)[2] : 1, default : 0)); | ||
|
||
typedef int *T2[2]; | ||
restrict T2 t2; | ||
static_assert(_Generic(typeof (t2), int *restrict[2] : 1, default : 0)); | ||
|
||
typedef int *T3[2][2]; | ||
restrict T3 t3; | ||
static_assert(_Generic(typeof (t3), int *restrict[2][2] : 1, default : 0)); | ||
static_assert(_Generic(void(T3 restrict), void(int *restrict (*)[2]): 1, default: 0)); | ||
|
||
typedef int (*t4)(); | ||
typedef t4 t5[2]; | ||
typedef t5 restrict t6; // expected-error {{pointer to function type 'int (void)' may not be 'restrict' qualified}} | ||
|
||
typedef int t7[2]; | ||
typedef t7 restrict t8; // expected-error {{restrict requires a pointer or reference ('t7' (aka 'int[2]')}} |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.