-
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.
Fix Late Externalization when variable is declared as macro expansion
In the case where a variable is declared as a consequence of a macro expansion, as an example: ``` #include "lateext-7.h" DEFINE_STATIC_KEY_FALSE(aaa); ``` What happens is that when trying to get the FileID of `aaa` it returns the FileID for the include file rather than the main file. Hence make sure it gets the expansion location rather than the spelling location. Signed-off-by: Giuliano Belinassi <[email protected]>
- Loading branch information
1 parent
733a1a2
commit c69e9ff
Showing
5 changed files
with
55 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* { dg-options "-DCE_EXTRACT_FUNCTIONS=f -DCE_LATE_EXTERNALIZE -DCE_EXPORT_SYMBOLS=aaa -DCE_KEEP_INCLUDES" }*/ | ||
|
||
#include "lateext-7.h" | ||
|
||
DEFINE_STATIC_KEY_FALSE(aaa); | ||
|
||
int f(void) | ||
{ | ||
return aaa.key; | ||
} | ||
|
||
/* { dg-final { scan-tree-dump-not "DEFINE_STATIC_KEY_FALSE\(\*klpe_aaa\)" } } */ | ||
/* { dg-final { scan-tree-dump "static struct AA \*klpe_aaa;" } } */ |
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,13 @@ | ||
struct AA { | ||
int key; | ||
}; | ||
|
||
int g(void); | ||
|
||
extern struct AA aaa; | ||
|
||
#define STATIC_KEY_FALSE_INIT (struct AA){ .key = 0, } | ||
|
||
#define DEFINE_STATIC_KEY_FALSE(name) \ | ||
struct AA name = STATIC_KEY_FALSE_INIT | ||
|