Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] disable generation of linemarkers by the preprocessor for sigtmp.c



On Thu, 15 Jan 2015 09:43:37 +0100
Markus Trippelsdorf <markus@xxxxxxxxxxxxxxx> wrote:
> Upcoming gcc-5 currently miscompiles zsh. The reason is that the
> signames2.awk script doesn't handle the new linemarkers generated by
> that compiler:
>
> The fix is simple. Just disable the generation of linemarkers by the
> preprocessor.

Thanks, that's fine for gcc: I'm a bit worried that the -P option isn't
completely standard (and in any case there are some prehistoric
preprocessors out there).  I'd suggest limiting this to the case where CPP
actually is gcc with options which is normal on GNU-based systems.

It should also be possible to improve the AWK script to be more careful
since there's nothing non-standard about the output you show.  I'll
take a look at some point.

diff --git a/Src/zsh.mdd b/Src/zsh.mdd
index f0379d2..71dd613 100644
--- a/Src/zsh.mdd
+++ b/Src/zsh.mdd
@@ -22,9 +22,18 @@ hdrdeps="zshcurses.h zshterm.h"
 :<<\Make
 @CONFIG_MK@
 
+# If we're using gcc as the preprocessor, get rid of the additional
+# lines generated by the preprocessor as they can confuse the script.
+# We don't need these in other cases either, but can't necessarily rely
+# 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
-	$(CPP) sigtmp.c >sigtmp.out
+	case "$(CPP)" in \
+	gcc*) \
+	$(CPP) -P sigtmp.c >sigtmp.out;; \
+	*) \
+	$(CPP) sigtmp.c >sigtmp.out;; \
+	esac
 	$(AWK) -f $(sdir)/signames2.awk sigtmp.out > $@
 	rm -f sigtmp.c sigtmp.out
 


-- 
Peter Stephenson <p.stephenson@xxxxxxxxxxx>  Principal Software Engineer
Tel: +44 (0)1223 434724                Samsung Cambridge Solution Centre
St John's House, St John's Innovation Park, Cowley Road,
Cambridge, CB4 0DS, UK



Messages sorted by: Reverse Date, Date, Thread, Author