Global Definition Vs Global Declaration
zahed khurasani
sdzahed@gmail.com
Fri Apr 6 01:17:00 GMT 2012
> OK, I actually tried it. When I try this with current mainline, I see
> that DECL_EXTERNAL is set for "extern int j;" and is not set for "int
> i;". Also TREE_STATIC is set for "int i;" but not for "extern int j;".
Hmm strange. I am not sure if I am doing this wrong. Here's the sample
code that I am running this on:
// Global decls
static int staticint;
extern int extint;
int globalint;
int main(void)
{
int a[10],i, *p;
globalint=0;
return 1;
}
And here is the output from the plugin code:
Glob var: staticint decl_external:0 tree_static:1 complete:1 common: 0
Glob var: extint decl_external:1 tree_static:0 complete:1 common: 1
Glob var: globalint decl_external:1 tree_static:0 complete:1 common: 1
decl_external is set for both globalint and extint. I am trying this
with 4.6.2 source.
Thanks for your time. Appreciate it.
Zahed
More information about the Gcc-help
mailing list