summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--doc/make.texi7
-rw-r--r--function.c5
-rw-r--r--main.c2
-rw-r--r--make.h9
-rw-r--r--read.c8
-rw-r--r--tests/ChangeLog7
-rw-r--r--tests/scripts/features/include10
-rw-r--r--tests/scripts/functions/shell23
9 files changed, 68 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index dc13423..bf8bf75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
+2005-06-26 Paul D. Smith <psmith@gnu.org>
+
+ * make.h: Fix bug in ANSI_STRING/strerror() handling; only define
+ it if ANSI_STRING is not set.
+
2005-06-25 Paul D. Smith <psmith@gnu.org>
+ * read.c (eval): If no filenames are passed to any of the
+ "include" variants, don't print an error.
+ * doc/make.texi (Include): Document this.
+ Fixes Savannah bug #1761.
+
* job.c (construct_command_argv_internal): Sanitize handling of
backslash/newline pairs according to POSIX: that is, keep the
backslash-newline in the command script, but remove a following
diff --git a/doc/make.texi b/doc/make.texi
index 4f07338..32d1558 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -1099,7 +1099,8 @@ include @var{filenames}@dots{}
@end example
@noindent
-@var{filenames} can contain shell file name patterns.
+@var{filenames} can contain shell file name patterns. If
+@var{filenames} is empty, nothing is included and no error is printed.
@cindex shell file name pattern (in @code{include})
@cindex shell wildcards (in @code{include})
@cindex wildcard, in @code{include}
@@ -1379,6 +1380,10 @@ Supports secondary expansion of prerequisite lists.
Supports ``job server'' enhanced parallel builds. @xref{Parallel,
,Parallel Execution}.
+@item else-if
+Supports ``else if'' non-nested conditionals. @xref{Conditional
+Syntax, ,Syntax of Conditionals}.
+
@item check-symlink
Supports the @code{-L} (@code{--check-symlink-times}) flag.
@xref{Options Summary, ,Summary of Options}.
diff --git a/function.c b/function.c
index 983df74..0772739 100644
--- a/function.c
+++ b/function.c
@@ -1482,7 +1482,10 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
because target_environment hits a loop trying to expand $(var)
to put it in the environment. This is even more confusing when
var was not explicitly exported, but just appeared in the
- calling environment. */
+ calling environment.
+
+ envp = target_environment (NILF);
+ */
envp = environ;
diff --git a/main.c b/main.c
index cd58a49..b7db067 100644
--- a/main.c
+++ b/main.c
@@ -1102,7 +1102,7 @@ main (int argc, char **argv, char **envp)
/* Set up .FEATURES */
define_variable (".FEATURES", 9,
- "target-specific order-only second-expansion",
+ "target-specific order-only second-expansion else-if",
o_default, 0);
#ifdef MAKE_JOBSERVER
do_variable_definition (NILF, ".FEATURES", "jobserver",
diff --git a/make.h b/make.h
index 55682d8..b772d77 100644
--- a/make.h
+++ b/make.h
@@ -276,16 +276,15 @@ extern void bzero PARAMS ((char *, int));
extern void bcopy PARAMS ((const char *b1, char *b2, int));
# endif
-#endif /* ANSI_STRING. */
-#undef ANSI_STRING
-
/* SCO Xenix has a buggy macro definition in <string.h>. */
#undef strerror
-
-#if !defined(ANSI_STRING) && !defined(__DECC)
+#if !defined(__DECC)
extern char *strerror PARAMS ((int errnum));
#endif
+#endif /* !ANSI_STRING. */
+#undef ANSI_STRING
+
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
diff --git a/read.c b/read.c
index 024567a..a6e18b0 100644
--- a/read.c
+++ b/read.c
@@ -800,12 +800,10 @@ eval (struct ebuffer *ebuf, int set_default)
int noerror = (p[0] != 'i');
p = allocated_variable_expand (p2);
+
+ /* If no filenames, it's a no-op. */
if (*p == '\0')
- {
- error (fstart,
- _("no file name for `%sinclude'"), noerror ? "-" : "");
- continue;
- }
+ continue;
/* Parse the list of file names. */
p2 = p;
diff --git a/tests/ChangeLog b/tests/ChangeLog
index c07d7c1..bc2108d 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,12 @@
+2005-06-26 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/functions/shell: New test suite for the shell function.
+
2005-06-25 Paul D. Smith <psmith@gnu.org>
+ * scripts/features/include: Test include/-include/sinclude with no
+ arguments. Tests fix for Savannah bug #1761.
+
* scripts/misc/general3: Implement comprehensive testing of
backslash-newline behavior in command scripts: various types of
quoting, fast path / slow path, etc.
diff --git a/tests/scripts/features/include b/tests/scripts/features/include
index 26ee1bd..5030662 100644
--- a/tests/scripts/features/include
+++ b/tests/scripts/features/include
@@ -107,4 +107,14 @@ foo: bar; @:
bar:; @false
', '', '');
+# Check include, sinclude, -include with no filenames.
+# (Savannah bug #1761).
+
+run_make_test('
+.PHONY: all
+all:; @:
+include
+-include
+sinclude', '', '');
+
1;
diff --git a/tests/scripts/functions/shell b/tests/scripts/functions/shell
new file mode 100644
index 0000000..ecea4cf
--- /dev/null
+++ b/tests/scripts/functions/shell
@@ -0,0 +1,23 @@
+# -*-perl-*-
+
+$description = 'Test the $(shell ...) function.';
+
+$details = '';
+
+
+# Test shells inside rules.
+run_make_test('.PHONY: all
+all: ; @echo $(shell echo hi)
+','','hi');
+
+
+# Test shells inside exported environment variables.
+# This is the test that fails if we try to put make exported variables into
+# the environment for a $(shell ...) call.
+run_make_test('
+export HI = $(shell echo hi)
+.PHONY: all
+all: ; @echo $$HI
+','','hi');
+
+1;