public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* binds_local question
@ 2004-08-31  0:33 Mike Stump
  2004-08-31  1:13 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Stump @ 2004-08-31  0:33 UTC (permalink / raw)
  To: gcc@gcc.gnu.org List

In varasm.c we have:

   /* A variable is local if the user explicitly tells us so.  */
   else if (DECL_VISIBILITY_SPECIFIED (exp) && DECL_VISIBILITY (exp) != 
VISIBILITY_DEFAULT)
     local_p = true;
   /* Otherwise, variables defined outside this object may not be local. 
  */
   else if (DECL_EXTERNAL (exp))
     local_p = false;

I was wondering if a variable that was marked with a visibility for 
documentation purposes in a header file that was external, should be 
considered local or not.  I'd expect that it would not be local, but 
for that to be true, the two lines above would have to be swapped.

?  Any downside to swapping them?

Construct found in some darwin header files.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: binds_local question
  2004-08-31  0:33 binds_local question Mike Stump
@ 2004-08-31  1:13 ` Daniel Jacobowitz
  2004-08-31  2:50   ` Mike Stump
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-08-31  1:13 UTC (permalink / raw)
  To: Mike Stump; +Cc: gcc@gcc.gnu.org List

On Mon, Aug 30, 2004 at 05:12:56PM -0700, Mike Stump wrote:
> In varasm.c we have:
> 
>   /* A variable is local if the user explicitly tells us so.  */
>   else if (DECL_VISIBILITY_SPECIFIED (exp) && DECL_VISIBILITY (exp) != 
> VISIBILITY_DEFAULT)
>     local_p = true;
>   /* Otherwise, variables defined outside this object may not be local. 
>  */
>   else if (DECL_EXTERNAL (exp))
>     local_p = false;
> 
> I was wondering if a variable that was marked with a visibility for 
> documentation purposes in a header file that was external, should be 
> considered local or not.  I'd expect that it would not be local, but 
> for that to be true, the two lines above would have to be swapped.
> 
> ?  Any downside to swapping them?
> 
> Construct found in some darwin header files.

A variable with specified visibility should be "local" whether or not
it's defined in this translation unit - that's most of the point.  We
know it will bind within this dynamic object.

-- 
Daniel Jacobowitz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: binds_local question
  2004-08-31  1:13 ` Daniel Jacobowitz
@ 2004-08-31  2:50   ` Mike Stump
  2004-08-31  7:38     ` Richard Henderson
  2004-09-01  2:59     ` Mark Mitchell
  0 siblings, 2 replies; 5+ messages in thread
From: Mike Stump @ 2004-08-31  2:50 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gcc@gcc.gnu.org List

On Aug 30, 2004, at 5:33 PM, Daniel Jacobowitz wrote:
> A variable with specified visibility should be "local" whether or not
> it's defined in this translation unit - that's most of the point.

Ok, then Mark got this slightly wrong?!

*** ./config/darwin.c.~1~       Sat Aug 21 23:36:18 2004
--- ./config/darwin.c   Mon Aug 30 18:29:43 2004
*************** name_needs_quotes (const char *name)
*** 141,149 ****
   static int
   machopic_symbol_defined_p (rtx sym_ref)
   {
!   return ((SYMBOL_REF_FLAGS (sym_ref) & MACHO_SYMBOL_FLAG_DEFINED)
!         /* Local symbols must always be defined.  */
!         || SYMBOL_REF_LOCAL_P (sym_ref));
   }

   /* This module assumes that (const (symbol_ref "foo")) is a legal pic
--- 141,148 ----
   static int
   machopic_symbol_defined_p (rtx sym_ref)
   {
!   /* APPLE LOCAL machopic_symbol_defined_p bugfix */
!   return (SYMBOL_REF_FLAGS (sym_ref) & MACHO_SYMBOL_FLAG_DEFINED);
   }

   /* This module assumes that (const (symbol_ref "foo")) is a legal pic


:-(  Mark, was there some other spelling you liked/wanted/needed?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: binds_local question
  2004-08-31  2:50   ` Mike Stump
@ 2004-08-31  7:38     ` Richard Henderson
  2004-09-01  2:59     ` Mark Mitchell
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2004-08-31  7:38 UTC (permalink / raw)
  To: Mike Stump; +Cc: Daniel Jacobowitz, gcc@gcc.gnu.org List

On Mon, Aug 30, 2004 at 06:57:02PM -0700, Mike Stump wrote:
>   machopic_symbol_defined_p (rtx sym_ref)
>   {
> -   return ((SYMBOL_REF_FLAGS (sym_ref) & MACHO_SYMBOL_FLAG_DEFINED)
> -         /* Local symbols must always be defined.  */
> -         || SYMBOL_REF_LOCAL_P (sym_ref));
> +   /* APPLE LOCAL machopic_symbol_defined_p bugfix */
> +   return (SYMBOL_REF_FLAGS (sym_ref) & MACHO_SYMBOL_FLAG_DEFINED);
>   }

From the names of the symbols involved, this looks correct.


r~

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: binds_local question
  2004-08-31  2:50   ` Mike Stump
  2004-08-31  7:38     ` Richard Henderson
@ 2004-09-01  2:59     ` Mark Mitchell
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Mitchell @ 2004-09-01  2:59 UTC (permalink / raw)
  To: Mike Stump; +Cc: Daniel Jacobowitz, gcc@gcc.gnu.org List

Mike Stump wrote:

> On Aug 30, 2004, at 5:33 PM, Daniel Jacobowitz wrote:
>
>> A variable with specified visibility should be "local" whether or not
>> it's defined in this translation unit - that's most of the point.
>
>
> Ok, then Mark got this slightly wrong?!

Mike, you sound so amazed.  I've gotten things wrong before. :-)

> :-(  Mark, was there some other spelling you liked/wanted/needed?

I think I thought that "local" meant "within this translation unit".

-- 
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-09-01  2:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-31  0:33 binds_local question Mike Stump
2004-08-31  1:13 ` Daniel Jacobowitz
2004-08-31  2:50   ` Mike Stump
2004-08-31  7:38     ` Richard Henderson
2004-09-01  2:59     ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).