Re: Global Definition Vs Global Declaration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



zahed khurasani <sdzahed@xxxxxxxxx> writes:

> Yes this is C and no am not using the -fno-common option. However,
> DECL_COMMON is returning non-zero for both cases. Its zero only for a
> declaration that includes 'static'.

Hmmm, looking at the code, that could be true.

I don't know if there is a way to distinguish these two cases.  I assume
you've tried passing both decls to debug_tree to see if it shows any
difference.

Ian


> On Wed, Apr 4, 2012 at 2:39 PM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
>> zahed khurasani <sdzahed@xxxxxxxxx> writes:
>>
>>> How can I distinguish between the following two declarations (both
>>> appear outside any function at file scope)?
>>>
>>> extern int i;
>>> int i;
>>>
>>> Both show up as VAR_DECL nodes in the BLOCK_VARS of the
>>> TRANSLATION_UNIT_DECL. Moreover, both return true for DECL_EXTERNAL. I
>>> need a way to say which is which in my plugin code.
>>
>> I assume this is C, not C++, and that you are not using the -fno-common
>> option.  The "int i;" will be DECL_COMMON.
>>
>> Ian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux