Hi,
When compiling guile with the gcc -g3 flag, compilation of alist.c fails
with the following error
In file included from alist.c:379:0:
../libguile/alist.x: In function 'scm_init_alist':
../libguile/alist.x:2:1: error: 'X' undeclared (first use in this function)
../libguile/alist.x:2:1: note: each undeclared identifier is reported only
once for each function it appears in
The aforementioned 'X' appears in the second line of the alist.x file. The
second line
contains only "X;"
alist.x begins with...
/* cpp arguments: alist.c -DHAVE_CONFIG_H -DBUILDING_LIBGUILE=1
-I.. -I.. -I../lib -I../lib -I/usr/lib64/libffi-3.0.9/include
-g3 -gdwarf-2 -O0 -Wall */
X;
scm_acons__name = scm_string_to_symbol (scm_acons__name_string);
So, when you compile something -g3, the temporary file generated
by this command in the guile-snarf script is different than when
compiled in -g2
${cpp} -DSCM_MAGIC_SNARF_INITS -DSCM_MAGIC_SNARFER "$@"
This is because it includes explicitly all the #defines
So, that means that it also includes the following line in
the /tmp/guile-snarf.XXXX/tmp file
#define SCM_SNARF_INIT(X) ^^ X ^:^
The new sed script converts that into "X;"
To convince yourself of this fact, you can run a debug version
of the sed script like so
sed -ne "s/ *\^ *: *\^/\n/;s/[^\n]*\^ *\^ *\([^\n]*\)/\1;/;tx;d;:x;=;l;D"
I don't know the best way to fix it, but you could brute force the fix
like the attached patchFrom c415fcaf83d0d919fca4c0bd8f9566e70e6bf78c Mon Sep 17 00:00:00 2001
From: Michael Gran <[email protected]>
Date: Fri, 11 Mar 2011 09:05:35 -0800
Subject: [PATCH] Don't snarf definition of SCM_SNARF_INIT
A preprocessor may include the #define of SCM_SNARF_INIT in
a preprocessed file. Snarfing that define will create an extraneous
line.
* libguile/guile-snarf.in (modern_snarf): updated
---
libguile/guile-snarf.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libguile/guile-snarf.in b/libguile/guile-snarf.in
index a1aeba5..b874631 100644
--- a/libguile/guile-snarf.in
+++ b/libguile/guile-snarf.in
@@ -51,7 +51,7 @@ modern_snarf () # writes stdout
## empty file.
echo "/* cpp arguments: $@ */" ;
${cpp} -DSCM_MAGIC_SNARF_INITS -DSCM_MAGIC_SNARFER "$@" > ${temp} && cpp_ok_p=true
- sed -ne "s/ *\^ *: *\^/\n/;s/[^\n]*\^ *\^ *\([^\n]*\)/\1;/;tx;d;:x;P;D" ${temp}
+ grep -v "define SCM_SNARF_INIT" ${temp} | sed -ne "s/ *\^ *: *\^/\n/;s/[^\n]*\^ *\^ *\([^\n]*\)/\1;/;tx;d;:x;P;D"
}
## main
--
1.7.4