]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Fix strerror() handling for systems which set ANSI_STRING.
authorPaul Smith <psmith@gnu.org>
Mon, 27 Jun 2005 01:01:07 +0000 (01:01 +0000)
committerPaul Smith <psmith@gnu.org>
Mon, 27 Jun 2005 01:01:07 +0000 (01:01 +0000)
Don't print errors if "include" is specified with no arguments.
New test suite for the $(shell ...) function.

ChangeLog
doc/make.texi
function.c
main.c
make.h
read.c
tests/ChangeLog
tests/scripts/features/include
tests/scripts/functions/shell [new file with mode: 0644]

index dc13423208028566cb86b92778bfb04d6a0aaffc..bf8bf75958f06048e825aa8dccbf799a0726ff4f 100644 (file)
--- 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
index 4f07338cca3245b70cf115887215cc3495016f6e..32d1558408774c2db2d80a5d4afe0ea43a69859a 100644 (file)
@@ -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}.
index 983df74f8ccf3d5930c54bec93619f82b711d1b2..0772739f91e6b444d085c101783c54e8ffce97a8 100644 (file)
@@ -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 cd58a49353805dbcd0c73c80739b5eb386061720..b7db0673c76b66623a49f383f8bdc115806b71a3 100644 (file)
--- 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 55682d861295fdf18df4aad0c12c92ac943443bf..b772d7771dd27d6cb96d9184f701a60ad1194d2b 100644 (file)
--- 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 024567a9f26f6124f282996142e2edc42fd13d67..a6e18b077ac4d6d928bdbd0dd8915af6520fced2 100644 (file)
--- 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;
index c07d7c1440d1dc53c432e40180aee52e346a811e..bc2108d0e9219a4a7da76a664f65f83da739fa89 100644 (file)
@@ -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.
index 26ee1bdb2f2ffbc7644c002e4b1467e5d6ec4161..5030662e58d82e791a41f52ac2dcf73443876132 100644 (file)
@@ -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 (file)
index 0000000..ecea4cf
--- /dev/null
@@ -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;