bison-patches
[Top][All Lists]
Advanced

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

[PATCH] build: workaround for some cpp that causes an infinite recursion


From: PHO
Subject: [PATCH] build: workaround for some cpp that causes an infinite recursion
Date: Tue, 14 Jan 2014 13:00:29 +0900 (JST)

Hi,

I found bison >= 3.0 stopped building on MacOS X 10.5 with GCC 4.0.1:

  % uname -a
  Darwin aria.cielonegro.org 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 
16:57:0
  1 PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC Power Macintosh
  % gcc --version
  powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
  Copyright (C) 2005 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.

Building with a separate builddir succeeds, but without one the C
preprocessor enters into an infinite recursion on "#include_next"
directives in lib/*.h:

  % gmake V=1
  [snip]
  depbase=`echo lib/math.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
  gcc -std=gnu99    -I. -Ilib -I. -I./lib   -g -O2 -MT lib/math.o -MD -MP -MF 
$depbase.Tpo -c -o lib/math.o lib/math.c &&\
  mv -f $depbase.Tpo $depbase.Po
  In file included from lib/math.h:27,
                   from lib/math.h:27,
                   from lib/math.h:27,
                   from lib/math.h:27,
  [snip]
                   from lib/math.h:27,
                   from lib/math.h:27,
                   from lib/math.c:3:
  lib/math.h:27:23: error: #include nested too deeply
  Makefile:3414: recipe for target 'lib/math.o' failed
  gmake[2]: *** [lib/math.o] Error 1

I can work around this problem with the attached patch but honestly I
have no idea why the difference between "-Ilib" and "-I./lib" matters.

Thanks,
_______________________________________________________
 - PHO -                         http://cielonegro.org/
OpenPGP public key: 1024D/1A86EF72
Fpr: 5F3E 5B5F 535C CE27 8254  4D1A 14E7 9CA7 1A86 EF72

Attachment: build.bison.log.gz
Description: Binary data

>From 219026b923c0bcfe84a87408e54aa99a135972f7 Mon Sep 17 00:00:00 2001
From: PHO <address@hidden>
Date: Tue, 14 Jan 2014 12:27:35 +0900
Subject: [PATCH] build: workaround for some cpp that causes an infinite
 recursion

Some C preprocessors (e.g. GCC 4.0.1) causes an infinite recursion on 
"#include_next" in lib/*.h when "-Ilib" is given and $(top_srcdir) == 
$(top_builddir). We can work around this by passing "-I./lib" instead of 
"-Ilib" for some reason.

* Makefile.am: Change the definition of AM_CPPFLAGS
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index becd1d3..9b84dc8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,7 +40,7 @@ AM_YFLAGS = -d -v -Werror -Wall -Wno-yacc --report=all
 # Initialization before completion by local.mk's.
 AM_CFLAGS = $(WARN_CFLAGS)
 # Find builddir/src/scan-code.c etc.
-AM_CPPFLAGS = -I. -Ilib -I$(top_srcdir) -I$(top_srcdir)/lib
+AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/lib -I$(top_srcdir) 
-I$(top_srcdir)/lib
 BUILT_SOURCES =
 CLEANFILES =
 DISTCLEANFILES =
--
1.8.4.3

Attachment: pgpLaB0ssyPMw.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]