Import the 20-June-2012 release of the "Portable" BSD make tool (from NetBSD).

Submitted by:	sjg@juniper.net
This commit is contained in:
David E. O'Brien 2012-06-25 22:20:51 +00:00
parent b379932fc0
commit 0fae4a3feb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/bmake/dist/; revision=237578
svn path=/vendor/NetBSD/bmake/20120620/; revision=237580; tag=vendor/NetBSD/bmake/20120620
22 changed files with 231 additions and 123 deletions

View file

@ -1,3 +1,24 @@
2012-06-20 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile.in (MAKE_VERSION): bump version to 20120620
Merge with NetBSD make, pick up
o make_malloc.c: avoid including make_malloc.h again
* Makefile.in: avoid bmake only syntax or protect with
.if defined(.MAKE.LEVEL)
* bsd.after-import.mk: replace .-include with .sinclude
ensure? SRCTOP gets a value
* configure.in: look for filemon.h in /usr/include/dev/filemon first.
2012-06-19 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile.in (MAKE_VERSION): bump version to 20120612
Merge with NetBSD make, pick up
o use MAKE_ATTR_* rather than those defined by cdefs.h or compiler
for greater portability.
o unit-tests/forloop: check that .for works as expected wrt
number of times and with "quoted strings".
2012-06-06 Simon J. Gerraty <sjg@bad.crufty.net> 2012-06-06 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile.in (MAKE_VERSION): bump version to 20120606 * Makefile.in (MAKE_VERSION): bump version to 20120606

1
FILES
View file

@ -100,6 +100,7 @@ unit-tests/dotwait
unit-tests/error unit-tests/error
unit-tests/export unit-tests/export
unit-tests/export-all unit-tests/export-all
unit-tests/forloop
unit-tests/forsubst unit-tests/forsubst
unit-tests/hash unit-tests/hash
unit-tests/misc unit-tests/misc

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $ # $NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $
# @(#)Makefile 5.2 (Berkeley) 12/28/90 # @(#)Makefile 5.2 (Berkeley) 12/28/90
# $Id: Makefile.in,v 1.161 2012/06/06 20:02:32 sjg Exp $ # $Id: Makefile.in,v 1.164 2012/06/20 22:44:26 sjg Exp $
PROG= bmake PROG= bmake
SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \ SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
@ -21,7 +21,7 @@ srcdir= @srcdir@
CC?= @CC@ CC?= @CC@
# Base version on src date # Base version on src date
MAKE_VERSION= 20120606 MAKE_VERSION= 20120620
MACHINE=@machine@ MACHINE=@machine@
MACHINE_ARCH=@machine_arch@ MACHINE_ARCH=@machine_arch@
DEFAULT_SYS_PATH = @default_sys_path@ DEFAULT_SYS_PATH = @default_sys_path@
@ -40,7 +40,7 @@ SRCS+= ${LIBOBJS:T:.o=.c}
.endif .endif
USE_META ?= @use_meta@ USE_META ?= @use_meta@
.if ${USE_META:tl} != "no" .if ${USE_META} != "no"
SRCS+= meta.c SRCS+= meta.c
CPPFLAGS+= -DUSE_META CPPFLAGS+= -DUSE_META
FILEMON_H ?= @filemon_h@ FILEMON_H ?= @filemon_h@
@ -83,9 +83,11 @@ SRCS+= sigcompat.c
CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
.endif .endif
.endif .endif
.if defined(.MAKE.LEVEL)
.if make(obj) || make(clean) .if make(obj) || make(clean)
SUBDIR+= unit-tests SUBDIR+= unit-tests
.endif .endif
.endif
# many systems use gcc these days # many systems use gcc these days
CC_IS_GCC=@GCC@ CC_IS_GCC=@GCC@
@ -132,9 +134,11 @@ _mfromdir=${srcdir}
# sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk # sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk
# so the inclusion below, results in complaints about re-defined # so the inclusion below, results in complaints about re-defined
# targets. For NetBSD though we need to explicitly include it. # targets. For NetBSD though we need to explicitly include it.
.if defined(.MAKE.LEVEL)
.if defined(SUBDIR) && !target(${SUBDIR:[1]}) .if defined(SUBDIR) && !target(${SUBDIR:[1]})
.-include <bsd.subdir.mk> .-include <bsd.subdir.mk>
.endif .endif
.endif
CPPFLAGS+= -DMAKE_NATIVE CPPFLAGS+= -DMAKE_NATIVE
COPTS.var.c += -Wno-cast-qual COPTS.var.c += -Wno-cast-qual

8
arch.c
View file

@ -1,4 +1,4 @@
/* $NetBSD: arch.c,v 1.62 2010/11/27 16:00:09 christos Exp $ */ /* $NetBSD: arch.c,v 1.63 2012/06/12 19:21:50 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: arch.c,v 1.62 2010/11/27 16:00:09 christos Exp $"; static char rcsid[] = "$NetBSD: arch.c,v 1.63 2012/06/12 19:21:50 joerg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
#else #else
__RCSID("$NetBSD: arch.c,v 1.62 2010/11/27 16:00:09 christos Exp $"); __RCSID("$NetBSD: arch.c,v 1.63 2012/06/12 19:21:50 joerg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -1077,7 +1077,7 @@ Arch_Touch(GNode *gn)
*/ */
void void
#if !defined(RANLIBMAG) #if !defined(RANLIBMAG)
Arch_TouchLib(GNode *gn __unused) Arch_TouchLib(GNode *gn MAKE_ATTR_UNUSED)
#else #else
Arch_TouchLib(GNode *gn) Arch_TouchLib(GNode *gn)
#endif #endif

View file

@ -1,4 +1,4 @@
# $Id: bsd.after-import.mk,v 1.3 2012/06/06 17:48:14 sjg Exp $ # $Id: bsd.after-import.mk,v 1.5 2012/06/20 22:45:07 sjg Exp $
# This makefile is for use when integrating bmake into a BSD build # This makefile is for use when integrating bmake into a BSD build
# system. Use this makefile after importing bmake. # system. Use this makefile after importing bmake.
@ -13,12 +13,24 @@ all: ${.CURDIR}/Makefile
all: after-import all: after-import
# we rely on bmake # we rely on bmake
.if !defined(.MAKE.LEVEL)
.error this makefile requires bmake
.endif
_this := ${MAKEFILE:tA} _this := ${MAKEFILE:tA}
BMAKE_SRC := ${.PARSEDIR} BMAKE_SRC := ${.PARSEDIR}
# it helps to know where the top of the tree is. # it helps to know where the top of the tree is.
.if !defined(SRCTOP) .if !defined(SRCTOP)
srctop := ${.MAKE.MAKEFILES:M*src/share/mk/sys.mk:H:H:H} srctop := ${.MAKE.MAKEFILES:M*src/share/mk/sys.mk:H:H:H}
.if empty(srctop)
# likely locations?
.for d in contrib/bmake external/bsd/bmake/dist
.if ${BMAKE_SRC:M*/$d} != ""
srctop := ${BMAKE_SRC:tA:S,/$d,,}
.endif
.endfor
.endif
.if !empty(srctop) .if !empty(srctop)
SRCTOP := ${srctop} SRCTOP := ${srctop}
.endif .endif
@ -47,6 +59,7 @@ bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE}
# Makefiles need a little more tweaking than say config.h # Makefiles need a little more tweaking than say config.h
MAKEFILE_SED = sed -e '/^MACHINE/d' \ MAKEFILE_SED = sed -e '/^MACHINE/d' \
-e '/^PROG/s,bmake,${.CURDIR:T},' \ -e '/^PROG/s,bmake,${.CURDIR:T},' \
-e 's,^.-include,.sinclude,' \
-e 's,${SRCTOP},$${SRCTOP},g' -e 's,${SRCTOP},$${SRCTOP},g'
# These are the simple files we want to capture # These are the simple files we want to capture
@ -55,11 +68,13 @@ configured_files= config.h unit-tests/Makefile
after-import: bootstrap ${MAKEFILE} after-import: bootstrap ${MAKEFILE}
.for f in ${configured_files:N*Makefile} .for f in ${configured_files:N*Makefile}
@echo Capturing $f @echo Capturing $f
@mkdir -p ${${.CURDIR}/$f:L:H}
@cmp -s ${.CURDIR}/$f ${HOST_OS}/$f || \ @cmp -s ${.CURDIR}/$f ${HOST_OS}/$f || \
cp ${HOST_OS}/$f ${.CURDIR}/$f cp ${HOST_OS}/$f ${.CURDIR}/$f
.endfor .endfor
.for f in ${configured_files:M*Makefile} .for f in ${configured_files:M*Makefile}
@echo Capturing $f @echo Capturing $f
@mkdir -p ${${.CURDIR}/$f:L:H}
@${MAKEFILE_SED} ${HOST_OS}/$f > ${.CURDIR}/$f @${MAKEFILE_SED} ${HOST_OS}/$f > ${.CURDIR}/$f
.endfor .endfor
@ -68,6 +83,8 @@ ${.CURDIR}/Makefile: bootstrap ${MAKEFILE} .PRECIOUS
@echo Generating ${.TARGET:T} @echo Generating ${.TARGET:T}
@(echo '# This is a generated file, do NOT edit!'; \ @(echo '# This is a generated file, do NOT edit!'; \
echo '# See ${_this:S,${SRCTOP}/,,}'; \ echo '# See ${_this:S,${SRCTOP}/,,}'; \
echo '#'; echo '# $$${OS}$$'; echo; \
echo 'SRCTOP?= $${.CURDIR:${.CURDIR:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; echo; \
echo; echo '# look here first for config.h'; \ echo; echo '# look here first for config.h'; \
echo 'CFLAGS+= -I$${.CURDIR}'; echo; \ echo 'CFLAGS+= -I$${.CURDIR}'; echo; \
${MAKEFILE_SED} ${HOST_OS}/Makefile; \ ${MAKEFILE_SED} ${HOST_OS}/Makefile; \
@ -79,7 +96,7 @@ ${.CURDIR}/Makefile: bootstrap ${MAKEFILE} .PRECIOUS
echo 'CLEANFILES+= bootstrap'; \ echo 'CLEANFILES+= bootstrap'; \
echo; echo 'after-import: ${_this:S,${SRCTOP},\${SRCTOP},}'; \ echo; echo 'after-import: ${_this:S,${SRCTOP},\${SRCTOP},}'; \
echo ' cd $${.CURDIR} && $${.MAKE} -f ${_this:S,${SRCTOP},\${SRCTOP},}'; \ echo ' cd $${.CURDIR} && $${.MAKE} -f ${_this:S,${SRCTOP},\${SRCTOP},}'; \
echo; echo '.-include "Makefile.inc"'; \ echo; echo '.sinclude "Makefile.inc"'; \
echo ) > ${.TARGET:T}.new echo ) > ${.TARGET:T}.new
@mv ${.TARGET:T}.new ${.TARGET} @mv ${.TARGET:T}.new ${.TARGET}

View file

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.88 2012/06/05 17:31:04 sjg Exp $ */ /* $NetBSD: compat.c,v 1.89 2012/06/10 21:44:01 wiz Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: compat.c,v 1.88 2012/06/05 17:31:04 sjg Exp $"; static char rcsid[] = "$NetBSD: compat.c,v 1.89 2012/06/10 21:44:01 wiz Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: compat.c,v 1.88 2012/06/05 17:31:04 sjg Exp $"); __RCSID("$NetBSD: compat.c,v 1.89 2012/06/10 21:44:01 wiz Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -124,7 +124,7 @@ static char meta[256];
static GNode *curTarg = NULL; static GNode *curTarg = NULL;
static GNode *ENDNode; static GNode *ENDNode;
static void CompatInterrupt(int) __dead; static void CompatInterrupt(int);
static void static void
Compat_Init(void) Compat_Init(void)

20
cond.c
View file

@ -1,4 +1,4 @@
/* $NetBSD: cond.c,v 1.63 2012/05/21 06:30:02 sjg Exp $ */ /* $NetBSD: cond.c,v 1.64 2012/06/12 19:21:50 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: cond.c,v 1.63 2012/05/21 06:30:02 sjg Exp $"; static char rcsid[] = "$NetBSD: cond.c,v 1.64 2012/06/12 19:21:50 joerg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
#else #else
__RCSID("$NetBSD: cond.c,v 1.63 2012/05/21 06:30:02 sjg Exp $"); __RCSID("$NetBSD: cond.c,v 1.64 2012/06/12 19:21:50 joerg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -327,7 +327,7 @@ CondGetArg(char **linePtr, char **argPtr, const char *func)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
CondDoDefined(int argLen __unused, const char *arg) CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char *arg)
{ {
char *p1; char *p1;
Boolean result; Boolean result;
@ -376,7 +376,7 @@ CondStrMatch(const void *string, const void *pattern)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
CondDoMake(int argLen __unused, const char *arg) CondDoMake(int argLen MAKE_ATTR_UNUSED, const char *arg)
{ {
return Lst_Find(create, arg, CondStrMatch) != NULL; return Lst_Find(create, arg, CondStrMatch) != NULL;
} }
@ -395,7 +395,7 @@ CondDoMake(int argLen __unused, const char *arg)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
CondDoExists(int argLen __unused, const char *arg) CondDoExists(int argLen MAKE_ATTR_UNUSED, const char *arg)
{ {
Boolean result; Boolean result;
char *path; char *path;
@ -428,7 +428,7 @@ CondDoExists(int argLen __unused, const char *arg)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
CondDoTarget(int argLen __unused, const char *arg) CondDoTarget(int argLen MAKE_ATTR_UNUSED, const char *arg)
{ {
GNode *gn; GNode *gn;
@ -452,7 +452,7 @@ CondDoTarget(int argLen __unused, const char *arg)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
CondDoCommands(int argLen __unused, const char *arg) CondDoCommands(int argLen MAKE_ATTR_UNUSED, const char *arg)
{ {
GNode *gn; GNode *gn;
@ -790,7 +790,7 @@ compare_expression(Boolean doEval)
} }
static int static int
get_mpt_arg(char **linePtr, char **argPtr, const char *func __unused) get_mpt_arg(char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED)
{ {
/* /*
* Use Var_Parse to parse the spec in parens and return * Use Var_Parse to parse the spec in parens and return
@ -831,7 +831,7 @@ get_mpt_arg(char **linePtr, char **argPtr, const char *func __unused)
} }
static Boolean static Boolean
CondDoEmpty(int arglen, const char *arg __unused) CondDoEmpty(int arglen, const char *arg MAKE_ATTR_UNUSED)
{ {
return arglen == 1; return arglen == 1;
} }

20
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64 for bmake 20120606. # Generated by GNU Autoconf 2.64 for bmake 20120620.
# #
# Report bugs to <sjg@NetBSD.org>. # Report bugs to <sjg@NetBSD.org>.
# #
@ -549,8 +549,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='bmake' PACKAGE_NAME='bmake'
PACKAGE_TARNAME='bmake' PACKAGE_TARNAME='bmake'
PACKAGE_VERSION='20120606' PACKAGE_VERSION='20120620'
PACKAGE_STRING='bmake 20120606' PACKAGE_STRING='bmake 20120620'
PACKAGE_BUGREPORT='sjg@NetBSD.org' PACKAGE_BUGREPORT='sjg@NetBSD.org'
PACKAGE_URL='' PACKAGE_URL=''
@ -1220,7 +1220,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures bmake 20120606 to adapt to many kinds of systems. \`configure' configures bmake 20120620 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1281,7 +1281,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of bmake 20120606:";; short | recursive ) echo "Configuration of bmake 20120620:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1386,7 +1386,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
bmake configure 20120606 bmake configure 20120620
generated by GNU Autoconf 2.64 generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc. Copyright (C) 2009 Free Software Foundation, Inc.
@ -1907,7 +1907,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by bmake $as_me 20120606, which was It was created by bmake $as_me 20120620, which was
generated by GNU Autoconf 2.64. Invocation command line was generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@ $ $0 $@
@ -2294,7 +2294,7 @@ esac
else else
OS=`uname -s` OS=`uname -s`
for d in "$srcdir/filemon" "$srcdir/../filemon" "$srcdir/../../sys/dev/filemon" for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/filemon" "$srcdir/../filemon" "$srcdir/../../sys/dev/filemon"
do do
for x in "/$OS" "" for x in "/$OS" ""
do do
@ -6369,7 +6369,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by bmake $as_me 20120606, which was This file was extended by bmake $as_me 20120620, which was
generated by GNU Autoconf 2.64. Invocation command line was generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -6429,7 +6429,7 @@ Report bugs to <sjg@NetBSD.org>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\ ac_cs_version="\\
bmake config.status 20120606 bmake config.status 20120620
configured by $0, generated by GNU Autoconf 2.64, configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View file

@ -1,10 +1,10 @@
dnl dnl
dnl RCSid: dnl RCSid:
dnl $Id: configure.in,v 1.44 2012/06/06 17:48:14 sjg Exp $ dnl $Id: configure.in,v 1.45 2012/06/20 22:43:41 sjg Exp $
dnl dnl
dnl Process this file with autoconf to produce a configure script dnl Process this file with autoconf to produce a configure script
dnl dnl
AC_INIT([bmake], [20120606], [sjg@NetBSD.org]) AC_INIT([bmake], [20120620], [sjg@NetBSD.org])
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
dnl dnl
@ -39,7 +39,7 @@ AC_ARG_WITH(filemon,
esac], esac],
[ [
OS=`uname -s` OS=`uname -s`
for d in "$srcdir/filemon" "$srcdir/../filemon" "$srcdir/../../sys/dev/filemon" for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/filemon" "$srcdir/../filemon" "$srcdir/../../sys/dev/filemon"
do do
for x in "/$OS" "" for x in "/$OS" ""
do do

12
dir.c
View file

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.64 2012/04/07 18:29:08 christos Exp $ */ /* $NetBSD: dir.c,v 1.65 2012/06/12 19:21:50 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: dir.c,v 1.64 2012/04/07 18:29:08 christos Exp $"; static char rcsid[] = "$NetBSD: dir.c,v 1.65 2012/06/12 19:21:50 joerg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else #else
__RCSID("$NetBSD: dir.c,v 1.64 2012/04/07 18:29:08 christos Exp $"); __RCSID("$NetBSD: dir.c,v 1.65 2012/06/12 19:21:50 joerg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -860,8 +860,8 @@ Dir_Expand(const char *word, Lst path, Lst expansions)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static char * static char *
DirLookup(Path *p, const char *name __unused, const char *cp, DirLookup(Path *p, const char *name MAKE_ATTR_UNUSED, const char *cp,
Boolean hasSlash __unused) Boolean hasSlash MAKE_ATTR_UNUSED)
{ {
char *file; /* the current filename to check */ char *file; /* the current filename to check */
@ -1004,7 +1004,7 @@ DirLookupAbs(Path *p, const char *name, const char *cp)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static char * static char *
DirFindDot(Boolean hasSlash __unused, const char *name, const char *cp) DirFindDot(Boolean hasSlash MAKE_ATTR_UNUSED, const char *name, const char *cp)
{ {
if (Hash_FindEntry(&dot->files, cp) != NULL) { if (Hash_FindEntry(&dot->files, cp) != NULL) {

16
job.c
View file

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.161 2012/04/07 18:29:08 christos Exp $ */ /* $NetBSD: job.c,v 1.162 2012/06/12 19:21:50 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: job.c,v 1.161 2012/04/07 18:29:08 christos Exp $"; static char rcsid[] = "$NetBSD: job.c,v 1.162 2012/06/12 19:21:50 joerg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: job.c,v 1.161 2012/04/07 18:29:08 christos Exp $"); __RCSID("$NetBSD: job.c,v 1.162 2012/06/12 19:21:50 joerg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -365,7 +365,7 @@ static int JobStart(GNode *, int);
static char *JobOutput(Job *, char *, char *, int); static char *JobOutput(Job *, char *, char *, int);
static void JobDoOutput(Job *, Boolean); static void JobDoOutput(Job *, Boolean);
static Shell *JobMatchShell(const char *); static Shell *JobMatchShell(const char *);
static void JobInterrupt(int, int) __dead; static void JobInterrupt(int, int) MAKE_ATTR_DEAD;
static void JobRestartJobs(void); static void JobRestartJobs(void);
static void JobTokenAdd(void); static void JobTokenAdd(void);
static void JobSigLock(sigset_t *); static void JobSigLock(sigset_t *);
@ -488,7 +488,7 @@ JobCondPassSig(int signo)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static void static void
JobChildSig(int signo __unused) JobChildSig(int signo MAKE_ATTR_UNUSED)
{ {
write(childExitJob.outPipe, CHILD_EXIT, 1); write(childExitJob.outPipe, CHILD_EXIT, 1);
} }
@ -511,7 +511,7 @@ JobChildSig(int signo __unused)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static void static void
JobContinueSig(int signo __unused) JobContinueSig(int signo MAKE_ATTR_UNUSED)
{ {
/* /*
* Defer sending to SIGCONT to our stopped children until we return * Defer sending to SIGCONT to our stopped children until we return
@ -536,14 +536,14 @@ JobContinueSig(int signo __unused)
* *
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
__dead static void MAKE_ATTR_DEAD static void
JobPassSig_int(int signo) JobPassSig_int(int signo)
{ {
/* Run .INTERRUPT target then exit */ /* Run .INTERRUPT target then exit */
JobInterrupt(TRUE, signo); JobInterrupt(TRUE, signo);
} }
__dead static void MAKE_ATTR_DEAD static void
JobPassSig_term(int signo) JobPassSig_term(int signo)
{ {
/* Dont run .INTERRUPT target then exit */ /* Dont run .INTERRUPT target then exit */

12
main.c
View file

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.199 2012/04/24 20:35:04 sjg Exp $ */ /* $NetBSD: main.c,v 1.200 2012/06/12 19:21:51 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.199 2012/04/24 20:35:04 sjg Exp $"; static char rcsid[] = "$NetBSD: main.c,v 1.200 2012/06/12 19:21:51 joerg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: main.c,v 1.199 2012/04/24 20:35:04 sjg Exp $"); __RCSID("$NetBSD: main.c,v 1.200 2012/06/12 19:21:51 joerg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -180,7 +180,7 @@ static char * Check_Cwd_av(int, char **, int);
#endif #endif
static void MainParseArgs(int, char **); static void MainParseArgs(int, char **);
static int ReadMakefile(const void *, const void *); static int ReadMakefile(const void *, const void *);
static void usage(void) __dead; static void usage(void) MAKE_ATTR_DEAD;
static Boolean ignorePWD; /* if we use -C, PWD is meaningless */ static Boolean ignorePWD; /* if we use -C, PWD is meaningless */
static char objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */ static char objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */
@ -736,7 +736,7 @@ str2Lst_Append(Lst lp, char *str, const char *sep)
#ifdef SIGINFO #ifdef SIGINFO
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
siginfo(int signo __unused) siginfo(int signo MAKE_ATTR_UNUSED)
{ {
char dir[MAXPATHLEN]; char dir[MAXPATHLEN];
char str[2 * MAXPATHLEN]; char str[2 * MAXPATHLEN];
@ -1340,7 +1340,7 @@ main(int argc, char **argv)
* lots * lots
*/ */
static int static int
ReadMakefile(const void *p, const void *q __unused) ReadMakefile(const void *p, const void *q MAKE_ATTR_UNUSED)
{ {
const char *fname = p; /* makefile to read */ const char *fname = p; /* makefile to read */
int fd; int fd;

12
make.c
View file

@ -1,4 +1,4 @@
/* $NetBSD: make.c,v 1.86 2012/05/10 19:53:26 christos Exp $ */ /* $NetBSD: make.c,v 1.87 2012/06/12 19:21:51 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: make.c,v 1.86 2012/05/10 19:53:26 christos Exp $"; static char rcsid[] = "$NetBSD: make.c,v 1.87 2012/06/12 19:21:51 joerg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
#else #else
__RCSID("$NetBSD: make.c,v 1.86 2012/05/10 19:53:26 christos Exp $"); __RCSID("$NetBSD: make.c,v 1.87 2012/06/12 19:21:51 joerg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -139,7 +139,7 @@ static int MakeCheckOrder(void *, void *);
static int MakeBuildChild(void *, void *); static int MakeBuildChild(void *, void *);
static int MakeBuildParent(void *, void *); static int MakeBuildParent(void *, void *);
__dead static void MAKE_ATTR_DEAD static void
make_abort(GNode *gn, int line) make_abort(GNode *gn, int line)
{ {
static int two = 2; static int two = 2;
@ -867,7 +867,7 @@ Make_Update(GNode *cgn)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static int static int
MakeUnmark(void *cgnp, void *pgnp __unused) MakeUnmark(void *cgnp, void *pgnp MAKE_ATTR_UNUSED)
{ {
GNode *cgn = (GNode *)cgnp; GNode *cgn = (GNode *)cgnp;
@ -1005,7 +1005,7 @@ Make_DoAllVar(GNode *gn)
*/ */
static int static int
MakeCheckOrder(void *v_bn, void *ignore __unused) MakeCheckOrder(void *v_bn, void *ignore MAKE_ATTR_UNUSED)
{ {
GNode *bn = v_bn; GNode *bn = v_bn;

31
make.h
View file

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.88 2012/06/04 20:34:20 sjg Exp $ */ /* $NetBSD: make.h,v 1.89 2012/06/12 19:21:51 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -98,26 +98,33 @@
#include <unistd.h> #include <unistd.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if !defined(__GNUC_PREREQ__)
#if defined(__GNUC__) #if defined(__GNUC__)
#define __GNUC_PREREQ__(x, y) \ #define MAKE_GNUC_PREREQ(x, y) \
((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \ ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
(__GNUC__ > (x))) (__GNUC__ > (x)))
#else /* defined(__GNUC__) */ #else /* defined(__GNUC__) */
#define __GNUC_PREREQ__(x, y) 0 #define MAKE_GNUC_PREREQx, y) 0
#endif /* defined(__GNUC__) */ #endif /* defined(__GNUC__) */
#endif /* !defined(__GNUC_PREREQ__) */
#if !defined(__unused) #if MAKE_GNUC_PREREQ(2, 7)
#if __GNUC_PREREQ__(2, 7) #define MAKE_ATTR_UNUSED __attribute__((__unused__))
#define __unused __attribute__((__unused__))
#else #else
#define __unused /* delete */ #define MAKE_ATTR_UNUSED /* delete */
#endif
#endif #endif
#if !defined(__dead) #if MAKE_GNUC_PREREQ(2, 5)
#define __dead #define MAKE_ATTR_DEAD __attribute__((__noreturn__))
#elif defined(__GNUC__)
#define MAKE_ATTR_DEAD __volatile
#else
#define MAKE_ATTR_DEAD /* delete */
#endif
#if MAKE_GNUC_PREREQ(2, 7)
#define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) \
__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
#else
#define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */
#endif #endif
#include "sprite.h" #include "sprite.h"

View file

@ -1,4 +1,4 @@
/* $NetBSD: make_malloc.c,v 1.7 2012/05/18 02:28:16 sjg Exp $ */ /* $NetBSD: make_malloc.c,v 1.10 2012/06/20 17:46:28 sjg Exp $ */
/*- /*-
* Copyright (c) 2009 The NetBSD Foundation, Inc. * Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
#ifdef MAKE_NATIVE #ifdef MAKE_NATIVE
#include <sys/cdefs.h> #include <sys/cdefs.h>
__RCSID("$NetBSD: make_malloc.c,v 1.7 2012/05/18 02:28:16 sjg Exp $"); __RCSID("$NetBSD: make_malloc.c,v 1.10 2012/06/20 17:46:28 sjg Exp $");
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -36,15 +36,15 @@ __RCSID("$NetBSD: make_malloc.c,v 1.7 2012/05/18 02:28:16 sjg Exp $");
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "make_malloc.h" #include "make.h"
#ifndef USE_EMALLOC #ifndef USE_EMALLOC
static void enomem(void) MAKE_ATTR_DEAD;
/* /*
* enomem -- * enomem --
* die when out of memory. * die when out of memory.
*/ */
extern char *progname;
static void static void
enomem(void) enomem(void)
{ {

View file

@ -1,4 +1,4 @@
/* $NetBSD: nonints.h,v 1.63 2011/09/16 15:38:04 joerg Exp $ */ /* $NetBSD: nonints.h,v 1.64 2012/06/12 19:21:51 joerg Exp $ */
/*- /*-
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -72,11 +72,6 @@
* from: @(#)nonints.h 8.3 (Berkeley) 3/19/94 * from: @(#)nonints.h 8.3 (Berkeley) 3/19/94
*/ */
#ifndef MAKE_NATIVE
#undef __attribute__
#define __attribute__(x)
#endif
/* arch.c */ /* arch.c */
ReturnStatus Arch_ParseArchive(char **, Lst, GNode *); ReturnStatus Arch_ParseArchive(char **, Lst, GNode *);
void Arch_Touch(GNode *); void Arch_Touch(GNode *);
@ -116,21 +111,18 @@ void Main_ParseArgLine(const char *);
void MakeMode(const char *); void MakeMode(const char *);
int main(int, char **); int main(int, char **);
char *Cmd_Exec(const char *, const char **); char *Cmd_Exec(const char *, const char **);
void Error(const char *, ...) __attribute__((__format__(__printf__, 1, 2))); void Error(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
void Fatal(const char *, ...) void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
__attribute__((__format__(__printf__, 1, 2),__noreturn__)); void Punt(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
void Punt(const char *, ...) void DieHorribly(void) MAKE_ATTR_DEAD;
__attribute__((__format__(__printf__, 1, 2),__noreturn__));
void DieHorribly(void) __attribute__((__noreturn__));
int PrintAddr(void *, void *); int PrintAddr(void *, void *);
void Finish(int) __dead; void Finish(int) MAKE_ATTR_DEAD;
int eunlink(const char *); int eunlink(const char *);
void execError(const char *, const char *); void execError(const char *, const char *);
char *getTmpdir(void); char *getTmpdir(void);
/* parse.c */ /* parse.c */
void Parse_Error(int, const char *, ...) void Parse_Error(int, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
__attribute__((__format__(__printf__, 2, 3)));
Boolean Parse_AnyExport(void); Boolean Parse_AnyExport(void);
Boolean Parse_IsVar(char *); Boolean Parse_IsVar(char *);
void Parse_DoVar(char *, GNode *); void Parse_DoVar(char *, GNode *);

10
parse.c
View file

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.184 2012/04/24 20:12:16 sjg Exp $ */ /* $NetBSD: parse.c,v 1.185 2012/06/12 19:21:51 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: parse.c,v 1.184 2012/04/24 20:12:16 sjg Exp $"; static char rcsid[] = "$NetBSD: parse.c,v 1.185 2012/06/12 19:21:51 joerg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: parse.c,v 1.184 2012/04/24 20:12:16 sjg Exp $"); __RCSID("$NetBSD: parse.c,v 1.185 2012/06/12 19:21:51 joerg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -347,9 +347,9 @@ static const struct {
static int ParseIsEscaped(const char *, const char *); static int ParseIsEscaped(const char *, const char *);
static void ParseErrorInternal(const char *, size_t, int, const char *, ...) static void ParseErrorInternal(const char *, size_t, int, const char *, ...)
__attribute__((__format__(__printf__, 4, 5))); MAKE_ATTR_PRINTFLIKE(4,5);
static void ParseVErrorInternal(FILE *, const char *, size_t, int, const char *, va_list) static void ParseVErrorInternal(FILE *, const char *, size_t, int, const char *, va_list)
__attribute__((__format__(__printf__, 5, 0))); MAKE_ATTR_PRINTFLIKE(5, 0);
static int ParseFindKeyword(const char *); static int ParseFindKeyword(const char *);
static int ParseLinkSrc(void *, void *); static int ParseLinkSrc(void *, void *);
static int ParseDoOp(void *, void *); static int ParseDoOp(void *, void *);

12
targ.c
View file

@ -1,4 +1,4 @@
/* $NetBSD: targ.c,v 1.56 2010/11/25 21:31:09 christos Exp $ */ /* $NetBSD: targ.c,v 1.57 2012/06/12 19:21:51 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: targ.c,v 1.56 2010/11/25 21:31:09 christos Exp $"; static char rcsid[] = "$NetBSD: targ.c,v 1.57 2012/06/12 19:21:51 joerg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: targ.c,v 1.56 2010/11/25 21:31:09 christos Exp $"); __RCSID("$NetBSD: targ.c,v 1.57 2012/06/12 19:21:51 joerg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -512,7 +512,7 @@ Targ_SetMain(GNode *gn)
} }
static int static int
TargPrintName(void *gnp, void *pflags __unused) TargPrintName(void *gnp, void *pflags MAKE_ATTR_UNUSED)
{ {
GNode *gn = (GNode *)gnp; GNode *gn = (GNode *)gnp;
@ -717,7 +717,7 @@ Targ_PrintNode(void *gnp, void *passp)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static int static int
TargPrintOnlySrc(void *gnp, void *dummy __unused) TargPrintOnlySrc(void *gnp, void *dummy MAKE_ATTR_UNUSED)
{ {
GNode *gn = (GNode *)gnp; GNode *gn = (GNode *)gnp;
if (!OP_NOP(gn->type)) if (!OP_NOP(gn->type))
@ -790,7 +790,7 @@ Targ_PrintGraph(int pass)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static int static int
TargPropagateNode(void *gnp, void *junk __unused) TargPropagateNode(void *gnp, void *junk MAKE_ATTR_UNUSED)
{ {
GNode *gn = (GNode *)gnp; GNode *gn = (GNode *)gnp;

View file

@ -1,6 +1,6 @@
# $Id: Makefile.in,v 1.37 2011/10/01 20:30:30 sjg Exp $ # $Id: Makefile.in,v 1.38 2012/06/19 23:38:48 sjg Exp $
# #
# $NetBSD: Makefile,v 1.33 2011/09/29 23:38:04 sjg Exp $ # $NetBSD: Makefile,v 1.34 2012/06/19 23:25:53 sjg Exp $
# #
# Unit tests for make(1) # Unit tests for make(1)
# The main targets are: # The main targets are:
@ -30,6 +30,7 @@ SUBFILES= \
export-all \ export-all \
doterror \ doterror \
dotwait \ dotwait \
forloop \
forsubst \ forsubst \
hash \ hash \
misc \ misc \

45
unit-tests/forloop Normal file
View file

@ -0,0 +1,45 @@
# $Id: forloop,v 1.1.1.1 2012/06/19 23:30:49 sjg Exp $
all: for-loop
LIST = one "two and three" four "five"
.if make(for-fail)
for-fail:
XTRA_LIST = xtra
.else
.for x in ${LIST}
X!= echo 'x=$x' >&2; echo
.endfor
CFL = -I/this -I"This or that" -Ithat "-DTHIS=\"this and that\""
cfl=
.for x in ${CFL}
X!= echo 'x=$x' >&2; echo
.if empty(cfl)
cfl= $x
.else
cfl+= $x
.endif
.endfor
X!= echo 'cfl=${cfl}' >&2; echo
.if ${cfl} != ${CFL}
.error ${.newline}'${cfl}' != ${.newline}'${CFL}'
.endif
.for a b in ${EMPTY}
X!= echo 'a=$a b=$b' >&2; echo
.endfor
.endif
.for a b in ${LIST} ${LIST:tu} ${XTRA_LIST}
X!= echo 'a=$a b=$b' >&2; echo
.endfor
for-loop:
@echo We expect an error next:
@(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} for-fail) && \
{ echo "Oops that should have failed!"; exit 1; } || echo OK

View file

@ -80,6 +80,24 @@ make: Graph cycles through `cycle.2.98'
make: Graph cycles through `cycle.2.97' make: Graph cycles through `cycle.2.97'
cycle.1.99 cycle.1.99
cycle.1.99 cycle.1.99
x=one
x="two and three"
x=four
x="five"
x=-I/this
x=-I"This or that"
x=-Ithat
x="-DTHIS=\"this and that\""
cfl=-I/this -I"This or that" -Ithat "-DTHIS=\"this and that\""
a=one b="two and three"
a=four b="five"
a=ONE b="TWO AND THREE"
a=FOUR b="FIVE"
We expect an error next:
make: "forloop" line 38: Wrong number of words (9) in .for substitution list with 2 vars
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
OK
.for with :S;... OK .for with :S;... OK
b2af338b b2af338b
3360ac65 3360ac65

34
var.c
View file

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.170 2012/06/04 20:34:20 sjg Exp $ */ /* $NetBSD: var.c,v 1.171 2012/06/12 19:21:51 joerg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.170 2012/06/04 20:34:20 sjg Exp $"; static char rcsid[] = "$NetBSD: var.c,v 1.171 2012/06/12 19:21:51 joerg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: var.c,v 1.170 2012/06/04 20:34:20 sjg Exp $"); __RCSID("$NetBSD: var.c,v 1.171 2012/06/12 19:21:51 joerg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -1145,7 +1145,7 @@ Var_Value(const char *name, GNode *ctxt, char **frp)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
VarHead(GNode *ctx __unused, Var_Parse_State *vpstate, VarHead(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *dummy) void *dummy)
{ {
@ -1193,7 +1193,7 @@ VarHead(GNode *ctx __unused, Var_Parse_State *vpstate,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
VarTail(GNode *ctx __unused, Var_Parse_State *vpstate, VarTail(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *dummy) void *dummy)
{ {
@ -1235,7 +1235,7 @@ VarTail(GNode *ctx __unused, Var_Parse_State *vpstate,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
VarSuffix(GNode *ctx __unused, Var_Parse_State *vpstate, VarSuffix(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *dummy) void *dummy)
{ {
@ -1276,7 +1276,7 @@ VarSuffix(GNode *ctx __unused, Var_Parse_State *vpstate,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
VarRoot(GNode *ctx __unused, Var_Parse_State *vpstate, VarRoot(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *dummy) void *dummy)
{ {
@ -1320,7 +1320,7 @@ VarRoot(GNode *ctx __unused, Var_Parse_State *vpstate,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
VarMatch(GNode *ctx __unused, Var_Parse_State *vpstate, VarMatch(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *pattern) void *pattern)
{ {
@ -1411,7 +1411,7 @@ VarSYSVMatch(GNode *ctx, Var_Parse_State *vpstate,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
VarNoMatch(GNode *ctx __unused, Var_Parse_State *vpstate, VarNoMatch(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *pattern) void *pattern)
{ {
@ -1448,7 +1448,7 @@ VarNoMatch(GNode *ctx __unused, Var_Parse_State *vpstate,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
VarSubstitute(GNode *ctx __unused, Var_Parse_State *vpstate, VarSubstitute(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *patternp) void *patternp)
{ {
@ -1644,7 +1644,8 @@ VarREError(int errnum, regex_t *pat, const char *str)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
VarRESubstitute(GNode *ctx __unused, Var_Parse_State *vpstate __unused, VarRESubstitute(GNode *ctx MAKE_ATTR_UNUSED,
Var_Parse_State *vpstate MAKE_ATTR_UNUSED,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *patternp) void *patternp)
{ {
@ -1784,7 +1785,8 @@ VarRESubstitute(GNode *ctx __unused, Var_Parse_State *vpstate __unused,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static Boolean static Boolean
VarLoopExpand(GNode *ctx __unused, Var_Parse_State *vpstate __unused, VarLoopExpand(GNode *ctx MAKE_ATTR_UNUSED,
Var_Parse_State *vpstate MAKE_ATTR_UNUSED,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *loopp) void *loopp)
{ {
@ -1827,7 +1829,7 @@ VarLoopExpand(GNode *ctx __unused, Var_Parse_State *vpstate __unused,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static char * static char *
VarSelectWords(GNode *ctx __unused, Var_Parse_State *vpstate, VarSelectWords(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
const char *str, VarSelectWords_t *seldata) const char *str, VarSelectWords_t *seldata)
{ {
Buffer buf; /* Buffer for the new string */ Buffer buf; /* Buffer for the new string */
@ -1902,9 +1904,9 @@ VarSelectWords(GNode *ctx __unused, Var_Parse_State *vpstate,
* if successful. * if successful.
*/ */
static Boolean static Boolean
VarRealpath(GNode *ctx __unused, Var_Parse_State *vpstate, VarRealpath(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer *buf, char *word, Boolean addSpace, Buffer *buf,
void *patternp __unused) void *patternp MAKE_ATTR_UNUSED)
{ {
struct stat st; struct stat st;
char rbuf[MAXPATHLEN]; char rbuf[MAXPATHLEN];
@ -2127,7 +2129,7 @@ VarUniq(const char *str)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static char * static char *
VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate __unused, VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate MAKE_ATTR_UNUSED,
int errnum, const char **tstr, int delim, int *flags, int errnum, const char **tstr, int delim, int *flags,
int *length, VarPattern *pattern) int *length, VarPattern *pattern)
{ {