Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: "Uwe Kleine-König" <uwe@kleine-koenig.org>
Cc: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>,
	Santiago Vila <sanvila@debian.org>,
	906472@bugs.debian.org, linux-sparse@vger.kernel.org,
	Adrian Bunk <bunk@debian.org>
Subject: Bug#906472: horst: FTBFS in buster/sid (unable to open 'stdarg.h')
Date: Tue, 25 Sep 2018 19:06:02 +0200	[thread overview]
Message-ID: <20180925170601.gonqbd6eatgd5rzj@ltop.local> (raw)
In-Reply-To: <8160e494-8548-761c-07c0-83aa0b97b075@kleine-koenig.org>

On Tue, Sep 25, 2018 at 04:38:01PM +0200, Uwe Kleine-König wrote:
> > By *default*, if no -gcc-base-dir is used, sparse use the same dir
> > as the one used by the GCC used to compile sparse itself. It's only
> > this default that is hardcoded.
> 
> I wasn't sure if this is expected to work. I had in mind, that the
> version of gcc is used somewhere but couldn't find proof for that.

Several other flags have their default value corresponding to the
GCC used to compile sparse: for example the architecture (x86, x86-64)
or the endianness. The one you're thinking about is probably the macros
for the GCC version: __GNUC__, __GNUC_MINOR__ & __GNUC_PATCHLEVEL__.

As far as I know, everything that should matter can be set explicitly
either by defining the macro via -D...=... or an explicit flag like
-m{32,64}, -m{little,big}-endian, -funsigned-char, ...

When using sparse for userspace code, it may be best to use the cgcc
wrapper since it take care to set (some of) these values. I'm saying
'may' because personnaly, I have no experience of using sparse via
cgcc (as an user, I've only used sparse for OS or bare-metal code)
but I know others use it like so (for example for git).

> > In case the default can't be used, like here, I think the best is
> > to add in your Makefile something like:
> > 	GCC_BASE_DIR=$(shell $(CC) -print-file-name=)
> > 	SPARSE_FLAGS= -gcc-base-dir $(GCC_BASE_DIR)
> > 	...
> > 		sparse $(SPARSE_FLAGS) ...
> 
> IMHO it is sensible to let sparse depend on (or at least recommend) gcc.
> And then the default value should be right.
> 
> > This doesn't need to be done at each invocation of sparse (but will be done
> > at each top-level make invocation).
> 
> I'd say you'd need := for this effect instead of =.

Yes, indeed.

> Best regards and thanks for your valuable input,
> Uwe

You're very welcome,
-- Luc

      reply	other threads:[~2018-09-25 17:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1535227396@msgid.manchmal.in-ulm.de>
     [not found] ` <E1fqkJB-0004Wc-55@paradis.debian.org>
     [not found]   ` <20180914140409.GA25593@localhost>
2018-09-14 19:45     ` Bug#906472: horst: FTBFS in buster/sid (unable to open 'stdarg.h') Uwe Kleine-König
2018-09-24 16:23       ` Luc Van Oostenryck
2018-09-25 14:38         ` Uwe Kleine-König
2018-09-25 17:06           ` Luc Van Oostenryck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180925170601.gonqbd6eatgd5rzj@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=906472@bugs.debian.org \
    --cc=bunk@debian.org \
    --cc=debian.axhn@manchmal.in-ulm.de \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sanvila@debian.org \
    --cc=uwe@kleine-koenig.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox