Subject: [PATCH] guile-snarf: skip -g* arguments to avoid build failure

From: Sergei Trofimovich <[email-masked]>
Date: Sun, 19 Feb 2017 22:58:40 +0000

Steps to reproduce:
    $ ./configure CFLAGS=-ggdb3
    $ make
    make[1]: Entering directory '/home/slyfox/dev/git/guile/libguile'
      CC       libguile_2.2_la-alist.lo
    In file included from alist.c:398:0:
    ../libguile/alist.x: In function 'scm_init_alist':
    ../libguile/alist.x:2:2537: error: conflicting types for 'scm_i_foreign_call'

The problem here is in gcc -ggdb3 which leaves too much
of unrelated input. guile-snarf does not understand how to drop it:

The fix is to ignore -g* flags. They should only affect debugging output.

* libguile/guile-snarf.in: skip -g* arguments to avoid build failure

Bug: https://bugs.gentoo.org/608190
Bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25803
Signed-off-by: Sergei Trofimovich <[email-masked]>
---
 libguile/guile-snarf.in | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/libguile/guile-snarf.in b/libguile/guile-snarf.in
index 47bbc0422..22dc1d389 100644
--- a/libguile/guile-snarf.in
+++ b/libguile/guile-snarf.in
@@ -95,10 +95,22 @@ if [ x"$CPP" = x ] ; then cpp="@CPP@" ; else cpp="$CPP" ; fi
 
 trap "rm -rf $tempdir" 0 1 2 15
 
+# filter out -g* flags from commandline
+# as some flags like -ggdb3 cause CPP
+
+cpp_args=""
+for arg in "$@"
+do
+    case "$arg" in
+        -g*) ;; # skip debug flag
+        *) cpp_args="$cpp_args $arg" ;;
+    esac
+done
+
 if [ ! "$outfile" = "-" ] ; then
-    modern_snarf "$@" > $outfile
+    modern_snarf $cpp_args > $outfile
 else
-    modern_snarf "$@"
+    modern_snarf $cpp_args
 fi
 
 # zonk outfile if errors occurred
-- 
2.11.1