Linux-Sparse Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] predefine: add a macro telling about named address spaces
@ 2020-06-16  0:50 Luc Van Oostenryck
  2020-06-16 19:13 ` Linus Torvalds
  0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-06-16  0:50 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck

Sparse supports named address spaces since v0.6.0-rc1.
This gives much nicer warnings ('... __user' instead of '... <asn:1>')
but this featres is not yet used in the kernel since it could be
a problem for people using an older version of Sparse.

So, add a define which can be used to check if named address spaces
are supported or not.

I should have done this a long time ago!

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 lib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib.c b/lib.c
index 951d400ea2fa..ebbcd3b150aa 100644
--- a/lib.c
+++ b/lib.c
@@ -1295,6 +1295,7 @@ static void predefined_ctype(const char *name, struct symbol *type, int flags)
 static void predefined_macros(void)
 {
 	predefine("__CHECKER__", 0, "1");
+	predefine("__SPARSE_HAS_NAMED_ADDRESS_SPACE__", 0, "1");
 	predefine("__GNUC__", 1, "%d", gcc_major);
 	predefine("__GNUC_MINOR__", 1, "%d", gcc_minor);
 	predefine("__GNUC_PATCHLEVEL__", 1, "%d", gcc_patchlevel);
-- 
2.27.0

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

* Re: [PATCH] predefine: add a macro telling about named address spaces
  2020-06-16  0:50 [PATCH] predefine: add a macro telling about named address spaces Luc Van Oostenryck
@ 2020-06-16 19:13 ` Linus Torvalds
  2020-06-16 20:51   ` Luc Van Oostenryck
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2020-06-16 19:13 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Sparse Mailing-list

On Mon, Jun 15, 2020 at 5:50 PM Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>
> Sparse supports named address spaces since v0.6.0-rc1.
> This gives much nicer warnings ('... __user' instead of '... <asn:1>')
> but this featres is not yet used in the kernel since it could be
> a problem for people using an older version of Sparse.

Actually, I think it's more that nobody has sent a tested patch.

I don't think it's a big burden to say "you need a newer version of
sparse" for kernel checkers, and in fact a number of the problems
people report then get answered with "update your sparse version"
anyway for other reasons.

In fact, I'd personally like to just make the kernel use _Generic()
everywhere now that we started getting our toes wet, but the fact that
we would have to require gcc-4.9 (instead of gcc-4.8 which is
currently the minimum version) is holding us back.

So I'd be perfectly happy to take a patch to do the ASN names, and to
remove the __CHECKER__ thing that holds us back from using _Generic()
with sparse. And just document that you need to have a recent enough
release..

             Linus

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

* Re: [PATCH] predefine: add a macro telling about named address spaces
  2020-06-16 19:13 ` Linus Torvalds
@ 2020-06-16 20:51   ` Luc Van Oostenryck
  0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-06-16 20:51 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Sparse Mailing-list

On Tue, Jun 16, 2020 at 12:13:18PM -0700, Linus Torvalds wrote:
> On Mon, Jun 15, 2020 at 5:50 PM Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> >
> > Sparse supports named address spaces since v0.6.0-rc1.
> > This gives much nicer warnings ('... __user' instead of '... <asn:1>')
> > but this featres is not yet used in the kernel since it could be
> > a problem for people using an older version of Sparse.
> 
> Actually, I think it's more that nobody has sent a tested patch.

Yes, I should have done this many months ago. I admit that it bothers
me when people complain that something doesn't work with sparse and
it's just that they using an old version (sometimes quite old).
 
> I don't think it's a big burden to say "you need a newer version of
> sparse" for kernel checkers, and in fact a number of the problems
> people report then get answered with "update your sparse version"
> anyway for other reasons.
> 
> In fact, I'd personally like to just make the kernel use _Generic()
> everywhere now that we started getting our toes wet, but the fact that
> we would have to require gcc-4.9 (instead of gcc-4.8 which is
> currently the minimum version) is holding us back.
> 
> So I'd be perfectly happy to take a patch to do the ASN names, and to
> remove the __CHECKER__ thing that holds us back from using _Generic()
> with sparse. And just document that you need to have a recent enough
> release..

OK. The one for the ASNs is already prepared anyway and I'll do the
one for _Generic() tomorrow.

-- Luc

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16  0:50 [PATCH] predefine: add a macro telling about named address spaces Luc Van Oostenryck
2020-06-16 19:13 ` Linus Torvalds
2020-06-16 20:51   ` Luc Van Oostenryck

Linux-Sparse Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-sparse/0 linux-sparse/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-sparse linux-sparse/ https://lore.kernel.org/linux-sparse \
		linux-sparse@vger.kernel.org
	public-inbox-index linux-sparse

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-sparse


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git