-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attribute: do not apply vector_size to enums
clang silently ignores the attribute; GCC issues an error diagnostic Fixes #658
- Loading branch information
Showing
5 changed files
with
56 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
typedef: 'invalid' | ||
name: invalid1 | ||
|
||
typedef: 'float' | ||
name: invalid2 | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//aro-args --emulate=clang | ||
enum E { | ||
is_deprecated __attribute__((deprecated)), | ||
is_deprecated_with_msg __attribute__((deprecated("I am deprecated"))), | ||
is_unavailable __attribute__((unavailable)), | ||
is_unavailable_with_msg __attribute__((unavailable("I am not available"))), | ||
newval, | ||
}; | ||
|
||
void foo(void) { | ||
int a = newval; | ||
a = is_deprecated; | ||
a = is_deprecated_with_msg; | ||
a = is_unavailable; | ||
a = is_unavailable_with_msg; | ||
} | ||
|
||
enum __attribute__((aligned(16))) Attributed { | ||
Val, | ||
}; | ||
_Static_assert(_Alignof(enum Attributed) == 16, "enum align"); | ||
|
||
enum Trailing { | ||
Foo | ||
} __attribute__((aligned(32))); | ||
_Static_assert(_Alignof(enum Trailing) == 32, "enum align"); | ||
|
||
enum __attribute__((vector_size(32))) VectorSize1; | ||
|
||
enum __attribute__((vector_size(32))) VectorSize2 { | ||
A | ||
}; | ||
|
||
|
||
#define EXPECTED_ERRORS "enum attributes clang.c:12:7: warning: 'is_deprecated' is deprecated [-Wdeprecated-declarations]" \ | ||
"enum attributes clang.c:3:33: note: 'is_deprecated' has been explicitly marked deprecated here" \ | ||
"enum attributes clang.c:13:7: warning: 'is_deprecated_with_msg' is deprecated: I am deprecated [-Wdeprecated-declarations]" \ | ||
"enum attributes clang.c:4:42: note: 'is_deprecated_with_msg' has been explicitly marked deprecated here" \ | ||
"enum attributes clang.c:14:7: error: 'is_unavailable' is unavailable" \ | ||
"enum attributes clang.c:5:34: note: 'is_unavailable' has been explicitly marked unavailable here" \ | ||
"enum attributes clang.c:15:7: error: 'is_unavailable_with_msg' is unavailable: I am not available" \ | ||
"enum attributes clang.c:6:44: note: 'is_unavailable_with_msg' has been explicitly marked unavailable here" \ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//aro-args --emulate=gcc | ||
|
||
enum __attribute__((vector_size(32))) VectorSize2 { | ||
A | ||
}; | ||
|
||
#define EXPECTED_ERRORS "enum attributes gcc.c:3:21: error: invalid vector element type 'enum VectorSize2'" \ | ||
|
This file was deleted.
Oops, something went wrong.