zsh-workers
 help / color / mirror / code / Atom feed
* zsh/system's $errnos empty with recent gcc
@ 2016-09-07  9:28 Stephane Chazelas
  2016-09-07 10:06 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Chazelas @ 2016-09-07  9:28 UTC (permalink / raw)
  To: zsh-workers

At least on Ubuntu 16.04 and Debian unstable, $errnos comes out
empty.

It's down to the generation of errnames.c. Part of that
involves calling $CPP on an awk generated file, and post-process
$CPP's output with a second awk script.

It looks like the $CPP output has changed recently. I had a very
similar issue when compiling pdksh, passing the -P (to remove
the #<n> line numbers) fixed it there and it does fix it for
zsh as well.

I don't know how portable -P is (it is for gcc anyway), but it
would make sense to use it when available here. That probably
calls for a new autoconf check. Alternatively, we could modify
the awk script to take that new gcc output into account.

This:

#include <errno.h>
XXNAMES XXENOSYS ENOSYS


going through gcc -E now gives:

[...]
# 2 "a.c"
XXNAMES XXENOSYS
# 2 "a.c" 3 4
                38


While before it would give:

[...]
# 2 "a.c" 2
XXNAMES XXENOSYS 38

With gcc -E -P, it gives:

[...]
XXNAMES XXENOSYS 38

Like before. which is the format expected by errnames2.awk.

-- 
Stephane


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

* Re: zsh/system's $errnos empty with recent gcc
  2016-09-07  9:28 zsh/system's $errnos empty with recent gcc Stephane Chazelas
@ 2016-09-07 10:06 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2016-09-07 10:06 UTC (permalink / raw)
  To: zsh-workers

On Wed, 7 Sep 2016 10:28:41 +0100
Stephane Chazelas <stephane.chazelas@gmail.com> wrote:
> At least on Ubuntu 16.04 and Debian unstable, $errnos comes out
> empty.
> 
> It's down to the generation of errnames.c. Part of that
> involves calling $CPP on an awk generated file, and post-process
> $CPP's output with a second awk script.

We fixed this for signames.c in zsh.mdd in 34977 / 9f9a16f43c:

signames.c: signames1.awk signames2.awk ../config.h @SIGNAL_H@
	$(AWK) -f $(sdir)/signames1.awk @SIGNAL_H@ >sigtmp.c
	case "`$(CPP) --version </dev/null 2>&1`" in \
	*"Free Software Foundation"*) \
	$(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

So it probably needs the same treatment here.

diff --git a/Src/Modules/system.mdd b/Src/Modules/system.mdd
index eed0c1b..00a3e78 100644
--- a/Src/Modules/system.mdd
+++ b/Src/Modules/system.mdd
@@ -15,7 +15,12 @@ errnames.c: errnames1.awk errnames2.awk $(dir_top)/config.h @ERRNO_H@
 		touch errtmp.out; \
 	   else \
 		$(AWK) -f $(sdir)/errnames1.awk @ERRNO_H@ >errtmp.c; \
-		$(CPP) errtmp.c >errtmp.out; \
+		case "`$(CPP) --version </dev/null 2>&1`" in \
+		*"Free Software Foundation"*) \
+		$(CPP) -P errtmp.c >errtmp.out;; \
+		*) \
+		$(CPP) errtmp.c >errtmp.out;; \
+		esac; \
 	   fi
 	   $(AWK) -f $(sdir)/errnames2.awk errtmp.out > $@
 	   rm -f errtmp.c errtmp.out


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

end of thread, other threads:[~2016-09-07 10:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07  9:28 zsh/system's $errnos empty with recent gcc Stephane Chazelas
2016-09-07 10:06 ` Peter Stephenson

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).