diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2018-05-24 16:01:30 +0200 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2018-05-26 11:05:13 +0200 |
commit | 9dc1505c01a5748cdd5cac9d978645e2fbc0773c (patch) | |
tree | 6a75c4cb0b096b5744603e37dc4491ac324da8db /cfrontend/C2C.ml | |
parent | 2b2585f39000f7000f296bc5b35c14e70f0c31fe (diff) | |
download | compcert-9dc1505c01a5748cdd5cac9d978645e2fbc0773c.tar.gz compcert-9dc1505c01a5748cdd5cac9d978645e2fbc0773c.zip |
Preserve storage class for functions declared within a block
This is a follow-up to the introduction of the Storage_auto storage class
in commit 760e422.
For functions declared within a block, we used to set their storage class
to "extern":
{ {
int f(void); ---> extern int f(void);
} }
This helped enter_or_refine_ident understand that those declarations
have linkage.
Now that we have Storage_auto, this commit teaches enter_or_refine_ident
that local declarations have no linkage if auto or static, and have
linkage if extern or default.
Then, there is no need to change storage class to extern for
locally-declared functions.
In turn, this improves the "extern-after-definition" warning recently
introduced, avoiding a bizarre warning in the following case:
int foo(void){return 0;}
int main(void){
int foo(void);
return foo();
}
Diffstat (limited to 'cfrontend/C2C.ml')
0 files changed, 0 insertions, 0 deletions