address_space and noderef on non-pointer types

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

 



Is it valid to apply the sparse attributes 'noderef' or 'address_space'
to non-pointers, and if so, what does this mean?

I see examples of using them on non-pointers in sparse's own test
suite.

For example, in:
https://git.kernel.org/pub/scm/devel/sparse/sparse.git/tree/validation/type-attribute-as.c
"struct s" is annotated with
  __attribute__((address_space(__as)))

Similarly, there's
https://git.kernel.org/pub/scm/devel/sparse/sparse.git/tree/validation/noderef.c#n18
where sparse accepts:
  struct x __A x;
e.g.:
  struct x __attribute__((noderef)) x;

The docs for noderef: 
https://git.kernel.org/pub/scm/devel/sparse/sparse.git/tree/Documentation/annotations.rst#n54
say:
"This attribute is to be used on a r-value to specify it cannot be
dereferenced. A pointer so annotated is in all other aspects exactly
like a pointer  but trying to actually access anything through it will
cause a warning."
What is the intended meaning of "noderef" for a non-pointer?

Similarly, the docs for "address_space" say:
"This attribute is to be used on pointers to specify that its target is
in address space *name* (an identifier or a constant integer)."

but don't specify what it means to use in on a non-pointer.

Sorry if this is a silly question.

The background here is that I'm a GCC developer and have been
experimenting with implementing some sparse attributes and warnings
"natively" in GCC; see e.g. the RFE in GCC bugzilla for implementing
address_space, noderef and force here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59850 ; I'm trying to get
my patched GCC to handle Sparse's own test suite and hence running into
this issue.

Thanks
Dave





[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