zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] Use CC to determine if gcc is used
Date: Mon, 27 Apr 2015 13:30:33 +0000	[thread overview]
Message-ID: <20150427133033.GC1863@tarsus.local2> (raw)
In-Reply-To: <20150427100756.12c82959@pwslap01u.europe.root.pri>

Peter Stephenson wrote on Mon, Apr 27, 2015 at 10:07:56 +0100:
> On Mon, 27 Apr 2015 09:47:42 +0100
> Peter Stephenson <p.stephenson@samsung.com> wrote:
> > That's probably OK, but rather than test CC when using CPP, it might be
> > simpler just to test if $(CPP) contains "gnu" as an alternative to
> > "gcc"?

What happens if $(CPP) is set to simply the string 'cpp'?

> 
> ... Or is this safer?
> 
> diff --git a/Src/zsh.mdd b/Src/zsh.mdd
> index 71dd613..820fcab 100644
> --- a/Src/zsh.mdd
> +++ b/Src/zsh.mdd
> @@ -28,8 +28,8 @@ hdrdeps="zshcurses.h zshterm.h"
>  # on the option to remove them being the same.
>  signames.c: signames1.awk signames2.awk ../config.h @SIGNAL_H@
>  	$(AWK) -f $(sdir)/signames1.awk @SIGNAL_H@ >sigtmp.c
> -	case "$(CPP)" in \
> -	gcc*) \
> +	case "`$(CPP) --version 2>&1`" in \
> +	*GCC*) \

This would false negative on my system:

	% cpp --version
	cpp (SUSE Linux) 4.8.1 20130909 [gcc-4_8-branch revision 202388]
	Copyright (C) 2013 Free Software Foundation, Inc.
	This is free software; see the source for copying conditions.  There is NO
	warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

On another system I see:

	% cpp --version
	cpp (GCC) 4.2.1 20070831 patched [FreeBSD]
	Copyright (C) 2007 Free Software Foundation, Inc.
	This is free software; see the source for copying conditions.  There is NO
	warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

So I guess the parenthetical is distro-configurable.  The second line
is constant, though.

Or we could bypass the "Is this a GNU CPP" problem entirely:

[[[
diff --git Src/zsh.mdd Src/zsh.mdd
index 71dd613..8b6842d 100644
--- Src/zsh.mdd
+++ Src/zsh.mdd
@@ -28,12 +28,7 @@ hdrdeps="zshcurses.h zshterm.h"
 # on the option to remove them being the same.
 signames.c: signames1.awk signames2.awk ../config.h @SIGNAL_H@
        $(AWK) -f $(sdir)/signames1.awk @SIGNAL_H@ >sigtmp.c
-       case "$(CPP)" in \
-       gcc*) \
-       $(CPP) -P sigtmp.c >sigtmp.out;; \
-       *) \
-       $(CPP) sigtmp.c >sigtmp.out;; \
-       esac
+       $(CPP) sigtmp.c | grep -v '^ *# *line [0-9]\+' >sigtmp.out
        $(AWK) -f $(sdir)/signames2.awk sigtmp.out > $@
        rm -f sigtmp.c sigtmp.out
 
]]]

(Haven't tested this, sorry.)

Daniel

>  	$(CPP) -P sigtmp.c >sigtmp.out;; \
>  	*) \
>  	$(CPP) sigtmp.c >sigtmp.out;; \
> 
> pws


  reply	other threads:[~2015-04-27 13:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-26 17:48 Heiko Becker
2015-04-27  8:47 ` Peter Stephenson
2015-04-27  9:07   ` Peter Stephenson
2015-04-27 13:30     ` Daniel Shahaf [this message]
2015-04-27 14:11       ` Peter Stephenson
2015-04-27 16:37         ` Heiko Becker
2015-04-27 16:50           ` Peter Stephenson
2015-04-27 16:57             ` Heiko Becker
2015-04-27 17:09               ` Peter Stephenson
2015-04-27 17:26                 ` Heiko Becker

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=20150427133033.GC1863@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).