Re: [PATCH] cgcc: teach cgcc about GNU/kFreeBSD

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

 



On Thu, Sep 14, 2017 at 10:17:42PM +0200, Uwe Kleine-König wrote:
> On Thu, Sep 14, 2017 at 10:03:27PM +0200, Uwe Kleine-König wrote:
> > ---
> >  cgcc | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/cgcc b/cgcc
> > index a8d7b4f217fe..0ab54f943578 100755
> > --- a/cgcc
> > +++ b/cgcc
> > @@ -235,6 +235,9 @@ sub add_specs {
> >      } elsif ($spec eq 'linux') {
> >  	return &add_specs ('unix') .
> >  	    ' -D__linux__=1 -D__linux=1 -Dlinux=linux';
> > +    } elsif ($spec eq 'gnu/kfreebsd') {
> > +	return &add_specs ('unix') .
> > +	    ' -D__FreeBSD_kernel__=1'
> >      } elsif ($spec eq 'openbsd') {
> >  	return &add_specs ('unix') .
> >  	    ' -D__OpenBSD__=1';
> 
> Alternatively to adding support for all platforms by hand, why not
> use the output of
> 
> 	cpp -dM < /dev/null
> 
> to get the predefined macros? On my Linux amd64 box it gives quite a
> list, but I think this doesn't hurt, does it?

The problem I see by doing this is that some or lots of these
predefined macros mean, directly or not, "we support this feature"
while sparse in fact doesn't support it.

It already can create problems of defining the __GCC__/__GCC_MINOR__,
thus pretending to be this GCC version.

OTOH, I already begun to extend sparse's own predefined macros.
You can check it by looking at the output of:
	sparse -E -dD - < /dev/null

So, I think it's best to:
- not adding the output of cpp -dM to cgcc
- continue to add to sparse itself any predefined macro
  that would be needed
- for the moment, keep cgcc for dealing with arch specificities
- later we can add something like a '-m<arch>' flag to sparse itself
  (but most probably we'll need to ue the full triplet, or use a config
  file or ...)


Best regards,
-- Luc Van Oostenryck
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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