-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check the TagDecl in TypedefNameDecl for extra attributes
Some typedef definitions have attributes that are applied to the TagDecl it defines to. For example: ``` typedef union { struct sockaddr *__restrict __sockaddr__; } __SOCKADDR_ARG __attribute__((__transparent_union__)); ``` Here, __attribute__((__transparent_union__)) is applied to the union, not the typedef. Hence we also need to search for the TagDecl (the union in this case) for the extra attributes. Signed-off-by: Giuliano Belinassi <[email protected]>
- Loading branch information
1 parent
9a3c295
commit ecb30ae
Showing
2 changed files
with
42 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* { dg-options "-DCE_EXTRACT_FUNCTIONS=main -DCE_NO_EXTERNALIZATION" }*/ | ||
|
||
typedef unsigned short int sa_family_t; | ||
typedef unsigned int __socklen_t; | ||
typedef __socklen_t socklen_t; | ||
typedef int ares_socket_t; | ||
typedef socklen_t ares_socklen_t; | ||
|
||
struct sockaddr { | ||
sa_family_t sa_family; | ||
char sa_data[14]; | ||
}; | ||
|
||
typedef union { | ||
struct sockaddr *__restrict __sockaddr__; | ||
} __SOCKADDR_ARG __attribute__((__transparent_union__)); | ||
|
||
extern int getsockname(int __fd, __SOCKADDR_ARG __addr, | ||
socklen_t *__restrict __len) | ||
__attribute__((__nothrow__)); | ||
|
||
int main(void) { | ||
struct sockaddr *src_addr; | ||
ares_socket_t sock; | ||
ares_socklen_t len; | ||
getsockname(sock, src_addr, &len); | ||
} | ||
|
||
/* { dg-final { scan-tree-dump "__attribute__\(\(__transparent_union__\)\)" } } */ |