Fix strerror() handling for systems which set ANSI_STRING.

Don't print errors if "include" is specified with no arguments.
New test suite for the $(shell ...) function.
This commit is contained in:
Paul Smith 2005-06-27 01:01:07 +00:00
parent d6a7894d3a
commit da1b137e38
9 changed files with 68 additions and 13 deletions

View file

@ -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

View 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}.

View 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;

2
main.c
View file

@ -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",

9
make.h
View file

@ -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

8
read.c
View file

@ -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;

View 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.

View 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;

View file

@ -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;