automake
[Top][All Lists]
Advanced

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

Re: Internal Error with 1.10, unterminated IF


From: Ralf Wildenhues
Subject: Re: Internal Error with 1.10, unterminated IF
Date: Thu, 9 Aug 2007 20:55:17 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Jason,

* Jason Curl wrote on Mon, Jul 30, 2007 at 04:06:44PM CEST:
> 
> Makefile.am
>   FILES = dir1 dir2
>   if BUILD_DIR3
>   FILES += dir3
>   fi
>   SUBDIRS = $(FILES)
> 
> Then you get an error output like:
> Makefile.am:19: unterminated conditionals: BUILD_DIR3_TRUE
> automake-1.10: ####################
> automake-1.10: ## Internal Error ##
> automake-1.10: ####################
[...]

Do you think it would be more helpful if the error were like this?
| Makefile.am:4: conditional terminated with `endif' instead of `fi'

OK to apply the patch below to this end (and add Jason to THANKS)?

Cheers, and thanks,
Ralf

2007-08-09  Ralf Wildenhues  <address@hidden>

        * automake.in (FI_PATTERN): New pattern.
        (read_am_file, file_contents_internal): Use it to produce a
        helpful error with `fi' instead of `endif', consider the
        conditional terminated.
        * tests/cond39.test: New test.
        * tests/Makefile.am: Update.
        * THANKS: Update.
        Report by Jason Curl.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1647
diff -u -r1.1647 automake.in
--- automake.in 7 Jul 2007 12:16:27 -0000       1.1647
+++ automake.in 9 Aug 2007 18:54:26 -0000
@@ -189,6 +189,8 @@
   '^else(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$";
 my $ENDIF_PATTERN =
   '^endif(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$";
+my $FI_PATTERN =
+  '^fi(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$";
 my $PATH_PATTERN = '(\w|[+/.-])+';
 # This will pass through anything not of the prescribed form.
 my $INCLUDE_PATTERN = ('^include\s+'
@@ -6212,6 +6214,11 @@
          {
            $cond = cond_stack_endif ($1, $2, $where);
          }
+       elsif (/$FI_PATTERN/o)
+         {
+           error $where, "conditional terminated with `endif' instead of `fi'";
+           $cond = cond_stack_endif ($1, $2, $where);
+         }
 
        elsif (/$RULE_PATTERN/o)
        {
@@ -6612,6 +6619,11 @@
          {
            $cond = cond_stack_endif ($1, $2, $file);
          }
+       elsif (/$FI_PATTERN/o)
+         {
+           error $where, "conditional terminated with `endif' instead of `fi'";
+           $cond = cond_stack_endif ($1, $2, $file);
+         }
 
         # Handling rules.
        elsif (/$RULE_PATTERN/mso)
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.622
diff -u -r1.622 Makefile.am
--- tests/Makefile.am   22 Jul 2007 08:48:18 -0000      1.622
+++ tests/Makefile.am   9 Aug 2007 18:54:34 -0000
@@ -151,6 +151,7 @@
 cond36.test \
 cond37.test \
 cond38.test \
+cond39.test \
 condd.test \
 condhook.test \
 condinc.test \
--- /dev/null   2007-08-04 15:05:22.228065249 +0200
+++ tests/cond39.test   2007-08-09 20:53:08.000000000 +0200
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Copyright (C) 2007  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Produce a decent error with `fi' instead of `endif'.
+# Report by Jason Curl.
+
+. ./defs
+
+set -e
+
+cat >>configure.in <<'EOF'
+AM_CONDITIONAL([COND], [:])
+AC_OUTPUT
+EOF
+
+cat >>Makefile.am <<'EOF'
+VAR = a
+if COND
+VAR += b
+fi
+SUBDIRS = $(VAR)
+EOF
+
+mkdir a b
+
+$ACLOCAL
+$AUTOCONF
+AUTOMAKE_fails
+grep 'conditional terminated .*endif' stderr




reply via email to

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