Re: [PATCH 3/4] as-name: allow ident as address_space

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

 



On Sun, Dec 09, 2018 at 02:59:21AM +0000, Ramsay Jones wrote:
> On 08/12/2018 22:04, Luc Van Oostenryck wrote:
> > @@ -1094,17 +1094,48 @@ static struct token *attribute_bitwise(struct token *token, struct symbol *attr,
> >  	return token;
> >  }
> >  
> > +static int lookup_address_space(struct ident *ident)
> > +{
> > +	static int last_as;
> > +	int i;
> > +
> > +	for (i = 1; i < ARRAY_SIZE(address_space_names); i++) {
> 
> Hmm, i = 1 ? Is an address-space number 0 illegal?

Not exactly, it's the default address space and as such is never
displayed (and doesn't need a name).
 
> > +		const struct ident *name = address_space_names[i];
> > +		if (name == ident)
> > +			return i;
> > +		if (!name) {
> > +			address_space_names[i] = ident;
> > +			return last_as = i;
> > +		}
> > +	}
> > +	return ++last_as;
> 
> Hmm, so the table has overflowed? why are you returning this?

The idea was that if there is no more place for the names, at least
newer AS need an unique AS number.
 
> > +
> > +	if (Waddress_space && as)
> > +		ctx->ctype.as = as;
> 
> Hmm, so if -Wno-address_space, or as == 0, ignore address-space
> processing (ctx->ctype.as stays set to zero?).

Yes, for two different reasons:
* if -Wno-address-space we don't care at all about address spaces
  since we'll never warn about them.
* as == 0 is the default AS, the same as if no AS is given.

There is problem if someone write:
  attribute((address_space(1), address_space(0)))
but hey, let's say that it's undefined behaviour.

-- Luc



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux