make(1): error out on misspelled .export directives
This commit is contained in:
parent
2997f3b2f1
commit
6f740ba472
|
@ -1,3 +1,4 @@
|
|||
make: "directive-unexport-env.mk" line 13: Unknown directive "unexport-en"
|
||||
make: "directive-unexport-env.mk" line 15: Unknown directive "unexport-environment"
|
||||
Global:UT_EXPORTED = value
|
||||
Global:UT_UNEXPORTED = value
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: directive-unexport-env.mk,v 1.6 2020/12/12 18:00:18 rillig Exp $
|
||||
# $NetBSD: directive-unexport-env.mk,v 1.7 2020/12/12 18:11:42 rillig Exp $
|
||||
#
|
||||
# Tests for the .unexport-env directive.
|
||||
#
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
# TODO: Implementation
|
||||
|
||||
.unexport-en # oops: misspelled
|
||||
.unexport-en # misspelled
|
||||
.unexport-env # ok
|
||||
.unexport-environment # misspelled
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
make: "directive-unexport.mk" line 14: UT_A=a UT_B=b UT_C=c
|
||||
make: "directive-unexport.mk" line 15: UT_A UT_B UT_C
|
||||
make: "directive-unexport.mk" line 23: UT_A=a UT_B=b UT_C=c
|
||||
make: "directive-unexport.mk" line 24:
|
||||
make: "directive-unexport.mk" line 26: Unknown directive "unexpor"
|
||||
make: "directive-unexport.mk" line 15: UT_A=a UT_B=b UT_C=c
|
||||
make: "directive-unexport.mk" line 16: UT_A UT_B UT_C
|
||||
make: "directive-unexport.mk" line 24: UT_A=a UT_B=b UT_C=c
|
||||
make: "directive-unexport.mk" line 25:
|
||||
make: "directive-unexport.mk" line 27: Unknown directive "unexpor"
|
||||
make: "directive-unexport.mk" line 29: Unknown directive "unexporting works"
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
exit status 1
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# $NetBSD: directive-unexport.mk,v 1.5 2020/11/03 17:17:31 rillig Exp $
|
||||
# $NetBSD: directive-unexport.mk,v 1.6 2020/12/12 18:11:42 rillig Exp $
|
||||
#
|
||||
# Tests for the .unexport directive.
|
||||
|
||||
# TODO: Implementation
|
||||
#
|
||||
# Before 2020-12-13, misspelled directives like ".unexporting" or
|
||||
# ".unexport-en" had not been detected properly.
|
||||
|
||||
# First, export 3 variables.
|
||||
UT_A= a
|
||||
|
@ -25,7 +26,7 @@ UT_C= c
|
|||
|
||||
.unexpor # misspelled
|
||||
.unexport # oops: missing argument
|
||||
.unexporting works # oops: misspelled
|
||||
.unexporting works # misspelled
|
||||
|
||||
all:
|
||||
@:;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: var.c,v 1.723 2020/12/12 18:00:18 rillig Exp $ */
|
||||
/* $NetBSD: var.c,v 1.724 2020/12/12 18:11:42 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -130,7 +130,7 @@
|
|||
#include "metachar.h"
|
||||
|
||||
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.723 2020/12/12 18:00:18 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.724 2020/12/12 18:11:42 rillig Exp $");
|
||||
|
||||
/* A string that may need to be freed after use. */
|
||||
typedef struct FStr {
|
||||
|
@ -770,11 +770,15 @@ GetVarnamesToUnexport(const char *directive,
|
|||
}
|
||||
what = UNEXPORT_ENV;
|
||||
|
||||
} else {
|
||||
} else if (*p == '\0' || ch_isspace(*p)) {
|
||||
cpp_skip_whitespace(&p);
|
||||
what = p[0] != '\0' ? UNEXPORT_NAMED : UNEXPORT_ALL;
|
||||
if (what == UNEXPORT_NAMED)
|
||||
FStr_Assign(&varnames, p, NULL);
|
||||
} else {
|
||||
Parse_Error(PARSE_FATAL, "Unknown directive \"%s\"", directive);
|
||||
what = UNEXPORT_NAMED;
|
||||
FStr_Assign(&varnames, "", NULL);
|
||||
}
|
||||
|
||||
if (what != UNEXPORT_NAMED) {
|
||||
|
|
Loading…
Reference in New Issue