This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from abusalimov/24-compound-def
Improve detection of definitions of compounds (enum / struct / union)
- Loading branch information
Showing
2 changed files
with
53 additions
and
11 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,41 @@ | ||
struct name { }; | ||
|
||
struct name { | ||
}; | ||
struct /* comment */ name /* comment */ { }; | ||
|
||
struct name | ||
{ }; | ||
struct name \ | ||
{ }; | ||
struct /* comment */ name // comment | ||
{ }; | ||
|
||
/* type-definition inside parens and block. */ | ||
void function(struct name {} arg); | ||
void function(struct /* comment */ name /* comment */ { } arg) { | ||
struct name { }; | ||
struct name | ||
{ }; | ||
struct name \ | ||
{ }; | ||
struct /* comment */ name // comment | ||
{ }; | ||
} | ||
|
||
struct name * | ||
create_struct(void) { } | ||
|
||
|
||
/* FALSE POSITIVES */ | ||
|
||
struct name | ||
create_struct(void); | ||
|
||
struct name | ||
create_struct(void) { } | ||
|
||
struct name // the compound meta block shouldn't span | ||
create_struct(void) { } | ||
|
||
struct __packed __aligned(16) name { }; // function __aligned |