CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Jul 7 11:20:10 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: directive-for-escape.exp directive-for-escape.mk Log Message: tests/make: remove '# expect' lines from .exp file These lines are only supposed to occur in .mk files. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.27 -r1.28 \ src/usr.bin/make/unit-tests/directive-for-escape.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/directive-for-escape.exp diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.29 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.30 --- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.29 Sat Jul 6 10:14:35 2024 +++ src/usr.bin/make/unit-tests/directive-for-escape.exp Sun Jul 7 11:20:10 2024 @@ -1,134 +1,45 @@ For: end for 1 For: loop body with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~: -# expect+2: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!"" -# expect+1: !" . info ${:U!"#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~} make: "directive-for-escape.mk" line 21: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!"" - in .for loop from directive-for-escape.mk:18 with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~ + in .for loop from directive-for-escape.mk:20 with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~ make: "directive-for-escape.mk" line 21: !" For: end for 1 For: loop body with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~: -# expect+2: while evaluating "${:U!"" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"" -# expect+1: !"\\ . info ${:U!"#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~} make: "directive-for-escape.mk" line 33: while evaluating "${:U!"" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"" - in .for loop from directive-for-escape.mk:30 with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~ + in .for loop from directive-for-escape.mk:32 with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~ make: "directive-for-escape.mk" line 33: !"\\ For: end for 1 For: loop body with i = $: -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U\$} make: "directive-for-escape.mk" line 57: $ For: loop body with i = ${V}: -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U${V}} make: "directive-for-escape.mk" line 57: value For: loop body with i = ${V:=-with-modifier}: -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U${V:=-with-modifier}} make: "directive-for-escape.mk" line 57: value-with-modifier For: loop body with i = $(V): -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U$(V)} make: "directive-for-escape.mk" line 57: value For: loop body with i = $(V:=-with-modifier): -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U$(V:=-with-modifier)} make: "directive-for-escape.mk" line 57: value-with-modifier For: end for 1 For: loop body with i = $: -# expect: . info ${:U\$} -# expect+6: $ -# expect: . info ${:U${V}} -# expect+4: value -# expect+3: value-with-modifier -# expect+2: value -# expect+1: value-with-modifier . info ${:U\$} make: "directive-for-escape.mk" line 69: $ For: loop body with i = ${V}: -# expect: . info ${:U\$} -# expect+6: $ -# expect: . info ${:U${V}} -# expect+4: value -# expect+3: value-with-modifier -# expect+2: value -# expect+1: value-with-modifier . info ${:U${V}} make: "directive-for-escape.mk" line 69: value For:
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Jul 7 11:20:10 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: directive-for-escape.exp directive-for-escape.mk Log Message: tests/make: remove '# expect' lines from .exp file These lines are only supposed to occur in .mk files. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.27 -r1.28 \ src/usr.bin/make/unit-tests/directive-for-escape.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 09:54:13 UTC 2024 Modified Files: src/usr.bin/make: main.c make.h targ.c var.c Log Message: make: move initialization of variable scopes to targ.c The variable scopes are freed by Targ_End, so initialize them there as well. Separate printing statistics and freeing memory, which makes Var_End unnecessary. To generate a diff of this commit: cvs rdiff -u -r1.629 -r1.630 src/usr.bin/make/main.c cvs rdiff -u -r1.341 -r1.342 src/usr.bin/make/make.h cvs rdiff -u -r1.183 -r1.184 src/usr.bin/make/targ.c cvs rdiff -u -r1.1133 -r1.1134 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.629 src/usr.bin/make/main.c:1.630 --- src/usr.bin/make/main.c:1.629 Sun Jul 7 07:50:57 2024 +++ src/usr.bin/make/main.c Sun Jul 7 09:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.629 2024/07/07 07:50:57 rillig Exp $ */ +/* $NetBSD: main.c,v 1.630 2024/07/07 09:54:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.629 2024/07/07 07:50:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.630 2024/07/07 09:54:12 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1342,7 +1342,6 @@ main_Init(int argc, char **argv) /* Just in case MAKEOBJDIR wants us to do something tricky. */ Targ_Init(); - Var_Init(); Global_Set_ReadOnly(".MAKE.OS", utsname.sysname); Global_Set("MACHINE", machine); Global_Set("MACHINE_ARCH", machine_arch); @@ -1581,15 +1580,15 @@ main_CleanUp(void) if (opts.enterFlag) printf("%s: Leaving directory `%s'\n", progname, curdir); + Var_Stats(); + Targ_Stats(); + #ifdef USE_META meta_finish(); #endif #ifdef CLEANUP Suff_End(); -#endif - Var_End(); Targ_End(); -#ifdef CLEANUP Arch_End(); Parse_End(); Dir_End(); Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.341 src/usr.bin/make/make.h:1.342 --- src/usr.bin/make/make.h:1.341 Sun Jul 7 07:50:57 2024 +++ src/usr.bin/make/make.h Sun Jul 7 09:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.341 2024/07/07 07:50:57 rillig Exp $ */ +/* $NetBSD: make.h,v 1.342 2024/07/07 09:54:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -931,8 +931,6 @@ void Parse_RegisterCommand(char *cmd MAK #endif /* var.c */ -void Var_Init(void); -void Var_End(void); typedef enum VarEvalMode { Index: src/usr.bin/make/targ.c diff -u src/usr.bin/make/targ.c:1.183 src/usr.bin/make/targ.c:1.184 --- src/usr.bin/make/targ.c:1.183 Sat May 25 21:07:48 2024 +++ src/usr.bin/make/targ.c Sun Jul 7 09:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.183 2024/05/25 21:07:48 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.184 2024/07/07 09:54:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -107,7 +107,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.183 2024/05/25 21:07:48 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.184 2024/07/07 09:54:12 rillig Exp $"); /* * All target nodes that appeared on the left-hand side of one of the @@ -126,23 +126,24 @@ void Targ_Init(void) { HashTable_Init(); + SCOPE_INTERNAL = GNode_New("Internal"); + SCOPE_GLOBAL = GNode_New("Global"); + SCOPE_CMDLINE = GNode_New("Command"); } +#ifdef CLEANUP void Targ_End(void) { -#ifdef CLEANUP GNodeListNode *ln; -#endif - Targ_Stats(); -#ifdef CLEANUP + Lst_Done(); HashTable_Done(); for (ln = allNodes.first; ln != NULL; ln = ln->next) GNode_Free(ln->datum); Lst_Done(); -#endif } +#endif void Targ_Stats(void) Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1133 src/usr.bin/make/var.c:1.1134 --- src/usr.bin/make/var.c:1.1133 Fri Jul 5 20:01:52 2024 +++ src/usr.bin/make/var.c Sun Jul 7 09:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1133 2024/07/05 20:01:52 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1134 2024/07/07 09:54:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -76,10 +76,6 @@ * expressions like ${VAR}, ${VAR:Modifiers}, ${${VARNAME}} or ${VAR:${MODS}}. * * Interface: - * Var_Init Initialize this module. - * - * Var_End Clean up the module. - * * Var_Set * Var_SetExpand Set the value of the variable, creating it if * necessary. @@ -132,7 +128,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1133 2024/07/05 20:01:52 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1134 2024/07/07 09:54:12 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -4809,22 +4805,6 @@ Var_Expand(FStr *str, GNode *scope, VarE *str =
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 09:54:13 UTC 2024 Modified Files: src/usr.bin/make: main.c make.h targ.c var.c Log Message: make: move initialization of variable scopes to targ.c The variable scopes are freed by Targ_End, so initialize them there as well. Separate printing statistics and freeing memory, which makes Var_End unnecessary. To generate a diff of this commit: cvs rdiff -u -r1.629 -r1.630 src/usr.bin/make/main.c cvs rdiff -u -r1.341 -r1.342 src/usr.bin/make/make.h cvs rdiff -u -r1.183 -r1.184 src/usr.bin/make/targ.c cvs rdiff -u -r1.1133 -r1.1134 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 09:37:00 UTC 2024 Modified Files: src/usr.bin/make: hash.c hash.h src/usr.bin/make/unit-tests: Makefile opt-debug-hash.exp Log Message: make: don't track hash table chain lengths during lookup The chain lengths are only used for debugging purposes, so avoid the extra cost at each lookup. Instead, calculate the maximum chain length only when it is actually requested in -dh mode. The reported number changes slightly: Before, it was the length of the chain that was actually traversed to find an entry, up to that entry, now it is the length of the largest chain in the table, no matter if it was actually accessed or not. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/hash.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/make/hash.h cvs rdiff -u -r1.349 -r1.350 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-debug-hash.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 09:37:00 UTC 2024 Modified Files: src/usr.bin/make: hash.c hash.h src/usr.bin/make/unit-tests: Makefile opt-debug-hash.exp Log Message: make: don't track hash table chain lengths during lookup The chain lengths are only used for debugging purposes, so avoid the extra cost at each lookup. Instead, calculate the maximum chain length only when it is actually requested in -dh mode. The reported number changes slightly: Before, it was the length of the chain that was actually traversed to find an entry, up to that entry, now it is the length of the largest chain in the table, no matter if it was actually accessed or not. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/hash.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/make/hash.h cvs rdiff -u -r1.349 -r1.350 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-debug-hash.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/hash.c diff -u src/usr.bin/make/hash.c:1.78 src/usr.bin/make/hash.c:1.79 --- src/usr.bin/make/hash.c:1.78 Wed Jun 5 22:06:53 2024 +++ src/usr.bin/make/hash.c Sun Jul 7 09:37:00 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.78 2024/06/05 22:06:53 rillig Exp $ */ +/* $NetBSD: hash.c,v 1.79 2024/07/07 09:37:00 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -74,7 +74,7 @@ #include "make.h" /* "@(#)hash.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: hash.c,v 1.78 2024/06/05 22:06:53 rillig Exp $"); +MAKE_RCSID("$NetBSD: hash.c,v 1.79 2024/07/07 09:37:00 rillig Exp $"); /* * The ratio of # entries to # buckets at which we rebuild the table to @@ -114,7 +114,6 @@ static HashEntry * HashTable_Find(HashTable *t, Substring key, unsigned int h) { HashEntry *he; - unsigned int chainlen = 0; size_t keyLen = Substring_Length(key); #ifdef DEBUG_HASH_LOOKUP @@ -123,16 +122,12 @@ HashTable_Find(HashTable *t, Substring k #endif for (he = t->buckets[h & t->bucketsMask]; he != NULL; he = he->next) { - chainlen++; if (he->hash == h && strncmp(he->key, key.start, keyLen) == 0 && he->key[keyLen] == '\0') break; } - if (chainlen > t->maxchain) - t->maxchain = chainlen; - return he; } @@ -149,7 +144,6 @@ HashTable_Init(HashTable *t) t->bucketsSize = n; t->numEntries = 0; t->bucketsMask = n - 1; - t->maxchain = 0; } /* @@ -205,6 +199,20 @@ HashTable_FindValueBySubstringHash(HashT return he != NULL ? he->value : NULL; } +static unsigned +HashTable_MaxChain(const HashTable *t) +{ + unsigned b, cl, max_cl = 0; + for (b = 0; b < t->bucketsSize; b++) { + const HashEntry *he = t->buckets[b]; + for (cl = 0; he != NULL; he = he->next) + cl++; + if (cl > max_cl) + max_cl = cl; + } + return max_cl; +} + /* * Make the hash table larger. Any bucket numbers from the old table become * invalid; the hash values stay valid though. @@ -238,8 +246,7 @@ HashTable_Enlarge(HashTable *t) t->bucketsMask = newMask; t->buckets = newBuckets; DEBUG4(HASH, "HashTable_Enlarge: %p size=%d entries=%d maxchain=%d\n", - (void *)t, t->bucketsSize, t->numEntries, t->maxchain); - t->maxchain = 0; + (void *)t, t->bucketsSize, t->numEntries, HashTable_MaxChain(t)); } /* @@ -321,8 +328,8 @@ HashIter_Next(HashIter *hi) } void -HashTable_DebugStats(HashTable *t, const char *name) +HashTable_DebugStats(const HashTable *t, const char *name) { - DEBUG4(HASH, "HashTable %s: size=%u numEntries=%u maxchain=%u\n", - name, t->bucketsSize, t->numEntries, t->maxchain); + DEBUG4(HASH, "HashTable \"%s\": size=%u entries=%u maxchain=%u\n", + name, t->bucketsSize, t->numEntries, HashTable_MaxChain(t)); } Index: src/usr.bin/make/hash.h diff -u src/usr.bin/make/hash.h:1.50 src/usr.bin/make/hash.h:1.51 --- src/usr.bin/make/hash.h:1.50 Sat Jun 1 10:10:50 2024 +++ src/usr.bin/make/hash.h Sun Jul 7 09:37:00 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.50 2024/06/01 10:10:50 rillig Exp $ */ +/* $NetBSD: hash.h,v 1.51 2024/07/07 09:37:00 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -92,7 +92,6 @@ typedef struct HashTable { unsigned int bucketsSize; unsigned int numEntries; unsigned int bucketsMask; /* Used to select the bucket for a hash. */ - unsigned int maxchain; /* Maximum length of chain seen. */ } HashTable; /* State of an iteration over all entries in a table. */ @@ -138,7 +137,7 @@ void *HashTable_FindValueBySubstringHash HashEntry *HashTable_CreateEntry(HashTable *, const char *, bool *); void HashTable_Set(HashTable *, const char *, void *); void HashTable_DeleteEntry(HashTable *, HashEntry *); -void HashTable_DebugStats(HashTable *, const char *); +void HashTable_DebugStats(const HashTable *, const char *);
CVS commit: src/usr.bin/make
-#ifdef CLEANUP HashTable_Done(_strings); -#endif } +#endif /* Return a canonical instance of str, with unlimited lifetime. */ const char * Index: src/usr.bin/make/str.h diff -u src/usr.bin/make/str.h:1.19 src/usr.bin/make/str.h:1.20 --- src/usr.bin/make/str.h:1.19 Fri Jan 5 21:56:55 2024 +++ src/usr.bin/make/str.h Sun Jul 7 07:50:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: str.h,v 1.19 2024/01/05 21:56:55 rillig Exp $ */ +/* $NetBSD: str.h,v 1.20 2024/07/07 07:50:57 rillig Exp $ */ /* Copyright (c) 2021 Roland Illig @@ -333,5 +333,7 @@ char *str_concat3(const char *, const ch StrMatchResult Str_Match(const char *, const char *); void Str_Intern_Init(void); +#ifdef CLEANUP void Str_Intern_End(void); +#endif const char *Str_Intern(const char *); Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.381 src/usr.bin/make/suff.c:1.382 --- src/usr.bin/make/suff.c:1.381 Fri Jul 5 05:11:25 2024 +++ src/usr.bin/make/suff.c Sun Jul 7 07:50:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.381 2024/07/05 05:11:25 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.382 2024/07/07 07:50:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -115,7 +115,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.381 2024/07/05 05:11:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.382 2024/07/07 07:50:57 rillig Exp $"); typedef List SuffixList; typedef ListNode SuffixListNode; @@ -2041,11 +2041,11 @@ Suff_Init(void) Suff_ClearSuffixes(); } +#ifdef CLEANUP /* Clean up the suffixes module. */ void Suff_End(void) { -#ifdef CLEANUP SuffixListNode *ln; for (ln = sufflist.first; ln != NULL; ln = ln->next) @@ -2057,8 +2057,8 @@ Suff_End(void) if (nullSuff != NULL) Suffix_Free(nullSuff); Lst_Done(); -#endif } +#endif static void
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 07:50:58 UTC 2024 Modified Files: src/usr.bin/make: arch.c dir.c dir.h job.c job.h main.c make.h parse.c str.c str.h suff.c Log Message: make: only generate code for cleanup functions in CLEANUP mode To generate a diff of this commit: cvs rdiff -u -r1.220 -r1.221 src/usr.bin/make/arch.c cvs rdiff -u -r1.294 -r1.295 src/usr.bin/make/dir.c cvs rdiff -u -r1.48 -r1.49 src/usr.bin/make/dir.h cvs rdiff -u -r1.479 -r1.480 src/usr.bin/make/job.c cvs rdiff -u -r1.79 -r1.80 src/usr.bin/make/job.h cvs rdiff -u -r1.628 -r1.629 src/usr.bin/make/main.c cvs rdiff -u -r1.340 -r1.341 src/usr.bin/make/make.h cvs rdiff -u -r1.732 -r1.733 src/usr.bin/make/parse.c cvs rdiff -u -r1.104 -r1.105 src/usr.bin/make/str.c cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/str.h cvs rdiff -u -r1.381 -r1.382 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 21:35:48 UTC 2024 Modified Files: src/usr.bin/make: main.c Log Message: make: clean up condition when printing an error To generate a diff of this commit: cvs rdiff -u -r1.627 -r1.628 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.627 src/usr.bin/make/main.c:1.628 --- src/usr.bin/make/main.c:1.627 Fri Jul 5 05:11:25 2024 +++ src/usr.bin/make/main.c Sat Jul 6 21:35:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.627 2024/07/05 05:11:25 rillig Exp $ */ +/* $NetBSD: main.c,v 1.628 2024/07/06 21:35:48 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.627 2024/07/05 05:11:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.628 2024/07/06 21:35:48 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -2084,8 +2084,7 @@ PrintOnError(GNode *gn, const char *msg) printf("%s", (const char *)ln->datum); for (ln = ln->next; ln != NULL; ln = ln->next) printf(" %s", (const char *)ln->datum); - } - if (opts.create.first == NULL && mainNode != NULL) + } else printf("%s", mainNode->name); printf("\""); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 21:35:48 UTC 2024 Modified Files: src/usr.bin/make: main.c Log Message: make: clean up condition when printing an error To generate a diff of this commit: cvs rdiff -u -r1.627 -r1.628 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 21:21:10 UTC 2024 Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: cond-func.exp cond-func.mk cond-op-and.exp cond-op-and.mk cond-op-or.exp cond-op-or.mk Log Message: make: error out on conditions containing the operators '&' and '|' These abbreviated variants of the '&&' and '||' operators were never documented, so error out in non-lint mode as well. To generate a diff of this commit: cvs rdiff -u -r1.365 -r1.366 src/usr.bin/make/cond.c cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-func.exp \ src/usr.bin/make/unit-tests/cond-op-and.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/cond-func.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-op-and.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-op-or.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-op-or.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 6 11:09:17 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: varmod-edge.mk Log Message: tests/make: sync a comment with reality To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.27 src/usr.bin/make/unit-tests/varmod-edge.mk:1.28 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.27 Sat Jul 6 10:36:23 2024 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Jul 6 11:09:17 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.27 2024/07/06 10:36:23 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.28 2024/07/06 11:09:17 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -74,8 +74,8 @@ EXP= [ . warning expected "${EXP}", got "${MOD}" .endif + # The pattern in the nested variable has an unclosed character class. -# No error is reported though, and the pattern is closed implicitly. # # Before str.c 1.104 from 2024-07-06, no error was reported. #
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 6 11:09:17 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: varmod-edge.mk Log Message: tests/make: sync a comment with reality To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 10:36:23 UTC 2024 Modified Files: src/usr.bin/make: str.c src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk Log Message: make: error out on a matching malformed matching pattern '[[' To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/str.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 10:36:23 UTC 2024 Modified Files: src/usr.bin/make: str.c src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk Log Message: make: error out on a matching malformed matching pattern '[[' To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/str.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/str.c diff -u src/usr.bin/make/str.c:1.103 src/usr.bin/make/str.c:1.104 --- src/usr.bin/make/str.c:1.103 Sun Apr 14 15:21:20 2024 +++ src/usr.bin/make/str.c Sat Jul 6 10:36:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $ */ +/* $NetBSD: str.c,v 1.104 2024/07/06 10:36:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -71,7 +71,7 @@ #include "make.h" /* "@(#)str.c 5.8 (Berkeley) 6/1/90" */ -MAKE_RCSID("$NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $"); +MAKE_RCSID("$NetBSD: str.c,v 1.104 2024/07/06 10:36:23 rillig Exp $"); static HashTable interned_strings; @@ -356,8 +356,10 @@ match_fixed_length: goto no_match; while (*pat != ']' && *pat != '\0') pat++; - if (*pat == '\0') + if (*pat == '\0') { +res.error = "Unfinished character list"; pat--; + } continue; } Index: src/usr.bin/make/unit-tests/varmod-edge.exp diff -u src/usr.bin/make/unit-tests/varmod-edge.exp:1.24 src/usr.bin/make/unit-tests/varmod-edge.exp:1.25 --- src/usr.bin/make/unit-tests/varmod-edge.exp:1.24 Sat Jul 6 10:14:35 2024 +++ src/usr.bin/make/unit-tests/varmod-edge.exp Sat Jul 6 10:36:23 2024 @@ -1,4 +1,5 @@ make: "varmod-edge.mk" line 60: while evaluating variable "MOD" with value "${INP:M${:U*)}}": while evaluating variable "INP" with value "(parentheses)": while evaluating "${:U*)" with value "*)": Unclosed expression, expecting '}' for modifier "U*)" +make: "varmod-edge.mk" line 88: warning: while evaluating variable "MOD" with value "${INP:M${:U[[}}": while evaluating variable "INP" with value "[ [[ [[[": Unfinished character list in pattern '[[' of modifier ':M' make: "varmod-edge.mk" line 178: while evaluating variable "MOD" with value "${INP:a\=b}": while evaluating variable "INP" with value "file.c file...": Unfinished modifier ('=' missing) make: "varmod-edge.mk" line 194: while evaluating variable "MOD" with value "${INP}": while evaluating variable "INP" with value "value": Unknown modifier ":" make: "varmod-edge.mk" line 194: while evaluating variable "MOD" with value "${INP}": while evaluating variable "INP" with value "": Unknown modifier ":" Index: src/usr.bin/make/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.26 src/usr.bin/make/unit-tests/varmod-edge.mk:1.27 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.26 Sat Jul 6 10:14:35 2024 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Jul 6 10:36:23 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.26 2024/07/06 10:14:35 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.27 2024/07/06 10:36:23 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -77,14 +77,14 @@ EXP= [ # The pattern in the nested variable has an unclosed character class. # No error is reported though, and the pattern is closed implicitly. # -# XXX: It is unexpected that no error is reported. -# See str.c, function Str_Match. +# Before str.c 1.104 from 2024-07-06, no error was reported. # # Before 2019-12-02, this test case triggered an out-of-bounds read # in Str_Match. INP= [ [[ [[[ MOD= ${INP:M${:U[[}} EXP= [ +# expect+1: warning: while evaluating variable "MOD" with value "${INP:M${:U[[}}": while evaluating variable "INP" with value "[ [[ [[[": Unfinished character list in pattern '[[' of modifier ':M' .if ${MOD} != ${EXP} . warning expected "${EXP}", got "${MOD}" .endif
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 6 10:14:35 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: deptgt.exp deptgt.mk directive-for-errors.exp directive-for-errors.mk directive-for-escape.exp directive-for-escape.mk directive-for.exp directive-for.mk varmod-edge.exp varmod-edge.mk Log Message: tests/make: clean up tests Prefer "expect+X" directives to be above the code generating them, instead of "expect-X" directives below the code. In varmod-edge.mk, separate the tests, as the common loop does not pull its weight. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/deptgt.exp cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/deptgt.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/directive-for-errors.exp cvs rdiff -u -r1.12 -r1.13 \ src/usr.bin/make/unit-tests/directive-for-errors.mk cvs rdiff -u -r1.28 -r1.29 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.26 -r1.27 \ src/usr.bin/make/unit-tests/directive-for-escape.mk \ src/usr.bin/make/unit-tests/directive-for.mk cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/directive-for.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/deptgt.exp diff -u src/usr.bin/make/unit-tests/deptgt.exp:1.16 src/usr.bin/make/unit-tests/deptgt.exp:1.17 --- src/usr.bin/make/unit-tests/deptgt.exp:1.16 Fri Jul 5 20:01:52 2024 +++ src/usr.bin/make/unit-tests/deptgt.exp Sat Jul 6 10:14:35 2024 @@ -8,6 +8,7 @@ ParseDependency(: empty-source) Parsing line 39: : command for empty targets list Parsing line 40: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) +make: "deptgt.mk" line 45: while evaluating "${:U:Z}:" with value "": Unknown modifier "Z" make: "deptgt.mk" line 49: while parsing "${:U:Z}:": Unknown modifier "Z" make: "deptgt.mk" line 52: warning: Extra target 'ordinary' ignored make: "deptgt.mk" line 55: warning: Extra target (ordinary) ignored Index: src/usr.bin/make/unit-tests/deptgt.mk diff -u src/usr.bin/make/unit-tests/deptgt.mk:1.19 src/usr.bin/make/unit-tests/deptgt.mk:1.20 --- src/usr.bin/make/unit-tests/deptgt.mk:1.19 Fri Jul 5 20:01:52 2024 +++ src/usr.bin/make/unit-tests/deptgt.mk Sat Jul 6 10:14:35 2024 @@ -1,4 +1,4 @@ -# $NetBSD: deptgt.mk,v 1.19 2024/07/05 20:01:52 rillig Exp $ +# $NetBSD: deptgt.mk,v 1.20 2024/07/06 10:14:35 rillig Exp $ # # Tests for special targets like .BEGIN or .SUFFIXES in dependency # declarations. @@ -39,14 +39,14 @@ ${:U}: empty-source : command for empty targets list .MAKEFLAGS: -d0 -# Just to show that a malformed expression is only expanded once in -# ParseDependencyTargetWord. The only way to produce an expression that -# is well-formed on the first expansion and ill-formed on the second -# expansion would be to use the variable modifier '::=' to modify the -# targets. This in turn would be such an extreme and unreliable edge case -# that nobody uses it. +# In a dependency declaration, the whole line is expanded before interpreting +# the line. +# expect+1: while evaluating "${:U:Z}:" with value "": Unknown modifier "Z" +${:U:Z}: +# After expanding the line as a whole, each target is parsed but not +# evaluated, separately, in ParseDependencyTargetWord. # expect+1: while parsing "${:U:Z}:": Unknown modifier "Z" -{:U:Z}: +$${:U:Z}: # expect+1: warning: Extra target 'ordinary' ignored .END ordinary: @@ -56,6 +56,3 @@ {:U:Z}: # expect+1: warning: Special and mundane targets don't mix. Mundane ones ignored ordinary .PATH: - -all: - @:; Index: src/usr.bin/make/unit-tests/directive-for-errors.exp diff -u src/usr.bin/make/unit-tests/directive-for-errors.exp:1.7 src/usr.bin/make/unit-tests/directive-for-errors.exp:1.8 --- src/usr.bin/make/unit-tests/directive-for-errors.exp:1.7 Fri Jul 5 19:47:22 2024 +++ src/usr.bin/make/unit-tests/directive-for-errors.exp Sat Jul 6 10:14:35 2024 @@ -1,17 +1,17 @@ make: "directive-for-errors.mk" line 9: Unknown directive "fori" -make: "directive-for-errors.mk" line 10: warning: <> -make: "directive-for-errors.mk" line 11: for-less endfor +make: "directive-for-errors.mk" line 11: warning: <> +make: "directive-for-errors.mk" line 13: for-less endfor make: "directive-for-errors.mk" line 25: Unknown directive "for" -make: "directive-for-errors.mk" line 26: warning: <> -make: "directive-for-errors.mk" line 27: for-less endfor +make: "directive-for-errors.mk" line 27: warning: <> +make: "directive-for-errors.mk" line 29: for-less endfor make: "directive-for-errors.mk" line 44: invalid character '$' in .for loop variable name make: "directive-for-errors.mk" line 52: no iteration variables in for make:
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 6 10:14:35 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: deptgt.exp deptgt.mk directive-for-errors.exp directive-for-errors.mk directive-for-escape.exp directive-for-escape.mk directive-for.exp directive-for.mk varmod-edge.exp varmod-edge.mk Log Message: tests/make: clean up tests Prefer "expect+X" directives to be above the code generating them, instead of "expect-X" directives below the code. In varmod-edge.mk, separate the tests, as the common loop does not pull its weight. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/deptgt.exp cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/deptgt.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/directive-for-errors.exp cvs rdiff -u -r1.12 -r1.13 \ src/usr.bin/make/unit-tests/directive-for-errors.mk cvs rdiff -u -r1.28 -r1.29 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.26 -r1.27 \ src/usr.bin/make/unit-tests/directive-for-escape.mk \ src/usr.bin/make/unit-tests/directive-for.mk cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/directive-for.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 20:01:53 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: deptgt.exp deptgt.mk var-eval-short.exp var-eval-short.mk varmod-ifelse.exp varmod-ifelse.mk Log Message: make: in error messages, distinguish parsing from evaluating To generate a diff of this commit: cvs rdiff -u -r1.1132 -r1.1133 src/usr.bin/make/var.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/deptgt.exp cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/deptgt.mk cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/unit-tests/var-eval-short.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/var-eval-short.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.31 -r1.32 src/usr.bin/make/unit-tests/varmod-ifelse.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 19:47:22 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cond-token-string.exp cond-token-string.mk deptgt.exp deptgt.mk directive-for-errors.exp directive-for-errors.mk directive-for-escape.exp directive-for-escape.mk directive-for.exp directive-for.mk directive-include.exp directive-include.mk moderrs.exp moderrs.mk var-eval-short.exp var-eval-short.mk vardebug.exp vardebug.mk varmod-assign.exp varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-ifelse.exp varmod-ifelse.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match-escape.exp varmod-match-escape.mk varmod-range.exp varmod-range.mk varmod-shell.exp varmod-shell.mk varmod-subst-regex.exp varmod-subst.exp varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-errors.exp varparse-errors.mk Log Message: make: in error messages for anonymous variables, log the value To generate a diff of this commit: cvs rdiff -u -r1.1131 -r1.1132 src/usr.bin/make/var.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/directive-include.exp \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-token-string.mk \ src/usr.bin/make/unit-tests/vardebug.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/deptgt.exp \ src/usr.bin/make/unit-tests/directive-include.mk \ src/usr.bin/make/unit-tests/varmod-range.exp \ src/usr.bin/make/unit-tests/varmod.exp cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/deptgt.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-for-errors.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp cvs rdiff -u -r1.11 -r1.12 \ src/usr.bin/make/unit-tests/directive-for-errors.mk cvs rdiff -u -r1.27 -r1.28 \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/var-eval-short.exp cvs rdiff -u -r1.25 -r1.26 \ src/usr.bin/make/unit-tests/directive-for-escape.mk \ src/usr.bin/make/unit-tests/directive-for.mk \ src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/directive-for.exp \ src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.40 -r1.41 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/var-eval-short.mk \ src/usr.bin/make/unit-tests/varmod-range.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-match-escape.exp cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-gmtime.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/varmod-ifelse.mk cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-localtime.exp \ src/usr.bin/make/unit-tests/varmod-localtime.mk \ src/usr.bin/make/unit-tests/varparse-errors.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-loop-delete.mk \ src/usr.bin/make/unit-tests/varmod-subst.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-loop-varname.exp \ src/usr.bin/make/unit-tests/varmod-shell.mk \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-loop-varname.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-match-escape.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-shell.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1131 src/usr.bin/make/var.c:1.1132 --- src/usr.bin/make/var.c:1.1131 Fri Jul 5 18:59:33 2024 +++ src/usr.bin/make/var.c Fri Jul 5 19:47:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1131 2024/07/05 18:59:33 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1132 2024/07/05 19:47:22 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1131 2024/07/05 18:59:33 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1132 2024/07/05 19:47:22 rillig Exp $"); /*
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 19:47:22 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cond-token-string.exp cond-token-string.mk deptgt.exp deptgt.mk directive-for-errors.exp directive-for-errors.mk directive-for-escape.exp directive-for-escape.mk directive-for.exp directive-for.mk directive-include.exp directive-include.mk moderrs.exp moderrs.mk var-eval-short.exp var-eval-short.mk vardebug.exp vardebug.mk varmod-assign.exp varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-ifelse.exp varmod-ifelse.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match-escape.exp varmod-match-escape.mk varmod-range.exp varmod-range.mk varmod-shell.exp varmod-shell.mk varmod-subst-regex.exp varmod-subst.exp varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-errors.exp varparse-errors.mk Log Message: make: in error messages for anonymous variables, log the value To generate a diff of this commit: cvs rdiff -u -r1.1131 -r1.1132 src/usr.bin/make/var.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/directive-include.exp \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-token-string.mk \ src/usr.bin/make/unit-tests/vardebug.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/deptgt.exp \ src/usr.bin/make/unit-tests/directive-include.mk \ src/usr.bin/make/unit-tests/varmod-range.exp \ src/usr.bin/make/unit-tests/varmod.exp cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/deptgt.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-for-errors.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp cvs rdiff -u -r1.11 -r1.12 \ src/usr.bin/make/unit-tests/directive-for-errors.mk cvs rdiff -u -r1.27 -r1.28 \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/var-eval-short.exp cvs rdiff -u -r1.25 -r1.26 \ src/usr.bin/make/unit-tests/directive-for-escape.mk \ src/usr.bin/make/unit-tests/directive-for.mk \ src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/directive-for.exp \ src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.40 -r1.41 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/var-eval-short.mk \ src/usr.bin/make/unit-tests/varmod-range.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-match-escape.exp cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-gmtime.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/varmod-ifelse.mk cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-localtime.exp \ src/usr.bin/make/unit-tests/varmod-localtime.mk \ src/usr.bin/make/unit-tests/varparse-errors.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-loop-delete.mk \ src/usr.bin/make/unit-tests/varmod-subst.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-loop-varname.exp \ src/usr.bin/make/unit-tests/varmod-shell.mk \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-loop-varname.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-match-escape.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-shell.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 18:59:33 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk directive-for-escape.exp directive-for-escape.mk moderrs.exp moderrs.mk varmisc.exp varmisc.mk varmod-edge.exp varmod-edge.mk varmod-order.exp varmod-order.mk varparse-errors.exp varparse-errors.mk Log Message: make: error out on unclosed expressions during parse time In exchange, this adds location information. For unnamed expressions, the value is no longer printed. This will be added back in a follow-up commit. To generate a diff of this commit: cvs rdiff -u -r1.1130 -r1.1131 src/usr.bin/make/var.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp \ src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-errors-lint.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cmd-errors.exp cvs rdiff -u -r1.26 -r1.27 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.24 -r1.25 \ src/usr.bin/make/unit-tests/directive-for-escape.mk cvs rdiff -u -r1.39 -r1.40 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmisc.exp \ src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-order.exp \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-order.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1130 src/usr.bin/make/var.c:1.1131 --- src/usr.bin/make/var.c:1.1130 Fri Jul 5 05:11:25 2024 +++ src/usr.bin/make/var.c Fri Jul 5 18:59:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1130 2024/07/05 05:11:25 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1131 2024/07/05 18:59:33 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1130 2024/07/05 05:11:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1131 2024/07/05 18:59:33 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3964,9 +3964,10 @@ ApplyModifiersIndirect(ModChain *ch, con if (*p == ':') p++; else if (*p == '\0' && ch->endc != '\0') { - Error("Unclosed expression after indirect modifier, " - "expecting '%c' for variable \"%s\"", - ch->endc, expr->name); + Parse_Error(PARSE_FATAL, + "Unclosed expression after indirect modifier, " + "expecting '%c'", + ch->endc); *pp = p; return AMIR_OUT; } @@ -4014,12 +4015,10 @@ ApplySingleModifier(const char **pp, Mod LogAfterApply(ch, p, mod); if (*p == '\0' && ch->endc != '\0') { - Error( + Parse_Error(PARSE_FATAL, "Unclosed expression, expecting '%c' for " - "modifier \"%.*s\" of variable \"%s\" with value \"%s\"", - ch->endc, - (int)(p - mod), mod, - ch->expr->name, Expr_Str(ch->expr)); + "modifier \"%.*s\"", + ch->endc, (int)(p - mod), mod); } else if (*p == ':') { p++; } else if (opts.strict && *p != '\0' && *p != ch->endc) { @@ -4072,9 +4071,8 @@ ApplyModifiers( p = *pp; if (*p == '\0' && endc != '\0') { - Error( - "Unclosed expression, expecting '%c' for \"%s\"", - ch.endc, expr->name); + Parse_Error(PARSE_FATAL, + "Unclosed expression, expecting '%c'", ch.endc); goto cleanup; } Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.exp diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.8 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.7 Thu Jul 4 17:47:54 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.exp Fri Jul 5 18:59:33 2024 @@ -1,7 +1,7 @@ : undefined--eol make: in target "unclosed-expression": Unclosed variable "UNCLOSED" : unclosed-expression- -make: Unclosed expression, expecting '}' for "UNCLOSED" +make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' : unclosed-modifier- make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" : unknown-modifier--eol Index:
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 18:59:33 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk directive-for-escape.exp directive-for-escape.mk moderrs.exp moderrs.mk varmisc.exp varmisc.mk varmod-edge.exp varmod-edge.mk varmod-order.exp varmod-order.mk varparse-errors.exp varparse-errors.mk Log Message: make: error out on unclosed expressions during parse time In exchange, this adds location information. For unnamed expressions, the value is no longer printed. This will be added back in a follow-up commit. To generate a diff of this commit: cvs rdiff -u -r1.1130 -r1.1131 src/usr.bin/make/var.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp \ src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-errors-lint.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cmd-errors.exp cvs rdiff -u -r1.26 -r1.27 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.24 -r1.25 \ src/usr.bin/make/unit-tests/directive-for-escape.mk cvs rdiff -u -r1.39 -r1.40 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmisc.exp \ src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-order.exp \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-order.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Fri Jul 5 17:41:50 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-errors-jobs.mk cmd-errors-lint.mk cmd-errors.mk directive-for-escape.exp directive-for-escape.mk moderrs.mk varmisc.mk varmod-edge.exp varmod-edge.mk varmod-order.exp varmod-order.mk varparse-errors.mk Log Message: tests/make: add expected messages for "Unclosed expression" To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-errors-lint.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.25 -r1.26 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.23 -r1.24 \ src/usr.bin/make/unit-tests/directive-for-escape.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-order.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.mk diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.6 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.5 Thu Jul 4 17:47:54 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Fri Jul 5 17:41:50 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cmd-errors-jobs.mk,v 1.5 2024/07/04 17:47:54 rillig Exp $ +# $NetBSD: cmd-errors-jobs.mk,v 1.6 2024/07/05 17:41:50 rillig Exp $ # # Demonstrate how errors in expressions affect whether the commands # are actually executed in jobs mode. @@ -13,22 +13,22 @@ all: undefined unclosed-expression unclo undefined: : $@-${UNDEFINED}-eol -# XXX: This command is executed even though it contains parse errors. +unclosed-expression: # expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED" +# XXX: This command is executed even though it contains parse errors. # expect: : unclosed-expression- -unclosed-expression: : $@-${UNCLOSED -# XXX: This command is executed even though it contains parse errors. +unclosed-modifier: # expect: make: Unclosed expression, expecting '}' for "UNCLOSED" +# XXX: This command is executed even though it contains parse errors. # expect: : unclosed-modifier- -unclosed-modifier: : $@-${UNCLOSED: -# XXX: This command is executed even though it contains parse errors. +unknown-modifier: # expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" +# XXX: This command is executed even though it contains parse errors. # expect: : unknown-modifier--eol -unknown-modifier: : $@-${UNKNOWN:Z}-eol # expect: : end-eol Index: src/usr.bin/make/unit-tests/cmd-errors-lint.mk diff -u src/usr.bin/make/unit-tests/cmd-errors-lint.mk:1.2 src/usr.bin/make/unit-tests/cmd-errors-lint.mk:1.3 --- src/usr.bin/make/unit-tests/cmd-errors-lint.mk:1.2 Tue Apr 23 22:51:28 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-lint.mk Fri Jul 5 17:41:50 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cmd-errors-lint.mk,v 1.2 2024/04/23 22:51:28 rillig Exp $ +# $NetBSD: cmd-errors-lint.mk,v 1.3 2024/07/05 17:41:50 rillig Exp $ # # Demonstrate how errors in expressions affect whether the commands # are actually executed. @@ -10,24 +10,29 @@ all: undefined unclosed-expression unclo # Undefined variables in expressions are not an error. They expand to empty # strings. undefined: +# expect: : undefined : $@ ${UNDEFINED} -# XXX: As of 2020-11-01, this obvious syntax error is not detected. -# XXX: As of 2020-11-01, this command is executed even though it contains -# parse errors. unclosed-expression: +# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED" +# XXX: This command is executed even though it contains parse errors. +# expect: : unclosed-expression : $@ ${UNCLOSED -# XXX: As of 2020-11-01, this obvious syntax error is not detected. -# XXX: As of 2020-11-01, this command is executed even though it contains -# parse errors. unclosed-modifier: +# expect: make: Unclosed expression, expecting '}' for "UNCLOSED" +# XXX: This command is executed even though it contains parse errors. +# expect: : unclosed-modifier : $@ ${UNCLOSED: -# XXX: As of 2020-11-01, this command is executed even though it contains -# parse errors. unknown-modifier: +# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" +# XXX: This command is executed even
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Fri Jul 5 17:41:50 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-errors-jobs.mk cmd-errors-lint.mk cmd-errors.mk directive-for-escape.exp directive-for-escape.mk moderrs.mk varmisc.mk varmod-edge.exp varmod-edge.mk varmod-order.exp varmod-order.mk varparse-errors.mk Log Message: tests/make: add expected messages for "Unclosed expression" To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-errors-lint.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.25 -r1.26 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.23 -r1.24 \ src/usr.bin/make/unit-tests/directive-for-escape.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-order.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 05:11:25 UTC 2024 Modified Files: src/usr.bin/make: arch.c job.c main.c make.h suff.c var.c Log Message: make: reduce lint-specific comments about ARGSUSED To generate a diff of this commit: cvs rdiff -u -r1.219 -r1.220 src/usr.bin/make/arch.c cvs rdiff -u -r1.478 -r1.479 src/usr.bin/make/job.c cvs rdiff -u -r1.626 -r1.627 src/usr.bin/make/main.c cvs rdiff -u -r1.339 -r1.340 src/usr.bin/make/make.h cvs rdiff -u -r1.380 -r1.381 src/usr.bin/make/suff.c cvs rdiff -u -r1.1129 -r1.1130 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/arch.c diff -u src/usr.bin/make/arch.c:1.219 src/usr.bin/make/arch.c:1.220 --- src/usr.bin/make/arch.c:1.219 Sun Jun 2 15:31:25 2024 +++ src/usr.bin/make/arch.c Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.219 2024/06/02 15:31:25 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.220 2024/07/05 05:11:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -126,7 +126,7 @@ #include "config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.219 2024/06/02 15:31:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.220 2024/07/05 05:11:25 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -770,7 +770,6 @@ Arch_Touch(GNode *gn) * Both the modification time of the library and of the RANLIBMAG member are * set to 'now'. */ -/*ARGSUSED*/ void Arch_TouchLib(GNode *gn MAKE_ATTR_UNUSED) { @@ -871,7 +870,6 @@ Arch_FindLib(GNode *gn, SearchPath *path Var_Set(gn, TARGET, gn->name); } -/* ARGSUSED */ static bool RanlibOODate(const GNode *gn MAKE_ATTR_UNUSED) { Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.478 src/usr.bin/make/job.c:1.479 --- src/usr.bin/make/job.c:1.478 Fri Jun 28 15:20:57 2024 +++ src/usr.bin/make/job.c Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.478 2024/06/28 15:20:57 rillig Exp $ */ +/* $NetBSD: job.c,v 1.479 2024/07/05 05:11:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.478 2024/06/28 15:20:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.479 2024/07/05 05:11:25 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -594,7 +594,6 @@ JobCondPassSig(int signo) * * Sends a token on the child exit pipe to wake us up from select()/poll(). */ -/*ARGSUSED*/ static void JobChildSig(int signo MAKE_ATTR_UNUSED) { @@ -606,7 +605,6 @@ JobChildSig(int signo MAKE_ATTR_UNUSED) /* Resume all stopped jobs. */ -/*ARGSUSED*/ static void JobContinueSig(int signo MAKE_ATTR_UNUSED) { Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.626 src/usr.bin/make/main.c:1.627 --- src/usr.bin/make/main.c:1.626 Thu Jul 4 20:18:40 2024 +++ src/usr.bin/make/main.c Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.626 2024/07/04 20:18:40 rillig Exp $ */ +/* $NetBSD: main.c,v 1.627 2024/07/05 05:11:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.626 2024/07/04 20:18:40 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.627 2024/07/05 05:11:25 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -789,7 +789,6 @@ AppendWords(StringList *lp, char *str) } #ifdef SIGINFO -/*ARGSUSED*/ static void siginfo(int signo MAKE_ATTR_UNUSED) { Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.339 src/usr.bin/make/make.h:1.340 --- src/usr.bin/make/make.h:1.339 Sat Jun 15 20:02:45 2024 +++ src/usr.bin/make/make.h Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.339 2024/06/15 20:02:45 rillig Exp $ */ +/* $NetBSD: make.h,v 1.340 2024/07/05 05:11:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #define MAKE_GNUC_PREREQ(x, y) 0 #endif -#if MAKE_GNUC_PREREQ(2, 7) +#if MAKE_GNUC_PREREQ(2, 7) || lint #define MAKE_ATTR_UNUSED __attribute__((__unused__)) #else #define MAKE_ATTR_UNUSED /* delete */ @@ -918,7 +918,6 @@ const char *GNodeMade_Name(GNodeMade) MA #ifdef CLEANUP void Parse_RegisterCommand(char *); #else -/* ARGSUSED */ MAKE_INLINE void Parse_RegisterCommand(char *cmd MAKE_ATTR_UNUSED) { Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.380 src/usr.bin/make/suff.c:1.381 --- src/usr.bin/make/suff.c:1.380 Sun Jun 2 15:31:26 2024 +++ src/usr.bin/make/suff.c Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.380 2024/06/02 15:31:26 rillig Exp $ */ +/* $NetBSD:
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 05:11:25 UTC 2024 Modified Files: src/usr.bin/make: arch.c job.c main.c make.h suff.c var.c Log Message: make: reduce lint-specific comments about ARGSUSED To generate a diff of this commit: cvs rdiff -u -r1.219 -r1.220 src/usr.bin/make/arch.c cvs rdiff -u -r1.478 -r1.479 src/usr.bin/make/job.c cvs rdiff -u -r1.626 -r1.627 src/usr.bin/make/main.c cvs rdiff -u -r1.339 -r1.340 src/usr.bin/make/make.h cvs rdiff -u -r1.380 -r1.381 src/usr.bin/make/suff.c cvs rdiff -u -r1.1129 -r1.1130 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 20:18:40 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: Makefile compat-error.exp cond-cmp-numeric.exp cond-func-defined.exp cond-late.exp cond-op-not.exp cond-op-parentheses.exp cond-op.exp cond-short.exp cond-token-number.exp cond-token-string.exp dep-percent.exp dep.exp depsrc-ignore.exp deptgt-begin-fail-indirect.exp deptgt-begin-fail.exp deptgt-delete_on_error.exp deptgt-end-fail-all.exp deptgt-end-fail-indirect.exp deptgt-end-fail.exp deptgt-error.exp deptgt-ignore.exp deptgt-path-suffix.exp deptgt.exp directive-dinclude.exp directive-elif.exp directive-else.exp directive-for-generating-endif.exp directive-for-if.exp directive-for-null.exp directive-hyphen-include.exp directive-ifmake.exp directive-include-fatal.exp directive-include.exp directive-info.exp directive-sinclude.exp directive-undef.exp directive-unexport-env.exp directive-warning.exp directive.exp doterror.exp jobs-empty-commands-error.exp jobs-error-indirect.exp jobs-error-nested-make.exp jobs-error-nested.exp opt-debug-errors-jobs.exp opt-debug-errors.exp opt-debug-graph2.exp opt-debug-graph3.exp opt-file.exp opt-keep-going-indirect.exp opt-keep-going-multiple.exp opt-keep-going.exp opt-warnings-as-errors.exp opt.exp parse.exp posix.exp sh-jobs.exp suff-add-later.exp suff-clear-regular.exp suff-clear-single.exp suff-main-several.exp suff-self.exp suff-transform-endless.exp suff-transform-expand.exp suff-transform-select.exp suff-use.exp use-inference.exp var-eval-short.exp var-op-assign.exp var-op-expand.exp var-recursive.exp varmod-edge.exp varmod-gmtime.exp varmod-localtime.exp varmod-loop-delete.exp varmod-loop-varname.exp varmod-match-escape.exp varmod-order.exp varmod-range.exp varmod-sysv.exp varname-dot-newline.exp varname-make_print_var_on_error-jobs.exp varname-make_print_var_on_error.exp varname.exp Log Message: make: on error, print the targets to be made This helps to understand situations with several nested sub-makes in varying directories. To generate a diff of this commit: cvs rdiff -u -r1.625 -r1.626 src/usr.bin/make/main.c cvs rdiff -u -r1.348 -r1.349 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/compat-error.exp \ src/usr.bin/make/unit-tests/depsrc-ignore.exp \ src/usr.bin/make/unit-tests/directive-include-fatal.exp \ src/usr.bin/make/unit-tests/opt-debug-errors.exp \ src/usr.bin/make/unit-tests/varname-make_print_var_on_error.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp \ src/usr.bin/make/unit-tests/cond-func-defined.exp \ src/usr.bin/make/unit-tests/directive.exp \ src/usr.bin/make/unit-tests/opt-file.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-late.exp \ src/usr.bin/make/unit-tests/cond-token-number.exp \ src/usr.bin/make/unit-tests/directive-elif.exp \ src/usr.bin/make/unit-tests/directive-ifmake.exp \ src/usr.bin/make/unit-tests/var-op-assign.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-op-not.exp \ src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp \ src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-op-parentheses.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail.exp \ src/usr.bin/make/unit-tests/directive-else.exp \ src/usr.bin/make/unit-tests/directive-warning.exp \ src/usr.bin/make/unit-tests/parse.exp \ src/usr.bin/make/unit-tests/varname-dot-newline.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-op.exp \ src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/directive-include.exp \ src/usr.bin/make/unit-tests/suff-main-several.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-short.exp \ src/usr.bin/make/unit-tests/deptgt.exp \ src/usr.bin/make/unit-tests/directive-unexport-env.exp \ src/usr.bin/make/unit-tests/varmod-range.exp \ src/usr.bin/make/unit-tests/varmod-sysv.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-percent.exp \ src/usr.bin/make/unit-tests/dep.exp \ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail-all.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-error.exp \ src/usr.bin/make/unit-tests/deptgt-ignore.exp \ src/usr.bin/make/unit-tests/deptgt-path-suffix.exp \
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 20:18:40 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: Makefile compat-error.exp cond-cmp-numeric.exp cond-func-defined.exp cond-late.exp cond-op-not.exp cond-op-parentheses.exp cond-op.exp cond-short.exp cond-token-number.exp cond-token-string.exp dep-percent.exp dep.exp depsrc-ignore.exp deptgt-begin-fail-indirect.exp deptgt-begin-fail.exp deptgt-delete_on_error.exp deptgt-end-fail-all.exp deptgt-end-fail-indirect.exp deptgt-end-fail.exp deptgt-error.exp deptgt-ignore.exp deptgt-path-suffix.exp deptgt.exp directive-dinclude.exp directive-elif.exp directive-else.exp directive-for-generating-endif.exp directive-for-if.exp directive-for-null.exp directive-hyphen-include.exp directive-ifmake.exp directive-include-fatal.exp directive-include.exp directive-info.exp directive-sinclude.exp directive-undef.exp directive-unexport-env.exp directive-warning.exp directive.exp doterror.exp jobs-empty-commands-error.exp jobs-error-indirect.exp jobs-error-nested-make.exp jobs-error-nested.exp opt-debug-errors-jobs.exp opt-debug-errors.exp opt-debug-graph2.exp opt-debug-graph3.exp opt-file.exp opt-keep-going-indirect.exp opt-keep-going-multiple.exp opt-keep-going.exp opt-warnings-as-errors.exp opt.exp parse.exp posix.exp sh-jobs.exp suff-add-later.exp suff-clear-regular.exp suff-clear-single.exp suff-main-several.exp suff-self.exp suff-transform-endless.exp suff-transform-expand.exp suff-transform-select.exp suff-use.exp use-inference.exp var-eval-short.exp var-op-assign.exp var-op-expand.exp var-recursive.exp varmod-edge.exp varmod-gmtime.exp varmod-localtime.exp varmod-loop-delete.exp varmod-loop-varname.exp varmod-match-escape.exp varmod-order.exp varmod-range.exp varmod-sysv.exp varname-dot-newline.exp varname-make_print_var_on_error-jobs.exp varname-make_print_var_on_error.exp varname.exp Log Message: make: on error, print the targets to be made This helps to understand situations with several nested sub-makes in varying directories. To generate a diff of this commit: cvs rdiff -u -r1.625 -r1.626 src/usr.bin/make/main.c cvs rdiff -u -r1.348 -r1.349 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/compat-error.exp \ src/usr.bin/make/unit-tests/depsrc-ignore.exp \ src/usr.bin/make/unit-tests/directive-include-fatal.exp \ src/usr.bin/make/unit-tests/opt-debug-errors.exp \ src/usr.bin/make/unit-tests/varname-make_print_var_on_error.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp \ src/usr.bin/make/unit-tests/cond-func-defined.exp \ src/usr.bin/make/unit-tests/directive.exp \ src/usr.bin/make/unit-tests/opt-file.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-late.exp \ src/usr.bin/make/unit-tests/cond-token-number.exp \ src/usr.bin/make/unit-tests/directive-elif.exp \ src/usr.bin/make/unit-tests/directive-ifmake.exp \ src/usr.bin/make/unit-tests/var-op-assign.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-op-not.exp \ src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp \ src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-op-parentheses.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail.exp \ src/usr.bin/make/unit-tests/directive-else.exp \ src/usr.bin/make/unit-tests/directive-warning.exp \ src/usr.bin/make/unit-tests/parse.exp \ src/usr.bin/make/unit-tests/varname-dot-newline.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-op.exp \ src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/directive-include.exp \ src/usr.bin/make/unit-tests/suff-main-several.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-short.exp \ src/usr.bin/make/unit-tests/deptgt.exp \ src/usr.bin/make/unit-tests/directive-unexport-env.exp \ src/usr.bin/make/unit-tests/varmod-range.exp \ src/usr.bin/make/unit-tests/varmod-sysv.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-percent.exp \ src/usr.bin/make/unit-tests/dep.exp \ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail-all.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-error.exp \ src/usr.bin/make/unit-tests/deptgt-ignore.exp \ src/usr.bin/make/unit-tests/deptgt-path-suffix.exp \
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 18:53:38 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk varmod-assign.exp varmod-order.exp varmod-order.mk varmod-select-words.exp varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-errors.exp varparse-errors.mk Log Message: make: error out on the "Bad modifier" error message Previously, the "Bad modifier" error message did not affect make's exit status. As a side effect, this kind of error now gets more context information. To generate a diff of this commit: cvs rdiff -u -r1.1128 -r1.1129 src/usr.bin/make/var.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-order.mk \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-select-words.exp cvs rdiff -u -r1.14 -r1.15 \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod.exp \ src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1128 src/usr.bin/make/var.c:1.1129 --- src/usr.bin/make/var.c:1.1128 Thu Jul 4 17:47:53 2024 +++ src/usr.bin/make/var.c Thu Jul 4 18:53:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1128 2024/07/04 17:47:53 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1129 2024/07/04 18:53:37 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1128 2024/07/04 17:47:53 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1129 2024/07/04 18:53:37 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -1965,11 +1965,9 @@ FormatTime(const char *fmt, time_t t, bo * and stores the result back in ch->expr->value via Expr_SetValueOwn or * Expr_SetValueRefer. * - * If evaluating fails, the fallback error message "Bad modifier" is printed - * using Error. This function has no side effects, it really just prints the - * error message, continuing as if nothing had happened. TODO: This should be - * fixed by adding proper error handling to Var_Subst, Var_Parse, - * ApplyModifiers and ModifyWords. + * If evaluating fails, the fallback error message "Bad modifier" is printed. + * TODO: Add proper error handling to Var_Subst, Var_Parse, ApplyModifiers and + * ModifyWords. * * Some modifiers such as :D and :U turn undefined expressions into defined * expressions using Expr_Define. @@ -4118,8 +4116,8 @@ ApplyModifiers( bad_modifier: /* Take a guess at where the modifier ends. */ - Error("Bad modifier \":%.*s\" for variable \"%s\"", - (int)strcspn(mod, ":)}"), mod, expr->name); + Parse_Error(PARSE_FATAL, "Bad modifier \":%.*s\"", + (int)strcspn(mod, ":)}"), mod); cleanup: /* Index: src/usr.bin/make/unit-tests/moderrs.exp diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.38 src/usr.bin/make/unit-tests/moderrs.exp:1.39 --- src/usr.bin/make/unit-tests/moderrs.exp:1.38 Thu Jul 4 17:47:54 2024 +++ src/usr.bin/make/unit-tests/moderrs.exp Thu Jul 4 18:53:37 2024 @@ -31,7 +31,7 @@ make: in target "words": while evaluatin make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier (']' missing) 13= -make: Bad modifier ":[123451234512345123451234512345]" for variable "UNDEF" +make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Bad modifier ":[123451234512345123451234512345]" 12345=S,^ok,:S,^3ok,} make: in target "exclam": while evaluating variable "VARNAME" with value "": Unfinished modifier ('!' missing) @@ -70,21 +70,21 @@ make: Unclosed expression, expecting '}' mod-ts-parse: 112358132134 15152535558513521534 -make: Bad modifier ":ts\65oct" for variable "FIB" +make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":ts\65oct" 65oct} -make: Bad modifier ":ts\65oct" for variable "" +make: in target "mod-ts-parse": while evaluating "${:U${FIB}:ts\65oct} # bad modifier, variable name is """: Bad modifier ":ts\65oct" 65oct} -make: Bad modifier ":tsxy" for variable "FIB" +make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":tsxy" xy} mod-t-parse: -make: Bad modifier
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 18:53:38 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk varmod-assign.exp varmod-order.exp varmod-order.mk varmod-select-words.exp varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-errors.exp varparse-errors.mk Log Message: make: error out on the "Bad modifier" error message Previously, the "Bad modifier" error message did not affect make's exit status. As a side effect, this kind of error now gets more context information. To generate a diff of this commit: cvs rdiff -u -r1.1128 -r1.1129 src/usr.bin/make/var.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-order.mk \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-select-words.exp cvs rdiff -u -r1.14 -r1.15 \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod.exp \ src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 17:47:54 UTC 2024 Modified Files: src/usr.bin/make: parse.c var.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors.exp cond-late.exp cond-late.mk dep-op-missing.exp directive-dinclude.exp directive-export-gmake.exp directive-for-break.exp directive-for-escape.exp directive-for-generating-endif.exp directive-for-if.exp directive-for-null.exp directive-for.exp directive-hyphen-include.exp directive-sinclude.exp directive-undef.exp directive-undef.mk lint.exp moderrs.exp moderrs.mk opt-debug-lint.exp opt-debug-lint.mk opt-file.exp var-op-expand.exp var-op-expand.mk var-recursive.exp varmisc.exp varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp varmod-assign.mk varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-hash.exp varmod-indirect.exp varmod-indirect.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-range.exp varmod-range.mk varmod-subst-regex.exp varmod-sun-shell.exp varmod-sun-shell.mk varmod-sysv.exp varmod-sysv.mk varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varname-dot-newline.exp Log Message: make: add more context information to error messages In case of a parse error or evaluation error, print the variable value in addition to the variable name, to see the effects of previous expression modifiers. In nested make calls, print the current directory at the bottom of a stack trace, as that information is otherwise hard to get in a parallel build spanning multiple directories. To generate a diff of this commit: cvs rdiff -u -r1.731 -r1.732 src/usr.bin/make/parse.c cvs rdiff -u -r1.1127 -r1.1128 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp \ src/usr.bin/make/unit-tests/cond-late.exp \ src/usr.bin/make/unit-tests/directive-export-gmake.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk \ src/usr.bin/make/unit-tests/directive-for-break.exp \ src/usr.bin/make/unit-tests/lint.exp \ src/usr.bin/make/unit-tests/varmod-hash.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.mk \ src/usr.bin/make/unit-tests/varmod-sun-shell.mk cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors.exp \ src/usr.bin/make/unit-tests/var-op-expand.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-late.mk \ src/usr.bin/make/unit-tests/var-recursive.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk \ src/usr.bin/make/unit-tests/varmod-loop-varname.exp \ src/usr.bin/make/unit-tests/varmod-loop-varname.mk cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-op-missing.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-dinclude.exp \ src/usr.bin/make/unit-tests/directive-for-generating-endif.exp \ src/usr.bin/make/unit-tests/directive-for-if.exp \ src/usr.bin/make/unit-tests/directive-for-null.exp \ src/usr.bin/make/unit-tests/directive-hyphen-include.exp \ src/usr.bin/make/unit-tests/directive-sinclude.exp cvs rdiff -u -r1.24 -r1.25 \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/varmod-match.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/directive-for.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk \ src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/directive-undef.exp \ src/usr.bin/make/unit-tests/varmod-mtime.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/directive-undef.mk \ src/usr.bin/make/unit-tests/varmod-localtime.exp \ src/usr.bin/make/unit-tests/varmod-match-escape.mk cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/opt-debug-lint.exp \ src/usr.bin/make/unit-tests/varmod-indirect.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/opt-debug-lint.mk \ src/usr.bin/make/unit-tests/varmod-gmtime.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/opt-file.exp \ src/usr.bin/make/unit-tests/varmod-mtime.exp \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.20 -r1.21
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 17:47:54 UTC 2024 Modified Files: src/usr.bin/make: parse.c var.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors.exp cond-late.exp cond-late.mk dep-op-missing.exp directive-dinclude.exp directive-export-gmake.exp directive-for-break.exp directive-for-escape.exp directive-for-generating-endif.exp directive-for-if.exp directive-for-null.exp directive-for.exp directive-hyphen-include.exp directive-sinclude.exp directive-undef.exp directive-undef.mk lint.exp moderrs.exp moderrs.mk opt-debug-lint.exp opt-debug-lint.mk opt-file.exp var-op-expand.exp var-op-expand.mk var-recursive.exp varmisc.exp varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp varmod-assign.mk varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-hash.exp varmod-indirect.exp varmod-indirect.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-range.exp varmod-range.mk varmod-subst-regex.exp varmod-sun-shell.exp varmod-sun-shell.mk varmod-sysv.exp varmod-sysv.mk varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varname-dot-newline.exp Log Message: make: add more context information to error messages In case of a parse error or evaluation error, print the variable value in addition to the variable name, to see the effects of previous expression modifiers. In nested make calls, print the current directory at the bottom of a stack trace, as that information is otherwise hard to get in a parallel build spanning multiple directories. To generate a diff of this commit: cvs rdiff -u -r1.731 -r1.732 src/usr.bin/make/parse.c cvs rdiff -u -r1.1127 -r1.1128 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp \ src/usr.bin/make/unit-tests/cond-late.exp \ src/usr.bin/make/unit-tests/directive-export-gmake.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk \ src/usr.bin/make/unit-tests/directive-for-break.exp \ src/usr.bin/make/unit-tests/lint.exp \ src/usr.bin/make/unit-tests/varmod-hash.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.mk \ src/usr.bin/make/unit-tests/varmod-sun-shell.mk cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors.exp \ src/usr.bin/make/unit-tests/var-op-expand.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-late.mk \ src/usr.bin/make/unit-tests/var-recursive.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk \ src/usr.bin/make/unit-tests/varmod-loop-varname.exp \ src/usr.bin/make/unit-tests/varmod-loop-varname.mk cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-op-missing.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-dinclude.exp \ src/usr.bin/make/unit-tests/directive-for-generating-endif.exp \ src/usr.bin/make/unit-tests/directive-for-if.exp \ src/usr.bin/make/unit-tests/directive-for-null.exp \ src/usr.bin/make/unit-tests/directive-hyphen-include.exp \ src/usr.bin/make/unit-tests/directive-sinclude.exp cvs rdiff -u -r1.24 -r1.25 \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/varmod-match.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/directive-for.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk \ src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/directive-undef.exp \ src/usr.bin/make/unit-tests/varmod-mtime.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/directive-undef.mk \ src/usr.bin/make/unit-tests/varmod-localtime.exp \ src/usr.bin/make/unit-tests/varmod-match-escape.mk cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/opt-debug-lint.exp \ src/usr.bin/make/unit-tests/varmod-indirect.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/opt-debug-lint.mk \ src/usr.bin/make/unit-tests/varmod-gmtime.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/opt-file.exp \ src/usr.bin/make/unit-tests/varmod-mtime.exp \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.20 -r1.21
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jul 2 20:10:45 UTC 2024 Modified Files: src/usr.bin/make: var.c Log Message: make: trim trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.1126 -r1.1127 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1126 src/usr.bin/make/var.c:1.1127 --- src/usr.bin/make/var.c:1.1126 Mon Jul 1 21:02:26 2024 +++ src/usr.bin/make/var.c Tue Jul 2 20:10:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1126 2024/07/01 21:02:26 sjg Exp $ */ +/* $NetBSD: var.c,v 1.1127 2024/07/02 20:10:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1126 2024/07/01 21:02:26 sjg Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1127 2024/07/02 20:10:45 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3209,7 +3209,7 @@ ApplyModifier_To(const char **pp, ModCha Expr_SetValueOwn(expr, str_totitle(Expr_Str(expr))); return AMR_OK; } - + if (mod[1] == 'u') {/* :tu */ *pp = mod + 2; if (Expr_ShouldEval(expr))
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jul 2 20:10:45 UTC 2024 Modified Files: src/usr.bin/make: var.c Log Message: make: trim trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.1126 -r1.1127 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/sets/lists/tests
Module Name:src Committed By: rillig Date: Mon Jul 1 21:24:05 UTC 2024 Modified Files: src/distrib/sets/lists/tests: mi Log Message: tests/make: add newly added test to file list To generate a diff of this commit: cvs rdiff -u -r1.1324 -r1.1325 src/distrib/sets/lists/tests/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/sets/lists/tests
Module Name:src Committed By: rillig Date: Mon Jul 1 21:24:05 UTC 2024 Modified Files: src/distrib/sets/lists/tests: mi Log Message: tests/make: add newly added test to file list To generate a diff of this commit: cvs rdiff -u -r1.1324 -r1.1325 src/distrib/sets/lists/tests/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1324 src/distrib/sets/lists/tests/mi:1.1325 --- src/distrib/sets/lists/tests/mi:1.1324 Sun Jun 16 18:40:58 2024 +++ src/distrib/sets/lists/tests/mi Mon Jul 1 21:24:05 2024 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1324 2024/06/16 18:40:58 rillig Exp $ +# $NetBSD: mi,v 1.1325 2024/07/01 21:24:05 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6291,6 +6291,8 @@ ./usr/tests/usr.bin/make/unit-tests/varmod-to-one-word.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-to-separator.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-to-separator.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/varmod-to-title.exptests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/varmod-to-title.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-to-upper.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-to-upper.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-undefined.exp tests-usr.bin-tests compattestfile,atf
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 15:21:24 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk opt-debug-file.exp opt-debug-file.mk varmod-assign.exp varmod-assign.mk varmod-edge.exp varmod-edge.mk varmod-subst-regex.exp varmod-sysv.exp varmod-sysv.mk Log Message: make: error out on some more syntax errors Previously, these errors only produced a message on stderr. They only affected make's exit status when they were evaluated at parse time, but not when evaluating the commands for a specific target right before executing them. The affected syntax errors are: * invalid regular expressions in the ':C' modifier * out-of-range references to regex groups in the ':C' modifier * unfinished modifiers To generate a diff of this commit: cvs rdiff -u -r1.1124 -r1.1125 src/usr.bin/make/var.c cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-debug-file.exp \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/opt-debug-file.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-sysv.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-sysv.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1124 src/usr.bin/make/var.c:1.1125 --- src/usr.bin/make/var.c:1.1124 Sun Jun 30 13:01:01 2024 +++ src/usr.bin/make/var.c Sun Jun 30 15:21:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1124 2024/06/30 13:01:01 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1125 2024/06/30 15:21:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1124 2024/06/30 13:01:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1125 2024/06/30 15:21:23 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -1567,7 +1567,7 @@ RegexError(int reerr, const regex_t *pat size_t errlen = regerror(reerr, pat, NULL, 0); char *errbuf = bmake_malloc(errlen); regerror(reerr, pat, errbuf, errlen); - Error("%s: %s", str, errbuf); + Parse_Error(PARSE_FATAL, "%s: %s", str, errbuf); free(errbuf); } @@ -1579,7 +1579,7 @@ RegexReplaceBackref(char ref, SepBuf *bu unsigned int n = (unsigned)ref - '0'; if (n >= nsub) - Error("No subexpression \\%u", n); + Parse_Error(PARSE_FATAL, "No subexpression \\%u", n); else if (m[n].rm_so == -1) { if (opts.strict) Error("No match for subexpression \\%u", n); @@ -2230,8 +2230,8 @@ ParseModifierPart( *pp = p; if (*p != end1 && *p != end2) { - Error("Unfinished modifier for \"%s\" ('%c' missing)", - ch->expr->name, end2); + Parse_Error(PARSE_FATAL, + "Unfinished modifier ('%c' missing)", end2); LazyBuf_Done(part); return false; } @@ -2933,7 +2933,8 @@ ApplyModifier_Subst(const char **pp, Mod char delim = (*pp)[1]; if (delim == '\0') { - Error("Missing delimiter for modifier ':S'"); + Parse_Error(PARSE_FATAL, + "Missing delimiter for modifier ':S'"); (*pp)++; return AMR_CLEANUP; } @@ -2982,7 +2983,8 @@ ApplyModifier_Regex(const char **pp, Mod char delim = (*pp)[1]; if (delim == '\0') { - Error("Missing delimiter for :C modifier"); + Parse_Error(PARSE_FATAL, + "Missing delimiter for modifier ':C'"); (*pp)++; return AMR_CLEANUP; } Index: src/usr.bin/make/unit-tests/moderrs.exp diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.36 src/usr.bin/make/unit-tests/moderrs.exp:1.37 --- src/usr.bin/make/unit-tests/moderrs.exp:1.36 Sun Jun 30 14:23:18 2024 +++ src/usr.bin/make/unit-tests/moderrs.exp Sun Jun 30 15:21:24 2024 @@ -1,8 +1,6 @@ -mod-unknown-direct: make: in target "mod-unknown-direct": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before--after -mod-unknown-indirect: make: in target "mod-unknown-indirect": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before-inner}-after @@ -14,14 +12,12 @@ unclosed-indirect: make: Unclosed expression after indirect modifier, expecting '}' for variable "VAR" VAR:S,V,v,=Thevariable -unfinished-indirect: -make: Unfinished modifier for "VAR" (',' missing) +make: in target "unfinished-indirect": while evaluating variable "VAR": Unfinished modifier (',' missing) VAR:S,V,v= -unfinished-loop: -make: Unfinished modifier for "UNDEF" ('@' missing) +make: in
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 15:21:24 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk opt-debug-file.exp opt-debug-file.mk varmod-assign.exp varmod-assign.mk varmod-edge.exp varmod-edge.mk varmod-subst-regex.exp varmod-sysv.exp varmod-sysv.mk Log Message: make: error out on some more syntax errors Previously, these errors only produced a message on stderr. They only affected make's exit status when they were evaluated at parse time, but not when evaluating the commands for a specific target right before executing them. The affected syntax errors are: * invalid regular expressions in the ':C' modifier * out-of-range references to regex groups in the ':C' modifier * unfinished modifiers To generate a diff of this commit: cvs rdiff -u -r1.1124 -r1.1125 src/usr.bin/make/var.c cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-debug-file.exp \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/opt-debug-file.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-sysv.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-sysv.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Jun 30 14:23:18 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk Log Message: tests/make: replace 'want' comments with 'expect' directives The 'want' comments needed to be cross-checked manually, which was error-prone, as can be seen in the "Unknown modifier" messages that got out of sync. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.31 -r1.32 src/usr.bin/make/unit-tests/moderrs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/moderrs.exp diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.35 src/usr.bin/make/unit-tests/moderrs.exp:1.36 --- src/usr.bin/make/unit-tests/moderrs.exp:1.35 Sat Apr 20 10:18:55 2024 +++ src/usr.bin/make/unit-tests/moderrs.exp Sun Jun 30 14:23:18 2024 @@ -1,33 +1,26 @@ mod-unknown-direct: -want: Unknown modifier 'Z' make: in target "mod-unknown-direct": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before--after mod-unknown-indirect: -want: Unknown modifier 'Z' make: in target "mod-unknown-indirect": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before-inner}-after unclosed-direct: -want: Unclosed expression, expecting '}' for modifier "S,V,v," of variable "VAR" with value "Thevariable" make: Unclosed expression, expecting '}' for modifier "S,V,v," of variable "VAR" with value "Thevariable" VAR:S,V,v,=Thevariable unclosed-indirect: -want: Unclosed expression after indirect modifier, expecting '}' for variable "VAR" make: Unclosed expression after indirect modifier, expecting '}' for variable "VAR" VAR:S,V,v,=Thevariable unfinished-indirect: -want: Unfinished modifier for VAR (',' missing) make: Unfinished modifier for "VAR" (',' missing) VAR:S,V,v= unfinished-loop: -want: Unfinished modifier for UNDEF ('@' missing) make: Unfinished modifier for "UNDEF" ('@' missing) -want: Unfinished modifier for UNDEF ('@' missing) make: Unfinished modifier for "UNDEF" ('@' missing) 1 2 3 @@ -38,10 +31,8 @@ make: Unclosed expression, expecting '}' 1}... 2}... 3}... words: -want: Unfinished modifier for UNDEF (']' missing) make: Unfinished modifier for "UNDEF" (']' missing) -want: Unfinished modifier for UNDEF (']' missing) make: Unfinished modifier for "UNDEF" (']' missing) 13= @@ -49,10 +40,8 @@ make: Bad modifier ":[123451234512345123 12345=S,^ok,:S,^3ok,} exclam: -want: Unfinished modifier for VARNAME ('!' missing) make: Unfinished modifier for "VARNAME" ('!' missing) -want: Unfinished modifier for ! ('!' missing) make: Unfinished modifier for "!" ('!' missing) Index: src/usr.bin/make/unit-tests/moderrs.mk diff -u src/usr.bin/make/unit-tests/moderrs.mk:1.31 src/usr.bin/make/unit-tests/moderrs.mk:1.32 --- src/usr.bin/make/unit-tests/moderrs.mk:1.31 Sun Nov 19 22:32:44 2023 +++ src/usr.bin/make/unit-tests/moderrs.mk Sun Jun 30 14:23:18 2024 @@ -1,8 +1,7 @@ -# $NetBSD: moderrs.mk,v 1.31 2023/11/19 22:32:44 rillig Exp $ +# $NetBSD: moderrs.mk,v 1.32 2024/06/30 14:23:18 rillig Exp $ # # various modifier error tests -'= '\'' VAR= TheVariable # in case we have to change it ;-) MOD_UNKN= Z @@ -26,29 +25,29 @@ all: mod-remember-parse all: mod-sysv-parse mod-unknown-direct: print-header print-footer - @echo 'want: Unknown modifier $'Z$'' +# expect: make: in target "mod-unknown-direct": while evaluating variable "VAR": Unknown modifier "Z" @echo 'VAR:Z=before-${VAR:Z}-after' mod-unknown-indirect: print-header print-footer - @echo 'want: Unknown modifier $'Z$'' +# expect: make: in target "mod-unknown-indirect": while evaluating variable "VAR": Unknown modifier "Z" @echo 'VAR:${MOD_UNKN}=before-${VAR:${MOD_UNKN}:inner}-after' unclosed-direct: print-header print-footer - @echo 'want: Unclosed expression, expecting $'}$' for modifier "S,V,v," of variable "VAR" with value "Thevariable"' +# expect: make: Unclosed expression, expecting '}' for modifier "S,V,v," of variable "VAR" with value "Thevariable" @echo VAR:S,V,v,=${VAR:S,V,v, unclosed-indirect: print-header print-footer - @echo 'want: Unclosed expression after indirect modifier, expecting $'}$' for variable "VAR"' +# expect: make: Unclosed expression after indirect modifier, expecting '}' for variable "VAR" @echo VAR:${MOD_TERM},=${VAR:${MOD_S} unfinished-indirect: print-header print-footer - @echo 'want: Unfinished modifier for VAR ($',$' missing)' +# expect: make: Unfinished modifier for "VAR" (',' missing) -@echo "VAR:${MOD_TERM}=${VAR:${MOD_TERM}}" unfinished-loop: print-header print-footer - @echo 'want: Unfinished modifier for UNDEF ($'@$' missing)' +# expect: make: Unfinished modifier for "UNDEF" ('@' missing) @echo ${UNDEF:U1 2 3:@var} - @echo 'want: Unfinished modifier for UNDEF ($'@$' missing)' +# expect: make: Unfinished modifier
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Jun 30 14:23:18 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk Log Message: tests/make: replace 'want' comments with 'expect' directives The 'want' comments needed to be cross-checked manually, which was error-prone, as can be seen in the "Unknown modifier" messages that got out of sync. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.31 -r1.32 src/usr.bin/make/unit-tests/moderrs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 13:01:01 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cond-late.exp cond-late.mk varmod-ifelse.exp varmod-ifelse.mk Log Message: make: error out on syntax error in conditions in ':?then:else' modifier The 'Error' function only reports errors but does not affect the exit status, the 'Parse_Error' function does, while providing more details to find the cause of the syntax error. To generate a diff of this commit: cvs rdiff -u -r1.1123 -r1.1124 src/usr.bin/make/var.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-late.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-late.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/unit-tests/varmod-ifelse.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1123 src/usr.bin/make/var.c:1.1124 --- src/usr.bin/make/var.c:1.1123 Sun Jun 30 11:44:14 2024 +++ src/usr.bin/make/var.c Sun Jun 30 13:01:01 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1123 2024/06/30 11:44:14 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1124 2024/06/30 13:01:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1123 2024/06/30 11:44:14 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1124 2024/06/30 13:01:01 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -262,6 +262,9 @@ typedef struct SepBuf { typedef enum { VSK_TARGET, VSK_VARNAME, + VSK_COND, + VSK_COND_THEN, + VSK_COND_ELSE, VSK_EXPR } EvalStackElementKind; @@ -375,11 +378,17 @@ EvalStack_Details(void) buf->len = 0; for (i = 0; i < evalStack.len; i++) { + static const char descr[][42] = { + "in target", + "while evaluating variable", + "while evaluating condition", + "while evaluating then-branch of condition", + "while evaluating else-branch of condition", + "while evaluating", + }; EvalStackElement *elem = evalStack.elems + i; - Buf_AddStr(buf, - elem->kind == VSK_TARGET ? "in target \"" : - elem->kind == VSK_EXPR ? "while evaluating \"" : - "while evaluating variable \""); + Buf_AddStr(buf, descr[elem->kind]); + Buf_AddStr(buf, " \""); Buf_AddStr(buf, elem->str); Buf_AddStr(buf, "\": "); } @@ -3443,6 +3452,7 @@ ApplyModifier_IfElse(const char **pp, Mo CondResult cond_rc = CR_TRUE; /* just not CR_ERROR */ if (Expr_ShouldEval(expr)) { + evalStack.elems[evalStack.len - 1].kind = VSK_COND; cond_rc = Cond_EvalCondition(expr->name); if (cond_rc == CR_TRUE) then_emode = expr->emode; @@ -3450,11 +3460,13 @@ ApplyModifier_IfElse(const char **pp, Mo else_emode = expr->emode; } + evalStack.elems[evalStack.len - 1].kind = VSK_COND_THEN; (*pp)++; /* skip past the '?' */ if (!ParseModifierPart(pp, ':', ':', then_emode, ch, , NULL, NULL)) return AMR_CLEANUP; + evalStack.elems[evalStack.len - 1].kind = VSK_COND_ELSE; if (!ParseModifierPart(pp, ch->endc, ch->endc, else_emode, ch, , NULL, NULL)) { LazyBuf_Done(); @@ -3464,12 +3476,8 @@ ApplyModifier_IfElse(const char **pp, Mo (*pp)--; /* Go back to the ch->endc. */ if (cond_rc == CR_ERROR) { - Substring thenExpr = LazyBuf_Get(); - Substring elseExpr = LazyBuf_Get(); - Error("Bad conditional expression '%s' before '?%.*s:%.*s'", - expr->name, - (int)Substring_Length(thenExpr), thenExpr.start, - (int)Substring_Length(elseExpr), elseExpr.start); + evalStack.elems[evalStack.len - 1].kind = VSK_COND; + Parse_Error(PARSE_FATAL, "Bad condition"); LazyBuf_Done(); LazyBuf_Done(); return AMR_CLEANUP; Index: src/usr.bin/make/unit-tests/cond-late.exp diff -u src/usr.bin/make/unit-tests/cond-late.exp:1.5 src/usr.bin/make/unit-tests/cond-late.exp:1.6 --- src/usr.bin/make/unit-tests/cond-late.exp:1.5 Sun Dec 10 20:12:28 2023 +++ src/usr.bin/make/unit-tests/cond-late.exp Sun Jun 30 13:01:01 2024 @@ -1,4 +1,6 @@ -make: Bad conditional expression ' != "no"' before '?:' +make: "cond-late.mk" line 38: while evaluating variable "VAR": while evaluating condition " != "no"": Bad condition +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests yes no exit status 0 Index: src/usr.bin/make/unit-tests/cond-late.mk diff -u src/usr.bin/make/unit-tests/cond-late.mk:1.6 src/usr.bin/make/unit-tests/cond-late.mk:1.7 --- src/usr.bin/make/unit-tests/cond-late.mk:1.6 Sun Dec 10 20:12:28 2023 +++ src/usr.bin/make/unit-tests/cond-late.mk Sun Jun 30 13:01:01 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cond-late.mk,v 1.6 2023/12/10 20:12:28 rillig Exp $ +# $NetBSD: cond-late.mk,v 1.7 2024/06/30 13:01:01 rillig Exp $ # # Using the :? modifier,
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 13:01:01 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cond-late.exp cond-late.mk varmod-ifelse.exp varmod-ifelse.mk Log Message: make: error out on syntax error in conditions in ':?then:else' modifier The 'Error' function only reports errors but does not affect the exit status, the 'Parse_Error' function does, while providing more details to find the cause of the syntax error. To generate a diff of this commit: cvs rdiff -u -r1.1123 -r1.1124 src/usr.bin/make/var.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-late.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-late.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/unit-tests/varmod-ifelse.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:44:14 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp Log Message: make: sync error handling between '!=' assignment and '::!=' modifier To generate a diff of this commit: cvs rdiff -u -r1.1122 -r1.1123 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-assign.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:44:14 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp Log Message: make: sync error handling between '!=' assignment and '::!=' modifier To generate a diff of this commit: cvs rdiff -u -r1.1122 -r1.1123 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-assign.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1122 src/usr.bin/make/var.c:1.1123 --- src/usr.bin/make/var.c:1.1122 Sun Jun 30 11:00:06 2024 +++ src/usr.bin/make/var.c Sun Jun 30 11:44:14 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1122 2024/06/30 11:00:06 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1123 2024/06/30 11:44:14 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1122 2024/06/30 11:00:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1123 2024/06/30 11:44:14 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3557,7 +3557,7 @@ found_op: char *output, *error; output = Cmd_Exec(val.str, ); if (error != NULL) { - Error("%s", error); + Parse_Error(PARSE_WARNING, "%s", error); free(error); } else Var_Set(scope, expr->name, output); Index: src/usr.bin/make/unit-tests/varmod-assign-shell.exp diff -u src/usr.bin/make/unit-tests/varmod-assign-shell.exp:1.6 src/usr.bin/make/unit-tests/varmod-assign-shell.exp:1.7 --- src/usr.bin/make/unit-tests/varmod-assign-shell.exp:1.6 Sun Jun 30 11:37:21 2024 +++ src/usr.bin/make/unit-tests/varmod-assign-shell.exp Sun Jun 30 11:44:14 2024 @@ -1,10 +1,10 @@ -make: "varmod-assign-shell.mk" line 28: warning: Command "echo output; (exit 13)" exited with status 13 +make: "varmod-assign-shell.mk" line 21: warning: Command "echo output; (exit 13)" exited with status 13 Global: _ = # (empty) Var_Parse: ${ASSIGNED::!=echo output; ${:U(exit 13)}} (eval-keep-dollar-and-undefined) Evaluating modifier ${ASSIGNED::...} on value "previous" (eval-keep-dollar-and-undefined, regular) Modifier part: "echo output; (exit 13)" Capturing the output of command "echo output; (exit 13)" -make: Command "echo output; (exit 13)" exited with status 13 +make: "varmod-assign-shell.mk" line 26: warning: while evaluating variable "ASSIGNED": Command "echo output; (exit 13)" exited with status 13 Result of ${ASSIGNED::!=echo output; ${:U(exit 13)}} is "" (eval-keep-dollar-and-undefined, regular) Global: _ = # (empty) Global: .MAKEFLAGS = -r -k -d v -d Index: src/usr.bin/make/unit-tests/varmod-assign-shell.mk diff -u src/usr.bin/make/unit-tests/varmod-assign-shell.mk:1.6 src/usr.bin/make/unit-tests/varmod-assign-shell.mk:1.7 --- src/usr.bin/make/unit-tests/varmod-assign-shell.mk:1.6 Sun Jun 30 11:37:21 2024 +++ src/usr.bin/make/unit-tests/varmod-assign-shell.mk Sun Jun 30 11:44:14 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-assign-shell.mk,v 1.6 2024/06/30 11:37:21 rillig Exp $ +# $NetBSD: varmod-assign-shell.mk,v 1.7 2024/06/30 11:44:14 rillig Exp $ # # Tests for the variable modifier '::!=', which assigns the output of a shell # command to the variable, but only if the command exited successfully. This @@ -15,20 +15,14 @@ # error message instead of the command that was executed. That's where the # counterintuitive error message 'make: "previous" returned non-zero status' # comes from. -# -# BUGS -# Even though the variable modifier '::!=' produces an error message, -# the exit status of make is still 0. -# -# Having an error message instead of a warning like for the variable -# assignment operator '!=' is another unnecessary inconsistency. DIRECT= previous # expect+1: warning: Command "echo output; (exit 13)" exited with status 13 DIRECT!= echo output; (exit 13) ASSIGNED= previous -.MAKEFLAGS: -dv # to see the actual command +.MAKEFLAGS: -dv # to see the "Capturing" debug output +# expect+1: warning: while evaluating variable "ASSIGNED": Command "echo output; (exit 13)" exited with status 13 _:= ${ASSIGNED::!=echo output; ${:U(exit 13)}} .MAKEFLAGS: -d0 Index: src/usr.bin/make/unit-tests/varmod-assign.exp diff -u src/usr.bin/make/unit-tests/varmod-assign.exp:1.21 src/usr.bin/make/unit-tests/varmod-assign.exp:1.22 --- src/usr.bin/make/unit-tests/varmod-assign.exp:1.21 Sun Jun 30 11:37:21 2024 +++ src/usr.bin/make/unit-tests/varmod-assign.exp Sun Jun 30 11:44:14 2024 @@ -48,7 +48,7 @@ sysv:y make: Unfinished modifier for "ASSIGN" ('}' missing) ok=word -make: Command " echo word; (exit 13) " exited with status
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:37:21 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: var-op-shell.exp var-op-shell.mk varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp varmod-assign.mk varmod-shell.exp varmod-shell.mk varmod-sun-shell.exp varmod-sun-shell.mk Log Message: make: add detailed exit status to message for failed sub-commands Several commands communicate via the exit status and not only distinguish between zero and non-zero, so make this information available to ease investigations. The command "false" is not guaranteed to exit with a consistent status, so use "(exit 13)" instead in the tests, to keep these tests portable across different operating systems. The exit status 127 is required for a shell that cannot find a command, so keep that one. To generate a diff of this commit: cvs rdiff -u -r1.624 -r1.625 src/usr.bin/make/main.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/var-op-shell.exp \ src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-shell.mk \ src/usr.bin/make/unit-tests/varmod-shell.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-assign.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-sun-shell.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-sun-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.624 src/usr.bin/make/main.c:1.625 --- src/usr.bin/make/main.c:1.624 Sun Jun 2 15:31:26 2024 +++ src/usr.bin/make/main.c Sun Jun 30 11:37:21 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.624 2024/06/02 15:31:26 rillig Exp $ */ +/* $NetBSD: main.c,v 1.625 2024/06/30 11:37:21 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.624 2024/06/02 15:31:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.625 2024/06/30 11:37:21 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1784,10 +1784,15 @@ Cmd_Exec(const char *cmd, char **error) if (WIFSIGNALED(status)) *error = str_concat3("\"", cmd, "\" exited on a signal"); - else if (WEXITSTATUS(status) != 0) - *error = str_concat3( - "\"", cmd, "\" returned non-zero status"); - else if (saved_errno != 0) + else if (WEXITSTATUS(status) != 0) { + Buffer errBuf; + Buf_Init(); + Buf_AddStr(, "Command \""); + Buf_AddStr(, cmd); + Buf_AddStr(, "\" exited with status "); + Buf_AddInt(, WEXITSTATUS(status)); + *error = Buf_DoneData(); + } else if (saved_errno != 0) *error = str_concat3( "Couldn't read shell's output for \"", cmd, "\""); else Index: src/usr.bin/make/unit-tests/var-op-shell.exp diff -u src/usr.bin/make/unit-tests/var-op-shell.exp:1.6 src/usr.bin/make/unit-tests/var-op-shell.exp:1.7 --- src/usr.bin/make/unit-tests/var-op-shell.exp:1.6 Thu Jun 1 20:56:35 2023 +++ src/usr.bin/make/unit-tests/var-op-shell.exp Sun Jun 30 11:37:21 2024 @@ -1,8 +1,8 @@ -make: "var-op-shell.mk" line 32: warning: "echo "failed"; false" returned non-zero status -make: "var-op-shell.mk" line 39: warning: "false" returned non-zero status +make: "var-op-shell.mk" line 32: warning: Command "echo "failed"; (exit 13)" exited with status 13 +make: "var-op-shell.mk" line 39: warning: Command "exit 13" exited with status 13 make: "var-op-shell.mk" line 62: warning: "kill $$" exited on a signal /bin/no/such/command: not found -make: "var-op-shell.mk" line 69: warning: "/bin/no/such/command" returned non-zero status +make: "var-op-shell.mk" line 69: warning: Command "/bin/no/such/command" exited with status 127 stderr Capturing the output of command "echo ''" Global: OUTPUT = Index: src/usr.bin/make/unit-tests/varmod-shell.exp diff -u src/usr.bin/make/unit-tests/varmod-shell.exp:1.6 src/usr.bin/make/unit-tests/varmod-shell.exp:1.7 --- src/usr.bin/make/unit-tests/varmod-shell.exp:1.6 Sun Jun 30 11:00:06 2024 +++ src/usr.bin/make/unit-tests/varmod-shell.exp Sun Jun 30 11:37:21 2024 @@ -1,12 +1,12 @@ -make: "varmod-shell.mk" line 25: warning: while evaluating "${:!echo word; false!} != "word"": "echo word; false" returned non-zero status -make: "varmod-shell.mk" line 29: warning: while evaluating "${:Uprevious value:!echo word; false!} != "word"": "echo word; false" returned non-zero status +make: "varmod-shell.mk" line 25: warning: while evaluating "${:!echo word; (exit 13)!} != "word"": Command "echo word; (exit
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:37:21 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: var-op-shell.exp var-op-shell.mk varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp varmod-assign.mk varmod-shell.exp varmod-shell.mk varmod-sun-shell.exp varmod-sun-shell.mk Log Message: make: add detailed exit status to message for failed sub-commands Several commands communicate via the exit status and not only distinguish between zero and non-zero, so make this information available to ease investigations. The command "false" is not guaranteed to exit with a consistent status, so use "(exit 13)" instead in the tests, to keep these tests portable across different operating systems. The exit status 127 is required for a shell that cannot find a command, so keep that one. To generate a diff of this commit: cvs rdiff -u -r1.624 -r1.625 src/usr.bin/make/main.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/var-op-shell.exp \ src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-shell.mk \ src/usr.bin/make/unit-tests/varmod-shell.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-assign.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-sun-shell.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-sun-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:00:06 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-shell.exp varmod-shell.mk varmod-sun-shell.exp varmod-sun-shell.mk Log Message: make: add more context to "returned non-zero status" message Previously, this message was an "error" but had no influence on the exit status, so make it a warning instead. In the seldom used -W mode that treats warnings as errors, this change influences the exit status. To generate a diff of this commit: cvs rdiff -u -r1.1121 -r1.1122 src/usr.bin/make/var.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-shell.mk cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-sun-shell.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-sun-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1121 src/usr.bin/make/var.c:1.1122 --- src/usr.bin/make/var.c:1.1121 Sat Jun 15 22:06:30 2024 +++ src/usr.bin/make/var.c Sun Jun 30 11:00:06 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1121 2024/06/15 22:06:30 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1122 2024/06/30 11:00:06 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1121 2024/06/15 22:06:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1122 2024/06/30 11:00:06 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -2632,8 +2632,7 @@ ApplyModifier_ShellCommand(const char ** output = Cmd_Exec(cmd.str, ); Expr_SetValueOwn(expr, output); if (error != NULL) { - /* XXX: why still return AMR_OK? */ - Error("%s", error); + Parse_Error(PARSE_WARNING, "%s", error); free(error); } } else @@ -3746,7 +3745,7 @@ ApplyModifier_SunShell(const char **pp, char *output, *error; output = Cmd_Exec(Expr_Str(expr), ); if (error != NULL) { - Error("%s", error); + Parse_Error(PARSE_WARNING, "%s", error); free(error); } Expr_SetValueOwn(expr, output); Index: src/usr.bin/make/unit-tests/varmod-shell.exp diff -u src/usr.bin/make/unit-tests/varmod-shell.exp:1.5 src/usr.bin/make/unit-tests/varmod-shell.exp:1.6 --- src/usr.bin/make/unit-tests/varmod-shell.exp:1.5 Sat Mar 26 14:34:07 2022 +++ src/usr.bin/make/unit-tests/varmod-shell.exp Sun Jun 30 11:00:06 2024 @@ -1,11 +1,11 @@ -make: "echo word; false" returned non-zero status -make: "echo word; false" returned non-zero status +make: "varmod-shell.mk" line 25: warning: while evaluating "${:!echo word; false!} != "word"": "echo word; false" returned non-zero status +make: "varmod-shell.mk" line 29: warning: while evaluating "${:Uprevious value:!echo word; false!} != "word"": "echo word; false" returned non-zero status Global: _ = # (empty) Var_Parse: ${:!echo word; ${:Ufalse}!} (eval-keep-dollar-and-undefined) Evaluating modifier ${:!...} on value "" (eval-keep-dollar-and-undefined, undefined) Modifier part: "echo word; false" Capturing the output of command "echo word; false" -make: "echo word; false" returned non-zero status +make: "varmod-shell.mk" line 36: warning: while evaluating "${:!echo word; ${:Ufalse}!}": "echo word; false" returned non-zero status Result of ${:!echo word; ${:Ufalse}!} is "word" (eval-keep-dollar-and-undefined, defined) Global: _ = word Global: .MAKEFLAGS = -r -k -d v -d Index: src/usr.bin/make/unit-tests/varmod-shell.mk diff -u src/usr.bin/make/unit-tests/varmod-shell.mk:1.7 src/usr.bin/make/unit-tests/varmod-shell.mk:1.8 --- src/usr.bin/make/unit-tests/varmod-shell.mk:1.7 Mon Jan 10 20:32:29 2022 +++ src/usr.bin/make/unit-tests/varmod-shell.mk Sun Jun 30 11:00:06 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-shell.mk,v 1.7 2022/01/10 20:32:29 rillig Exp $ +# $NetBSD: varmod-shell.mk,v 1.8 2024/06/30 11:00:06 rillig Exp $ # # Tests for the ':!cmd!' variable modifier, which runs the shell command # given by the variable modifier and returns its output. @@ -21,16 +21,20 @@ # Between 2000-04-29 and 2020-11-17, the error message mentioned the previous # value of the expression (which is usually an empty string) instead of the # command that was executed. +# expect+1: warning: while evaluating "${:!echo word; false!} != "word"": "echo word; false" returned non-zero status .if ${:!echo word; false!} != "word" . error .endif +# expect+1: warning: while evaluating "${:Uprevious value:!echo word; false!} != "word"": "echo word; false" returned non-zero status .if ${:Uprevious value:!echo word; false!} != "word" . error .endif -.MAKEFLAGS: -dv # to see the actual command +.MAKEFLAGS: -dv # to see the "Capturing" debug output +# expect+1: warning: while evaluating
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:00:06 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-shell.exp varmod-shell.mk varmod-sun-shell.exp varmod-sun-shell.mk Log Message: make: add more context to "returned non-zero status" message Previously, this message was an "error" but had no influence on the exit status, so make it a warning instead. In the seldom used -W mode that treats warnings as errors, this change influences the exit status. To generate a diff of this commit: cvs rdiff -u -r1.1121 -r1.1122 src/usr.bin/make/var.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-shell.mk cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-sun-shell.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-sun-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/share/mk
Am 28.06.2024 um 22:45 schrieb Taylor R Campbell: > +# It is tempting to use the make :P modifier here so that you can just > +# write > +# > +#VERSION_MAP=foo.map > +# > +# instead of > +# > +#VERSION_MAP=${.CURDIR}/foo.map > +# > +# but it appears that :P works _only_ with literal names, not with > +# expansions, so while you could write > +# > +#VERSION_MAP=${foo.map:P} > +# > +# in the makefile, we can't set > +# > +#LDFLAGS+= -Wl,--version-script=${${VERSION_MAP}:P} > +# > +# here. The ':P' modifier treats a literal in the same way as an expression, so there's no difference between ${foo.map:P} and ${${:Ufoo.map}:P}, as in both cases the "variable name" is 'foo.map'. If you still remember how you came to that conclusion, I'd be interested in it. In order to make the ':P' modifier work, the "variable name" must be an existing node in the dependency tree, at the point where the ':P' modifier is evaluated. Here's a demonstration: > .MAKEFLAGS: -dv > .PATH: /dev > VERSION_MAP= null > Resolve_via_Path: .PHONY .NOTMAIN ${VERSION_MAP} > LDFLAGS+= -Wl,--version-script=${${VERSION_MAP}:P} > LDFLAGS+= -Wl,--version-script=${null:P} > .info ${LDFLAGS} > .MAKEFLAGS: -dF/dev/null > all: The 'Resolve_via_Path' dependency line adds the VERSION_MAP file to the dependency tree. Instead of 'Resolve_via_Path', you can choose any other name or even leave it empty, making the line start with a "magic colon". Roland
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jun 28 15:20:57 UTC 2024 Modified Files: src/usr.bin/make: job.c job.h Log Message: make: reduce usage of the UNCONST hack To generate a diff of this commit: cvs rdiff -u -r1.477 -r1.478 src/usr.bin/make/job.c cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/job.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jun 28 15:20:57 UTC 2024 Modified Files: src/usr.bin/make: job.c job.h Log Message: make: reduce usage of the UNCONST hack To generate a diff of this commit: cvs rdiff -u -r1.477 -r1.478 src/usr.bin/make/job.c cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/job.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.477 src/usr.bin/make/job.c:1.478 --- src/usr.bin/make/job.c:1.477 Tue Jun 25 05:18:38 2024 +++ src/usr.bin/make/job.c Fri Jun 28 15:20:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.477 2024/06/25 05:18:38 rillig Exp $ */ +/* $NetBSD: job.c,v 1.478 2024/06/28 15:20:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.477 2024/06/25 05:18:38 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.478 2024/06/28 15:20:57 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -399,7 +399,7 @@ static Shell shells[] = { * It is set by the Job_ParseShell function. */ static Shell *shell = [DEFSHELL_INDEX]; -const char *shellPath = NULL; /* full pathname of executable image */ +char *shellPath; /* full pathname of executable image */ const char *shellName = NULL; /* last component of shellPath */ char *shellErrFlag = NULL; static char *shell_freeIt = NULL; /* Allocated memory for custom .SHELL */ @@ -2473,13 +2473,13 @@ Job_ParseShell(char *line) * Shell_Init has already been called! * Do it again. */ -free(UNCONST(shellPath)); +free(shellPath); shellPath = NULL; Shell_Init(); } } } else { - free(UNCONST(shellPath)); + free(shellPath); shellPath = bmake_strdup(path); shellName = newShell.name != NULL ? newShell.name : str_basename(path); Index: src/usr.bin/make/job.h diff -u src/usr.bin/make/job.h:1.78 src/usr.bin/make/job.h:1.79 --- src/usr.bin/make/job.h:1.78 Tue Dec 19 19:33:39 2023 +++ src/usr.bin/make/job.h Fri Jun 28 15:20:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.h,v 1.78 2023/12/19 19:33:39 rillig Exp $ */ +/* $NetBSD: job.h,v 1.79 2024/06/28 15:20:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -179,7 +179,7 @@ typedef struct Job { #endif } Job; -extern const char *shellPath; +extern char *shellPath; extern const char *shellName; extern char *shellErrFlag;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jun 25 05:18:39 UTC 2024 Modified Files: src/usr.bin/make: job.c test-variants.mk Log Message: make: fix invalid-free for custom shell definitions Don't try to free a pointer that is taken from the middle of a string, in this case a shell specification. To generate a diff of this commit: cvs rdiff -u -r1.476 -r1.477 src/usr.bin/make/job.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/test-variants.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.476 src/usr.bin/make/job.c:1.477 --- src/usr.bin/make/job.c:1.476 Sat Jun 15 20:02:45 2024 +++ src/usr.bin/make/job.c Tue Jun 25 05:18:38 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.476 2024/06/15 20:02:45 rillig Exp $ */ +/* $NetBSD: job.c,v 1.477 2024/06/25 05:18:38 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.476 2024/06/15 20:02:45 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.477 2024/06/25 05:18:38 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -2137,7 +2137,7 @@ InitShellNameAndPath(void) #ifdef DEFSHELL_CUSTOM if (shellName[0] == '/') { - shellPath = shellName; + shellPath = bmake_strdup(shellName); shellName = str_basename(shellPath); return; } @@ -2480,7 +2480,7 @@ Job_ParseShell(char *line) } } else { free(UNCONST(shellPath)); - shellPath = path; + shellPath = bmake_strdup(path); shellName = newShell.name != NULL ? newShell.name : str_basename(path); if (!fullSpec) { Index: src/usr.bin/make/test-variants.mk diff -u src/usr.bin/make/test-variants.mk:1.8 src/usr.bin/make/test-variants.mk:1.9 --- src/usr.bin/make/test-variants.mk:1.8 Sat May 25 00:00:25 2024 +++ src/usr.bin/make/test-variants.mk Tue Jun 25 05:18:38 2024 @@ -1,4 +1,4 @@ -# $NetBSD: test-variants.mk,v 1.8 2024/05/25 00:00:25 rillig Exp $ +# $NetBSD: test-variants.mk,v 1.9 2024/06/25 05:18:38 rillig Exp $ # # Build several variants of make and run the tests on them. # @@ -200,8 +200,15 @@ CFLAGS.gcc-warn+= -Wno-error=duplicated- .for shell in /usr/pkg/bin/bash /usr/pkg/bin/dash . if exists(${shell}) -TESTS+= ${shell:T} +TESTS+= ${shell:T} CPPFLAGS.${shell:T}= -DDEFSHELL_CUSTOM="\"${shell}\"" + +.for name in ${shell:T}-sanitize +TESTS+= ${name} +ENV.${name}= MKSANITIZER=yes LIMIT_RESOURCES=: +CPPFLAGS.${name}= -DDEFSHELL_CUSTOM="\"${shell}\"" -DCLEANUP +CFLAGS.${name}= -ggdb -O0 +.endfor . endif .endfor
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jun 25 05:18:39 UTC 2024 Modified Files: src/usr.bin/make: job.c test-variants.mk Log Message: make: fix invalid-free for custom shell definitions Don't try to free a pointer that is taken from the middle of a string, in this case a shell specification. To generate a diff of this commit: cvs rdiff -u -r1.476 -r1.477 src/usr.bin/make/job.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/test-variants.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jun 22 06:24:46 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: msg_380.c msg_381.c Log Message: tests/lint: skip tests for converting large floating point to integer These tests differ between the platforms supported by lint. The differences may be caused by hardware differences, the default rounding mode, bugs in the emulator running the tests, bugs in the platform-specific string-to-float or float-to-string conversions and probably some more. For now, accept that lint will behave differently on those platforms. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_380.c \ src/tests/usr.bin/xlint/lint1/msg_381.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_380.c diff -u src/tests/usr.bin/xlint/lint1/msg_380.c:1.1 src/tests/usr.bin/xlint/lint1/msg_380.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_380.c:1.1 Sun Jun 9 10:27:39 2024 +++ src/tests/usr.bin/xlint/lint1/msg_380.c Sat Jun 22 06:24:46 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_380.c,v 1.1 2024/06/09 10:27:39 rillig Exp $ */ +/* $NetBSD: msg_380.c,v 1.2 2024/06/22 06:24:46 rillig Exp $ */ # 3 "msg_380.c" // Test for message: lossy conversion of %Lg to '%s', arg #%d [380] @@ -50,11 +50,22 @@ conversions(void) take_u64(0.0); /* expect+1: warning: lossy conversion of 3.141 to 'unsigned long long', arg #1 [380] */ take_u64(3.141); - take_u64(18446744073709550591.0); - /* expect+1: warning: lossy conversion of 1.84467e+19 to 'unsigned long long', arg #1 [380] */ - take_u64(18446744073709550592.0); - /* expect+1: warning: lossy conversion of 1.84467e+19 to 'unsigned long long', arg #1 [380] */ - take_u64(18446744073709551615.0); - /* expect+1: warning: lossy conversion of 1.84467e+19 to 'unsigned long long', arg #1 [380] */ - take_u64(18446744073709551616.0); + + // Warning on: alpha + // No warning on: aarch64 aarch64-compat32 arm i386 mips powerpc riscv64 sh3 sparc x86_64 + // Unknown: coldfire hppa ia64 m68000 m68k mips64 mipsn64 or1k powerpc64 riscv32 sparc64 vax + // + // warning: lossy conversion of 1.84467e+19 to 'unsigned long long', arg #1 [380] + //take_u64(18446744073709550591.0); + + // Warning on: aarch64 alpha arm i386 mips riscv64 sparc x86_64 + // No warning on: aarch64-compat32 powerpc sh3 + // Unknown: coldfire hppa ia64 m68000 m68k mips64 mipsn64 or1k powerpc64 riscv32 sparc64 vax + // + // warning: lossy conversion of 1.84467e+19 to 'unsigned long long', arg #1 [380] + //take_u64(18446744073709550592.0); + // warning: lossy conversion of 1.84467e+19 to 'unsigned long long', arg #1 [380] + //take_u64(18446744073709551615.0); + // warning: lossy conversion of 1.84467e+19 to 'unsigned long long', arg #1 [380] + //take_u64(18446744073709551616.0); } Index: src/tests/usr.bin/xlint/lint1/msg_381.c diff -u src/tests/usr.bin/xlint/lint1/msg_381.c:1.1 src/tests/usr.bin/xlint/lint1/msg_381.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_381.c:1.1 Sun Jun 9 10:27:39 2024 +++ src/tests/usr.bin/xlint/lint1/msg_381.c Sat Jun 22 06:24:46 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_381.c,v 1.1 2024/06/09 10:27:39 rillig Exp $ */ +/* $NetBSD: msg_381.c,v 1.2 2024/06/22 06:24:46 rillig Exp $ */ # 3 "msg_381.c" // Test for message: lossy conversion of %Lg to '%s' [381] @@ -50,11 +50,22 @@ conversions(void) u64 = 0.0; /* expect+1: warning: lossy conversion of 3.141 to 'unsigned long long' [381] */ u64 = 3.141; - u64 = 18446744073709550591.0; - /* expect+1: warning: lossy conversion of 1.84467e+19 to 'unsigned long long' [381] */ - u64 = 18446744073709550592.0; - /* expect+1: warning: lossy conversion of 1.84467e+19 to 'unsigned long long' [381] */ - u64 = 18446744073709551615.0; - /* expect+1: warning: lossy conversion of 1.84467e+19 to 'unsigned long long' [381] */ - u64 = 18446744073709551616.0; + + // Warning on: alpha + // No warning on: aarch64 aarch64-compat32 arm i386 mips powerpc riscv64 sh3 sparc x86_64 + // Unknown: coldfire hppa ia64 m68000 m68k mips64 mipsn64 or1k powerpc64 riscv32 sparc64 vax + // + // warning: lossy conversion of 1.84467e+19 to 'unsigned long long' [381] + //u64 = 18446744073709550591.0; + + // Warning on: aarch64 alpha arm i386 mips riscv64 sparc x86_64 + // No warning on: aarch64-compat32 powerpc sh3 + // Unknown: coldfire hppa ia64 m68000 m68k mips64 mipsn64 or1k powerpc64 riscv32 sparc64 vax + // + // warning: lossy conversion of 1.84467e+19 to 'unsigned long long' [381] + //u64 = 18446744073709550592.0; + // warning: lossy conversion of 1.84467e+19 to 'unsigned long long' [381] + //u64 = 18446744073709551615.0; + // warning: lossy conversion of 1.84467e+19 to 'unsigned long long' [381] + //u64 = 18446744073709551616.0; }
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jun 22 06:24:46 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: msg_380.c msg_381.c Log Message: tests/lint: skip tests for converting large floating point to integer These tests differ between the platforms supported by lint. The differences may be caused by hardware differences, the default rounding mode, bugs in the emulator running the tests, bugs in the platform-specific string-to-float or float-to-string conversions and probably some more. For now, accept that lint will behave differently on those platforms. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_380.c \ src/tests/usr.bin/xlint/lint1/msg_381.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: rillig Date: Thu Jun 20 19:00:35 UTC 2024 Modified Files: src/usr.sbin/sysinst: msg.mi.de Log Message: sysinst: fix umlaut in German translation To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/sysinst/msg.mi.de Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/sysinst/msg.mi.de diff -u src/usr.sbin/sysinst/msg.mi.de:1.49 src/usr.sbin/sysinst/msg.mi.de:1.50 --- src/usr.sbin/sysinst/msg.mi.de:1.49 Thu Jun 20 05:46:22 2024 +++ src/usr.sbin/sysinst/msg.mi.de Thu Jun 20 19:00:35 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.de,v 1.49 2024/06/20 05:46:22 nia Exp $ */ +/* $NetBSD: msg.mi.de,v 1.50 2024/06/20 19:00:35 rillig Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -643,7 +643,7 @@ message net_defroute {IPv4-Gateway} message net_media -{Art der Netzwerkverbindung (fuer Automatik leer lassen)} +{Art der Netzwerkverbindung (für Automatik leer lassen)} message net_ssid {WLAN-SSID?}
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: rillig Date: Thu Jun 20 19:00:35 UTC 2024 Modified Files: src/usr.sbin/sysinst: msg.mi.de Log Message: sysinst: fix umlaut in German translation To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/sysinst/msg.mi.de Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: rillig Date: Tue Jun 18 05:13:58 UTC 2024 Modified Files: src/lib/libbluetooth: bluetooth.c Log Message: libbluetooth: constify result of strchr lint warned: > call to 'strchr' effectively discards 'const' from argument [346] No binary change. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/bluetooth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/bluetooth.c diff -u src/lib/libbluetooth/bluetooth.c:1.1 src/lib/libbluetooth/bluetooth.c:1.2 --- src/lib/libbluetooth/bluetooth.c:1.1 Mon Jun 19 15:44:36 2006 +++ src/lib/libbluetooth/bluetooth.c Tue Jun 18 05:13:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: bluetooth.c,v 1.1 2006/06/19 15:44:36 gdamore Exp $ */ +/* $NetBSD: bluetooth.c,v 1.2 2024/06/18 05:13:58 rillig Exp $ */ /* * bluetooth.c @@ -27,12 +27,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bluetooth.c,v 1.1 2006/06/19 15:44:36 gdamore Exp $ + * $Id: bluetooth.c,v 1.2 2024/06/18 05:13:58 rillig Exp $ * $FreeBSD: src/lib/libbluetooth/bluetooth.c,v 1.2 2004/03/05 08:10:17 markm Exp $ */ #include -__RCSID("$NetBSD: bluetooth.c,v 1.1 2006/06/19 15:44:36 gdamore Exp $"); +__RCSID("$NetBSD: bluetooth.c,v 1.2 2024/06/18 05:13:58 rillig Exp $"); #include #include @@ -291,7 +291,7 @@ int bt_aton(char const *str, bdaddr_t *ba) { int i, b; - char *end = NULL; + const char *end; memset(ba, 0, sizeof(*ba));
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: rillig Date: Tue Jun 18 05:13:58 UTC 2024 Modified Files: src/lib/libbluetooth: bluetooth.c Log Message: libbluetooth: constify result of strchr lint warned: > call to 'strchr' effectively discards 'const' from argument [346] No binary change. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/bluetooth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 17 22:11:09 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: c23.c src/usr.bin/xlint/lint1: cgram.y Log Message: lint: don't warn about unused C23 [[maybe_unused]] parameters To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/c23.c cvs rdiff -u -r1.505 -r1.506 src/usr.bin/xlint/lint1/cgram.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/c23.c diff -u src/tests/usr.bin/xlint/lint1/c23.c:1.15 src/tests/usr.bin/xlint/lint1/c23.c:1.16 --- src/tests/usr.bin/xlint/lint1/c23.c:1.15 Mon Jun 17 17:06:48 2024 +++ src/tests/usr.bin/xlint/lint1/c23.c Mon Jun 17 22:11:09 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: c23.c,v 1.15 2024/06/17 17:06:48 rillig Exp $ */ +/* $NetBSD: c23.c,v 1.16 2024/06/17 22:11:09 rillig Exp $ */ # 3 "c23.c" // Tests for the option -Ac23, which allows features from C23 and all earlier @@ -168,13 +168,9 @@ typedef int number; void attributes_in_parameter_declaration( -/* expect+1: warning: parameter 'int_param' unused in function 'attributes_in_parameter_declaration' [231] */ [[maybe_unused]] int int_param, -/* expect+1: warning: parameter 'const_int_param' unused in function 'attributes_in_parameter_declaration' [231] */ [[maybe_unused]] const int const_int_param, -/* expect+1: warning: parameter 'typedef_param' unused in function 'attributes_in_parameter_declaration' [231] */ [[maybe_unused]] number typedef_param, -/* expect+1: warning: parameter 'const_typedef_param' unused in function 'attributes_in_parameter_declaration' [231] */ [[maybe_unused]] const number const_typedef_param) { } Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.505 src/usr.bin/xlint/lint1/cgram.y:1.506 --- src/usr.bin/xlint/lint1/cgram.y:1.505 Mon Jun 17 17:06:47 2024 +++ src/usr.bin/xlint/lint1/cgram.y Mon Jun 17 22:11:09 2024 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.505 2024/06/17 17:06:47 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.506 2024/06/17 22:11:09 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.505 2024/06/17 17:06:47 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.506 2024/06/17 22:11:09 rillig Exp $"); #endif #include @@ -1057,6 +1057,7 @@ begin_type: } | attribute_specifier_sequence { dcs_begin_type(); + dcs->d_used = attributes_contain(&$1, "maybe_unused"); } ;
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 17 22:11:09 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: c23.c src/usr.bin/xlint/lint1: cgram.y Log Message: lint: don't warn about unused C23 [[maybe_unused]] parameters To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/c23.c cvs rdiff -u -r1.505 -r1.506 src/usr.bin/xlint/lint1/cgram.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 17 17:06:48 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: c23.c src/usr.bin/xlint/lint1: cgram.y externs1.h tree.c Log Message: lint: accept C23 [[fallthrough]] statements Needed by bind9/getaddresses.c:137. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/c23.c cvs rdiff -u -r1.504 -r1.505 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.229 -r1.230 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.647 -r1.648 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/c23.c diff -u src/tests/usr.bin/xlint/lint1/c23.c:1.14 src/tests/usr.bin/xlint/lint1/c23.c:1.15 --- src/tests/usr.bin/xlint/lint1/c23.c:1.14 Mon Jun 17 04:14:02 2024 +++ src/tests/usr.bin/xlint/lint1/c23.c Mon Jun 17 17:06:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: c23.c,v 1.14 2024/06/17 04:14:02 rillig Exp $ */ +/* $NetBSD: c23.c,v 1.15 2024/06/17 17:06:48 rillig Exp $ */ # 3 "c23.c" // Tests for the option -Ac23, which allows features from C23 and all earlier @@ -8,7 +8,7 @@ // c11.c // msg_353.c for empty initializer braces -/* lint1-flags: -Ac23 -w -X 351 */ +/* lint1-flags: -Ac23 -hw -X 351 */ int @@ -178,3 +178,22 @@ attributes_in_parameter_declaration( [[maybe_unused]] const number const_typedef_param) { } + +int +attribute_in_switch_statement(int n) +{ + switch (n) { + case 1: + n++; + /* expect+1: warning: fallthrough on case statement [220] */ + case 2: + n++; + [[fallthrough]]; + case 3: + n++; + [[fallthrough]]; + default: + n++; + } + return n; +} Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.504 src/usr.bin/xlint/lint1/cgram.y:1.505 --- src/usr.bin/xlint/lint1/cgram.y:1.504 Mon Jun 17 04:14:02 2024 +++ src/usr.bin/xlint/lint1/cgram.y Mon Jun 17 17:06:47 2024 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.504 2024/06/17 04:14:02 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.505 2024/06/17 17:06:47 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.504 2024/06/17 04:14:02 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.505 2024/06/17 17:06:47 rillig Exp $"); #endif #include @@ -2112,6 +2112,11 @@ expression_statement: expr($2, false, false, false, false); suppress_fallthrough = false; } +| attribute_specifier_sequence T_SEMI { + debug_attribute_list(&$1); + check_statement_reachable(); + suppress_fallthrough = attributes_contain(&$1, "fallthrough"); + } ; /* C99 6.8.4, C23 6.8.5.1 */ Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.229 src/usr.bin/xlint/lint1/externs1.h:1.230 --- src/usr.bin/xlint/lint1/externs1.h:1.229 Sun May 12 18:00:58 2024 +++ src/usr.bin/xlint/lint1/externs1.h Mon Jun 17 17:06:47 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.229 2024/05/12 18:00:58 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.230 2024/06/17 17:06:47 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -306,6 +306,7 @@ buffer *cat_strings(buffer *, buffer *); unsigned int type_size_in_bits(const type_t *); sym_t *find_member(const struct_or_union *, const char *); uint64_t possible_bits(const tnode_t *); +bool attributes_contain(const attribute_list *, const char *); void begin_statement_expr(void); void do_statement_expr(tnode_t *); Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.647 src/usr.bin/xlint/lint1/tree.c:1.648 --- src/usr.bin/xlint/lint1/tree.c:1.647 Sun Jun 9 16:53:06 2024 +++ src/usr.bin/xlint/lint1/tree.c Mon Jun 17 17:06:47 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.647 2024/06/09 16:53:06 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.648 2024/06/17 17:06:47 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.647 2024/06/09 16:53:06 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.648 2024/06/17 17:06:47 rillig Exp $"); #endif #include @@ -323,6 +323,17 @@ possible_bits(const tnode_t *tn) return ~ic_expr(tn).bclr; } +bool +attributes_contain(const attribute_list *attrs, const char *str) +{ + for (size_t i = 0, n = attrs->len; i < n; i++) { + const attribute *attr = attrs->attrs + i; + if (attr->prefix == NULL && strcmp(attr->name, str) == 0) + return true; + } + return false; +} + /* Build 'pointer to tp', 'array of tp' or 'function returning tp'. */ type_t * block_derive_type(type_t *tp, tspec_t t)
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 17 17:06:48 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: c23.c src/usr.bin/xlint/lint1: cgram.y externs1.h tree.c Log Message: lint: accept C23 [[fallthrough]] statements Needed by bind9/getaddresses.c:137. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/c23.c cvs rdiff -u -r1.504 -r1.505 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.229 -r1.230 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.647 -r1.648 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 17 04:14:02 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: c23.c src/usr.bin/xlint/lint1: cgram.y Log Message: lint: accept C23 attributes at the beginning of a type declaration The switch to GCC 12 brings support for C23, and localtime.c uses it to mark [[maybe_unused]] parameters. For now, accept C23 attributes independently from the language level. In the end, the whole tree with the exception of the tools should be switched to C23 mode instead of the current C99 mode. For now, don't actually mark the argument as possibly unused, as lint currently ignores __attribute__((__unused__)) as well. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/c23.c cvs rdiff -u -r1.503 -r1.504 src/usr.bin/xlint/lint1/cgram.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/c23.c diff -u src/tests/usr.bin/xlint/lint1/c23.c:1.13 src/tests/usr.bin/xlint/lint1/c23.c:1.14 --- src/tests/usr.bin/xlint/lint1/c23.c:1.13 Sat May 11 16:12:28 2024 +++ src/tests/usr.bin/xlint/lint1/c23.c Mon Jun 17 04:14:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: c23.c,v 1.13 2024/05/11 16:12:28 rillig Exp $ */ +/* $NetBSD: c23.c,v 1.14 2024/06/17 04:14:02 rillig Exp $ */ # 3 "c23.c" // Tests for the option -Ac23, which allows features from C23 and all earlier @@ -163,3 +163,18 @@ attributes(int i) return i; } + +typedef int number; + +void +attributes_in_parameter_declaration( +/* expect+1: warning: parameter 'int_param' unused in function 'attributes_in_parameter_declaration' [231] */ +[[maybe_unused]] int int_param, +/* expect+1: warning: parameter 'const_int_param' unused in function 'attributes_in_parameter_declaration' [231] */ +[[maybe_unused]] const int const_int_param, +/* expect+1: warning: parameter 'typedef_param' unused in function 'attributes_in_parameter_declaration' [231] */ +[[maybe_unused]] number typedef_param, +/* expect+1: warning: parameter 'const_typedef_param' unused in function 'attributes_in_parameter_declaration' [231] */ +[[maybe_unused]] const number const_typedef_param) +{ +} Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.503 src/usr.bin/xlint/lint1/cgram.y:1.504 --- src/usr.bin/xlint/lint1/cgram.y:1.503 Sun May 12 09:07:41 2024 +++ src/usr.bin/xlint/lint1/cgram.y Mon Jun 17 04:14:02 2024 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.503 2024/05/12 09:07:41 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.504 2024/06/17 04:14:02 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.503 2024/05/12 09:07:41 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.504 2024/06/17 04:14:02 rillig Exp $"); #endif #include @@ -154,7 +154,7 @@ new_attribute(const sbuf_t *prefix, cons %} -%expect 103 +%expect 110 %union { val_t *y_val; @@ -1055,6 +1055,9 @@ begin_type: /* empty */ { dcs_begin_type(); } +| attribute_specifier_sequence { + dcs_begin_type(); + } ; end_type:
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 17 04:14:02 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: c23.c src/usr.bin/xlint/lint1: cgram.y Log Message: lint: accept C23 attributes at the beginning of a type declaration The switch to GCC 12 brings support for C23, and localtime.c uses it to mark [[maybe_unused]] parameters. For now, accept C23 attributes independently from the language level. In the end, the whole tree with the exception of the tools should be switched to C23 mode instead of the current C99 mode. For now, don't actually mark the argument as possibly unused, as lint currently ignores __attribute__((__unused__)) as well. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/c23.c cvs rdiff -u -r1.503 -r1.504 src/usr.bin/xlint/lint1/cgram.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/games
Module Name:src Committed By: rillig Date: Mon Jun 17 03:23:20 UTC 2024 Modified Files: src/tests/games: t_morse.sh Log Message: tests/morse: only run the tests if morse is installed Not sure why the releng/i386 tests don't install the games. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/games/t_morse.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/games/t_morse.sh diff -u src/tests/games/t_morse.sh:1.1 src/tests/games/t_morse.sh:1.2 --- src/tests/games/t_morse.sh:1.1 Sun Jun 16 18:40:58 2024 +++ src/tests/games/t_morse.sh Mon Jun 17 03:23:19 2024 @@ -1,4 +1,4 @@ -# $NetBSD: t_morse.sh,v 1.1 2024/06/16 18:40:58 rillig Exp $ +# $NetBSD: t_morse.sh,v 1.2 2024/06/17 03:23:19 rillig Exp $ # # Copyright (c) 2024 The NetBSD Foundation, Inc. # All rights reserved. @@ -26,6 +26,9 @@ # atf_test_case digits +digits_head() { + atf_set 'require.progs' '/usr/games/morse' +} digits_body() { trailing_space=' ' morse_s_digits="\ @@ -66,6 +69,9 @@ $trailing_space # Before 2024-06-16, non-ASCII characters invoked undefined behavior, # possibly crashing morse. atf_test_case nonascii +nonascii_head() { + atf_set 'require.progs' '/usr/games/morse' +} nonascii_body() { expected="\
CVS commit: src/tests/games
Module Name:src Committed By: rillig Date: Mon Jun 17 03:23:20 UTC 2024 Modified Files: src/tests/games: t_morse.sh Log Message: tests/morse: only run the tests if morse is installed Not sure why the releng/i386 tests don't install the games. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/games/t_morse.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: rillig Date: Sun Jun 16 22:21:57 UTC 2024 Modified Files: src/usr.bin/rpcgen: rpcgen.1 Log Message: rpcgen.1: add missing punctuation To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.bin/rpcgen/rpcgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: rillig Date: Sun Jun 16 22:21:57 UTC 2024 Modified Files: src/usr.bin/rpcgen: rpcgen.1 Log Message: rpcgen.1: add missing punctuation To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.bin/rpcgen/rpcgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpcgen.1 diff -u src/usr.bin/rpcgen/rpcgen.1:1.24 src/usr.bin/rpcgen/rpcgen.1:1.25 --- src/usr.bin/rpcgen/rpcgen.1:1.24 Sun Dec 15 09:18:14 2013 +++ src/usr.bin/rpcgen/rpcgen.1 Sun Jun 16 22:21:57 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: rpcgen.1,v 1.24 2013/12/15 09:18:14 wiz Exp $ +.\" $NetBSD: rpcgen.1,v 1.25 2024/06/16 22:21:57 rillig Exp $ .\" from: @(#)rpcgen.new.1 1.1 90/11/09 TIRPC 1.0; from 40.10 of 10/10/89 .\" Copyright (c) 1988,1990 Sun Microsystems, Inc. - All Rights Reserved. .Dd December 14, 2013 @@ -174,7 +174,7 @@ accepts the standard input. The C preprocessor, .Xr cpp 1 is run on the input file before it is actually interpreted by -.Nm +.Nm . For each type of output file, .Nm defines a special preprocessor symbol for use by the
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Sun Jun 16 19:41:39 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: libutil/snprintb: factor out common subexpression GCC 10 was not able to optimize the code size on its own, so offer a little help. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.48 src/common/lib/libutil/snprintb.c:1.49 --- src/common/lib/libutil/snprintb.c:1.48 Sun Apr 7 15:20:16 2024 +++ src/common/lib/libutil/snprintb.c Sun Jun 16 19:41:39 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.48 2024/04/07 15:20:16 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.49 2024/06/16 19:41:39 rillig Exp $ */ /*- * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ # include # if defined(LIBC_SCCS) -__RCSID("$NetBSD: snprintb.c,v 1.48 2024/04/07 15:20:16 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.49 2024/06/16 19:41:39 rillig Exp $"); # endif # include @@ -46,7 +46,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.48 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.48 2024/04/07 15:20:16 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.49 2024/06/16 19:41:39 rillig Exp $"); # include # include # include @@ -252,17 +252,21 @@ finish_buffer(state *s) if (s->line_max > 0) { store_eol(s); store(s, '\0'); - if (s->bufsize >= 3 && s->total_len > s->bufsize) + if (s->total_len <= s->bufsize) + return; + if (s->bufsize >= 3) s->buf[s->bufsize - 3] = '#'; - if (s->bufsize >= 2 && s->total_len > s->bufsize) + if (s->bufsize >= 2) s->buf[s->bufsize - 2] = '\0'; - if (s->bufsize >= 1 && s->total_len > s->bufsize) + if (s->bufsize >= 1) s->buf[s->bufsize - 1] = '\0'; } else { store(s, '\0'); - if (s->bufsize >= 2 && s->total_len > s->bufsize) + if (s->total_len <= s->bufsize) + return; + if (s->bufsize >= 2) s->buf[s->bufsize - 2] = '#'; - if (s->bufsize >= 1 && s->total_len > s->bufsize) + if (s->bufsize >= 1) s->buf[s->bufsize - 1] = '\0'; } }
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Sun Jun 16 19:41:39 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: libutil/snprintb: factor out common subexpression GCC 10 was not able to optimize the code size on its own, so offer a little help. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jun 16 18:40:59 UTC 2024 Modified Files: src/distrib/sets/lists/tests: mi src/tests/games: Makefile Added Files: src/tests/games: t_morse.sh Log Message: tests/morse: add basic tests To generate a diff of this commit: cvs rdiff -u -r1.1323 -r1.1324 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.2 -r1.3 src/tests/games/Makefile cvs rdiff -u -r0 -r1.1 src/tests/games/t_morse.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jun 16 18:40:59 UTC 2024 Modified Files: src/distrib/sets/lists/tests: mi src/tests/games: Makefile Added Files: src/tests/games: t_morse.sh Log Message: tests/morse: add basic tests To generate a diff of this commit: cvs rdiff -u -r1.1323 -r1.1324 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.2 -r1.3 src/tests/games/Makefile cvs rdiff -u -r0 -r1.1 src/tests/games/t_morse.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1323 src/distrib/sets/lists/tests/mi:1.1324 --- src/distrib/sets/lists/tests/mi:1.1323 Sat Jun 15 13:26:31 2024 +++ src/distrib/sets/lists/tests/mi Sun Jun 16 18:40:58 2024 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1323 2024/06/15 13:26:31 wiz Exp $ +# $NetBSD: mi,v 1.1324 2024/06/16 18:40:58 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -1721,6 +1721,7 @@ ./usr/tests/games/Atffiletests-games-tests compattestfile,atf ./usr/tests/games/Kyuafiletests-games-tests kyua ./usr/tests/games/t_factortests-games-tests compattestfile,atf +./usr/tests/games/t_morsetests-games-tests compattestfile,atf ./usr/tests/include tests-include-tests compattestfile,atf ./usr/tests/include/Atffiletests-include-tests compattestfile,atf ./usr/tests/include/Kyuafiletests-include-tests compattestfile,atf,kyua Index: src/tests/games/Makefile diff -u src/tests/games/Makefile:1.2 src/tests/games/Makefile:1.3 --- src/tests/games/Makefile:1.2 Wed Nov 21 15:39:34 2007 +++ src/tests/games/Makefile Sun Jun 16 18:40:58 2024 @@ -1,9 +1,10 @@ -# $NetBSD: Makefile,v 1.2 2007/11/21 15:39:34 jmmv Exp $ +# $NetBSD: Makefile,v 1.3 2024/06/16 18:40:58 rillig Exp $ .include TESTSDIR= ${TESTSBASE}/games TESTS_SH= t_factor +TESTS_SH+= t_morse .include Added files: Index: src/tests/games/t_morse.sh diff -u /dev/null src/tests/games/t_morse.sh:1.1 --- /dev/null Sun Jun 16 18:40:59 2024 +++ src/tests/games/t_morse.sh Sun Jun 16 18:40:58 2024 @@ -0,0 +1,83 @@ +# $NetBSD: t_morse.sh,v 1.1 2024/06/16 18:40:58 rillig Exp $ +# +# Copyright (c) 2024 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +#notice, this list of conditions and the following disclaimer in the +#documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +atf_test_case digits +digits_body() { + trailing_space=' ' + morse_s_digits="\ + - + . + ..--- + ...-- + - + . + - + --... + ---.. + . +$trailing_space + ...-.- +" + atf_check -o "inline:$morse_s_digits" \ + /usr/games/morse -s 0123456789 + + morse_digits="\ + daw daw daw daw daw + dit daw daw daw daw + dit dit daw daw daw + dit dit dit daw daw + dit dit dit dit daw + dit dit dit dit dit + daw dit dit dit dit + daw daw dit dit dit + daw daw daw dit dit + daw daw daw daw dit + + dit dit dit daw dit daw +" + atf_check -o "inline:$morse_digits" \ + /usr/games/morse 0123456789 +} + +# Before 2024-06-16, non-ASCII characters invoked undefined behavior, +# possibly crashing morse. +atf_test_case nonascii +nonascii_body() +{ + expected="\ + + dit dit dit daw dit daw +" + atf_check -o "inline:$expected" \ + /usr/games/morse äöü +} + +atf_init_test_cases() +{ + atf_add_test_case digits + atf_add_test_case nonascii +}
CVS commit: src/games/morse
Module Name:src Committed By: rillig Date: Sun Jun 16 18:09:45 UTC 2024 Modified Files: src/games/morse: morse.c Log Message: games/morse: fix out-of-bounds memory read Could be triggered by running 'morse äöü', caused by the typical usage mistake. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/games/morse/morse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/morse/morse.c diff -u src/games/morse/morse.c:1.21 src/games/morse/morse.c:1.22 --- src/games/morse/morse.c:1.21 Sun Jun 16 18:00:59 2024 +++ src/games/morse/morse.c Sun Jun 16 18:09:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: morse.c,v 1.21 2024/06/16 18:00:59 rillig Exp $ */ +/* $NetBSD: morse.c,v 1.22 2024/06/16 18:09:45 rillig Exp $ */ /* * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: morse.c,v 1.21 2024/06/16 18:00:59 rillig Exp $"); +__RCSID("$NetBSD: morse.c,v 1.22 2024/06/16 18:09:45 rillig Exp $"); #endif #endif /* not lint */ @@ -188,7 +188,7 @@ main(int argc, char **argv) if (*argv) do { for (p = *argv; *p; ++p) - morse((int)*p); + morse((unsigned char)*p); show(""); } while (*++argv); else while ((ch = getchar()) != EOF)
CVS commit: src/games/morse
Module Name:src Committed By: rillig Date: Sun Jun 16 18:09:45 UTC 2024 Modified Files: src/games/morse: morse.c Log Message: games/morse: fix out-of-bounds memory read Could be triggered by running 'morse äöü', caused by the typical usage mistake. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/games/morse/morse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/morse
Module Name:src Committed By: rillig Date: Sun Jun 16 18:00:59 UTC 2024 Modified Files: src/games/morse: morse.c Log Message: games/morse: reduce runtime relocations, to save disk space To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/games/morse/morse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/morse/morse.c diff -u src/games/morse/morse.c:1.20 src/games/morse/morse.c:1.21 --- src/games/morse/morse.c:1.20 Thu Jun 1 04:08:36 2023 +++ src/games/morse/morse.c Sun Jun 16 18:00:59 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: morse.c,v 1.20 2023/06/01 04:08:36 mrg Exp $ */ +/* $NetBSD: morse.c,v 1.21 2024/06/16 18:00:59 rillig Exp $ */ /* * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: morse.c,v 1.20 2023/06/01 04:08:36 mrg Exp $"); +__RCSID("$NetBSD: morse.c,v 1.21 2024/06/16 18:00:59 rillig Exp $"); #endif #endif /* not lint */ @@ -49,8 +49,7 @@ __RCSID("$NetBSD: morse.c,v 1.20 2023/06 #include #include -static const char - *const digit[] = { +static const char digit[][6] = { "-", ".", "..---", @@ -61,8 +60,9 @@ static const char "--...", "---..", ".", -}, - *const alph[] = { +}; + +static const char alph[][5] = { ".-", "-...", "-.-.", @@ -93,7 +93,7 @@ static const char static const struct punc { char c; - const char *morse; + const char morse[7]; } other[] = { { '.', ".-.-.-" }, { ',', "--..--" }, @@ -109,10 +109,9 @@ static const struct punc { { '+', ".-.-." }, { '_', "..--.-" }, { '@', ".--.-." }, - { '\0', NULL } + { '\0', "" } }; -int main(int, char *[]); static void morse(int); static void decode(const char *); static void show(const char *);
CVS commit: src/games/morse
Module Name:src Committed By: rillig Date: Sun Jun 16 18:00:59 UTC 2024 Modified Files: src/games/morse: morse.c Log Message: games/morse: reduce runtime relocations, to save disk space To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/games/morse/morse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/crypto/aes/arch/x86
Module Name:src Committed By: rillig Date: Sun Jun 16 16:30:53 UTC 2024 Modified Files: src/sys/crypto/aes/arch/x86: aes_via.c Log Message: sys/aes_via: fix broken link in comment To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/crypto/aes/arch/x86/aes_via.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/crypto/aes/arch/x86
Module Name:src Committed By: rillig Date: Sun Jun 16 16:30:53 UTC 2024 Modified Files: src/sys/crypto/aes/arch/x86: aes_via.c Log Message: sys/aes_via: fix broken link in comment To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/crypto/aes/arch/x86/aes_via.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/crypto/aes/arch/x86/aes_via.c diff -u src/sys/crypto/aes/arch/x86/aes_via.c:1.8 src/sys/crypto/aes/arch/x86/aes_via.c:1.9 --- src/sys/crypto/aes/arch/x86/aes_via.c:1.8 Sun Jun 16 16:11:17 2024 +++ src/sys/crypto/aes/arch/x86/aes_via.c Sun Jun 16 16:30:52 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: aes_via.c,v 1.8 2024/06/16 16:11:17 christos Exp $ */ +/* $NetBSD: aes_via.c,v 1.9 2024/06/16 16:30:52 rillig Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.8 2024/06/16 16:11:17 christos Exp $"); +__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.9 2024/06/16 16:30:52 rillig Exp $"); #ifdef _KERNEL #include @@ -857,7 +857,7 @@ aesvia_probe(void) #else /* * From the VIA PadLock Programming Guide: - * http://linux.via.com.tw/support/beginDownload.action?eleid=181=261 + * https://web.archive.org/web/20220104214041/http://linux.via.com.tw/support/beginDownload.action?eleid=181=261 */ unsigned eax, ebx, ecx, edx; if (!__get_cpuid(0, , , , ))
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jun 15 22:06:31 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varname-dot-newline.exp varname-dot-newline.mk Log Message: make: error out if an internal read-only variable is overwritten The affected variables are: * .newline * .MAKE.OS * .MAKE.JOBS.C * .MAKE.LEVEL.ENV * .MAKE.PID * .MAKE.PPID * .MAKE.UID * .MAKE.GID This change does not affect the .SHELL and .SUFFIXES variables, as well as variables that are manually turned read-only by the special .READONLY target. To generate a diff of this commit: cvs rdiff -u -r1.1120 -r1.1121 src/usr.bin/make/var.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varname-dot-newline.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varname-dot-newline.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jun 15 22:06:31 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varname-dot-newline.exp varname-dot-newline.mk Log Message: make: error out if an internal read-only variable is overwritten The affected variables are: * .newline * .MAKE.OS * .MAKE.JOBS.C * .MAKE.LEVEL.ENV * .MAKE.PID * .MAKE.PPID * .MAKE.UID * .MAKE.GID This change does not affect the .SHELL and .SUFFIXES variables, as well as variables that are manually turned read-only by the special .READONLY target. To generate a diff of this commit: cvs rdiff -u -r1.1120 -r1.1121 src/usr.bin/make/var.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varname-dot-newline.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varname-dot-newline.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1120 src/usr.bin/make/var.c:1.1121 --- src/usr.bin/make/var.c:1.1120 Sat Jun 15 20:02:45 2024 +++ src/usr.bin/make/var.c Sat Jun 15 22:06:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1120 2024/06/15 20:02:45 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1121 2024/06/15 22:06:30 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1120 2024/06/15 20:02:45 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1121 2024/06/15 22:06:30 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -192,6 +192,12 @@ typedef struct Var { bool readOnly:1; /* + * The variable is read-only and immune to the .NOREADONLY special + * target. Any attempt to modify it results in an error. + */ + bool readOnlyLoud:1; + + /* * The variable is currently being accessed by Var_Parse or Var_Subst. * This temporary marker is used to avoid endless recursion. */ @@ -393,6 +399,7 @@ VarNew(FStr name, const char *value, var->shortLived = shortLived; var->fromEnvironment = fromEnvironment; var->readOnly = readOnly; + var->readOnlyLoud = false; var->inUse = false; var->exported = false; var->reexport = false; @@ -552,6 +559,12 @@ Var_Delete(GNode *scope, const char *var } v = he->value; + if (v->readOnlyLoud) { + Parse_Error(PARSE_FATAL, + "Cannot delete \"%s\" as it is read-only", + v->name.str); + return; + } if (v->readOnly) { DEBUG2(VAR, "%s: ignoring delete '%s' as it is read-only\n", scope->name, varname); @@ -1025,6 +1038,12 @@ Var_SetWithFlags(GNode *scope, const cha } v = VarAdd(name, val, scope, flags); } else { + if (v->readOnlyLoud) { + Parse_Error(PARSE_FATAL, + "Cannot overwrite \"%s\" as it is read-only", + name); + return; + } if (v->readOnly && !(flags & VAR_SET_READONLY)) { DEBUG3(VAR, "%s: ignoring '%s = %s' as it is read-only\n", @@ -1117,7 +1136,8 @@ Global_Delete(const char *name) void Global_Set_ReadOnly(const char *name, const char *value) { - Var_SetWithFlags(SCOPE_GLOBAL, name, value, VAR_SET_READONLY); + Var_SetWithFlags(SCOPE_GLOBAL, name, value, VAR_SET_NONE); + VarFind(name, SCOPE_GLOBAL, false)->readOnlyLoud = true; } /* @@ -1135,6 +1155,10 @@ Var_Append(GNode *scope, const char *nam if (v == NULL) { Var_SetWithFlags(scope, name, val, VAR_SET_NONE); + } else if (v->readOnlyLoud) { + Parse_Error(PARSE_FATAL, + "Cannot append to \"%s\" as it is read-only", name); + return; } else if (v->readOnly) { DEBUG3(VAR, "%s: ignoring '%s += %s' as it is read-only\n", scope->name, name, val); Index: src/usr.bin/make/unit-tests/varname-dot-newline.exp diff -u src/usr.bin/make/unit-tests/varname-dot-newline.exp:1.4 src/usr.bin/make/unit-tests/varname-dot-newline.exp:1.5 --- src/usr.bin/make/unit-tests/varname-dot-newline.exp:1.4 Thu Jan 26 20:48:18 2023 +++ src/usr.bin/make/unit-tests/varname-dot-newline.exp Sat Jun 15 22:06:31 2024 @@ -1,3 +1,8 @@ +make: "varname-dot-newline.mk" line 28: Cannot overwrite ".newline" as it is read-only +make: "varname-dot-newline.mk" line 30: Cannot append to ".newline" as it is read-only +make: "varname-dot-newline.mk" line 32: Cannot delete ".newline" as it is read-only +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests first second backslash newline: <\ Index: src/usr.bin/make/unit-tests/varname-dot-newline.mk diff -u src/usr.bin/make/unit-tests/varname-dot-newline.mk:1.6 src/usr.bin/make/unit-tests/varname-dot-newline.mk:1.7 --- src/usr.bin/make/unit-tests/varname-dot-newline.mk:1.6 Thu Jan 26 20:48:18 2023 +++ src/usr.bin/make/unit-tests/varname-dot-newline.mk Sat Jun 15 22:06:31 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varname-dot-newline.mk,v 1.6 2023/01/26 20:48:18 sjg Exp $ +# $NetBSD: varname-dot-newline.mk,v 1.7 2024/06/15 22:06:31 rillig Exp $ #
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jun 15 20:02:45 UTC 2024 Modified Files: src/usr.bin/make: compat.c job.c make.h var.c Log Message: make: clean up collection of context information for error messages To generate a diff of this commit: cvs rdiff -u -r1.258 -r1.259 src/usr.bin/make/compat.c cvs rdiff -u -r1.475 -r1.476 src/usr.bin/make/job.c cvs rdiff -u -r1.338 -r1.339 src/usr.bin/make/make.h cvs rdiff -u -r1.1119 -r1.1120 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.258 src/usr.bin/make/compat.c:1.259 --- src/usr.bin/make/compat.c:1.258 Sun Jun 2 15:31:25 2024 +++ src/usr.bin/make/compat.c Sat Jun 15 20:02:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.258 2024/06/02 15:31:25 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.259 2024/06/15 20:02:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.258 2024/06/02 15:31:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.259 2024/06/15 20:02:45 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -251,9 +251,7 @@ Compat_RunCommand(const char *cmdp, GNod errCheck = !(gn->type & OP_IGNORE); doIt = false; - EvalStack_Push(gn->name, NULL, NULL); - cmdStart = Var_Subst(cmd, gn, VARE_EVAL); - EvalStack_Pop(); + cmdStart = Var_SubstInTarget(cmd, gn); /* TODO: handle errors */ if (cmdStart[0] == '\0') { Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.475 src/usr.bin/make/job.c:1.476 --- src/usr.bin/make/job.c:1.475 Sun Jun 2 15:31:25 2024 +++ src/usr.bin/make/job.c Sat Jun 15 20:02:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.475 2024/06/02 15:31:25 rillig Exp $ */ +/* $NetBSD: job.c,v 1.476 2024/06/15 20:02:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.475 2024/06/02 15:31:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.476 2024/06/15 20:02:45 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -901,9 +901,7 @@ JobWriteCommand(Job *job, ShellWriter *w run = GNode_ShouldExecute(job->node); - EvalStack_Push(job->node->name, NULL, NULL); - xcmd = Var_Subst(ucmd, job->node, VARE_EVAL); - EvalStack_Pop(); + xcmd = Var_SubstInTarget(ucmd, job->node); /* TODO: handle errors */ xcmdStart = xcmd; @@ -1030,9 +1028,7 @@ JobSaveCommands(Job *job) * variables such as .TARGET, .IMPSRC. It is not intended to * expand the other variables as well; see deptgt-end.mk. */ - EvalStack_Push(job->node->name, NULL, NULL); - expanded_cmd = Var_Subst(cmd, job->node, VARE_EVAL); - EvalStack_Pop(); + expanded_cmd = Var_SubstInTarget(cmd, job->node); /* TODO: handle errors */ Lst_Append(_GetEndNode()->commands, expanded_cmd); Parse_RegisterCommand(expanded_cmd); Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.338 src/usr.bin/make/make.h:1.339 --- src/usr.bin/make/make.h:1.338 Sun Jun 2 15:31:26 2024 +++ src/usr.bin/make/make.h Sat Jun 15 20:02:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.338 2024/06/02 15:31:26 rillig Exp $ */ +/* $NetBSD: make.h,v 1.339 2024/06/15 20:02:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -1018,6 +1018,7 @@ FStr Var_Value(GNode *, const char *) MA const char *GNode_ValueDirect(GNode *, const char *) MAKE_ATTR_USE; FStr Var_Parse(const char **, GNode *, VarEvalMode); char *Var_Subst(const char *, GNode *, VarEvalMode); +char *Var_SubstInTarget(const char *, GNode *); void Var_Expand(FStr *, GNode *, VarEvalMode); void Var_Stats(void); void Var_Dump(GNode *); @@ -1032,8 +1033,6 @@ void Global_Append(const char *, const c void Global_Delete(const char *); void Global_Set_ReadOnly(const char *, const char *); -void EvalStack_Push(const char *, const char *, const char *); -void EvalStack_Pop(void); const char *EvalStack_Details(void); /* util.c */ Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1119 src/usr.bin/make/var.c:1.1120 --- src/usr.bin/make/var.c:1.1119 Sun Jun 2 15:31:26 2024 +++ src/usr.bin/make/var.c Sat Jun 15 20:02:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1119 2024/06/02 15:31:26 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1120 2024/06/15 20:02:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1119 2024/06/02 15:31:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1120 2024/06/15 20:02:45 rillig Exp $"); /* * Variables are defined using
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jun 15 20:02:45 UTC 2024 Modified Files: src/usr.bin/make: compat.c job.c make.h var.c Log Message: make: clean up collection of context information for error messages To generate a diff of this commit: cvs rdiff -u -r1.258 -r1.259 src/usr.bin/make/compat.c cvs rdiff -u -r1.475 -r1.476 src/usr.bin/make/job.c cvs rdiff -u -r1.338 -r1.339 src/usr.bin/make/make.h cvs rdiff -u -r1.1119 -r1.1120 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jun 15 19:43:56 UTC 2024 Modified Files: src/usr.bin/make: parse.c src/usr.bin/make/unit-tests: varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp varmod-match.mk Log Message: make: in warnings, move the word "warning" to the front To generate a diff of this commit: cvs rdiff -u -r1.730 -r1.731 src/usr.bin/make/parse.c cvs rdiff -u -r1.19 -r1.20 \ src/usr.bin/make/unit-tests/varmod-match-escape.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-match-escape.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmod-match.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-match.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.730 src/usr.bin/make/parse.c:1.731 --- src/usr.bin/make/parse.c:1.730 Sun Jun 2 15:31:26 2024 +++ src/usr.bin/make/parse.c Sat Jun 15 19:43:56 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.730 2024/06/02 15:31:26 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.731 2024/06/15 19:43:56 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -105,7 +105,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.730 2024/06/02 15:31:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.731 2024/06/15 19:43:56 rillig Exp $"); /* Detects a multiple-inclusion guard in a makefile. */ typedef enum { @@ -521,9 +521,9 @@ ParseVErrorInternal(FILE *f, bool useVar (void)fprintf(f, "%s: ", progname); PrintLocation(f, useVars, gn); - fprintf(f, "%s", EvalStack_Details()); if (level == PARSE_WARNING) (void)fprintf(f, "warning: "); + fprintf(f, "%s", EvalStack_Details()); (void)vfprintf(f, fmt, ap); (void)fprintf(f, "\n"); (void)fflush(f); Index: src/usr.bin/make/unit-tests/varmod-match-escape.exp diff -u src/usr.bin/make/unit-tests/varmod-match-escape.exp:1.19 src/usr.bin/make/unit-tests/varmod-match-escape.exp:1.20 --- src/usr.bin/make/unit-tests/varmod-match-escape.exp:1.19 Sat Apr 20 10:18:55 2024 +++ src/usr.bin/make/unit-tests/varmod-match-escape.exp Sat Jun 15 19:43:56 2024 @@ -34,8 +34,8 @@ make: "varmod-match-escape.mk" line 43: Global: .MAKEFLAGS = -r -k -d cv -d Global: .MAKEFLAGS = -r -k -d cv -d 0 make: "varmod-match-escape.mk" line 69: while evaluating "${:U\$:M\$} != """: Dollar followed by nothing -make: "varmod-match-escape.mk" line 110: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[A-]' of modifier ':M' -make: "varmod-match-escape.mk" line 110: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[^A-]' of modifier ':M' +make: "varmod-match-escape.mk" line 110: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[A-]' of modifier ':M' +make: "varmod-match-escape.mk" line 110: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[^A-]' of modifier ':M' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-match-escape.mk diff -u src/usr.bin/make/unit-tests/varmod-match-escape.mk:1.13 src/usr.bin/make/unit-tests/varmod-match-escape.mk:1.14 --- src/usr.bin/make/unit-tests/varmod-match-escape.mk:1.13 Sat Apr 20 10:18:55 2024 +++ src/usr.bin/make/unit-tests/varmod-match-escape.mk Sat Jun 15 19:43:56 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-match-escape.mk,v 1.13 2024/04/20 10:18:55 rillig Exp $ +# $NetBSD: varmod-match-escape.mk,v 1.14 2024/06/15 19:43:56 rillig Exp $ # # As of 2020-08-01, the :M and :N modifiers interpret backslashes differently, # depending on whether there was an expression somewhere before the @@ -105,8 +105,8 @@ EXP.[^A-]]= a EXP.[^A-]]]= a] .for pattern in [A-] [A-]] [A-]]] [^A-] [^A-]] [^A-]]] -# expect+2: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[A-]' of modifier ':M' -# expect+1: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[^A-]' of modifier ':M' +# expect+2: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[A-]' of modifier ':M' +# expect+1: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[^A-]' of modifier ':M' . if ${WORDS:M${pattern}} != ${EXP.${pattern}} .warning ${pattern}: ${WORDS:M${pattern}} != ${EXP.${pattern}} . endif Index: src/usr.bin/make/unit-tests/varmod-match.exp diff -u src/usr.bin/make/unit-tests/varmod-match.exp:1.17 src/usr.bin/make/unit-tests/varmod-match.exp:1.18 --- src/usr.bin/make/unit-tests/varmod-match.exp:1.17 Wed Jun 5 22:06:53 2024 +++ src/usr.bin/make/unit-tests/varmod-match.exp Sat Jun 15 19:43:56 2024 @@ -1,12 +1,12 @@ -make: "varmod-match.mk" line 289: while evaluating variable "WORDS":
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jun 15 19:43:56 UTC 2024 Modified Files: src/usr.bin/make: parse.c src/usr.bin/make/unit-tests: varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp varmod-match.mk Log Message: make: in warnings, move the word "warning" to the front To generate a diff of this commit: cvs rdiff -u -r1.730 -r1.731 src/usr.bin/make/parse.c cvs rdiff -u -r1.19 -r1.20 \ src/usr.bin/make/unit-tests/varmod-match-escape.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-match-escape.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmod-match.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-match.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/lib/libc/stdlib
Module Name:src Committed By: rillig Date: Sat Jun 15 12:20:22 UTC 2024 Modified Files: src/tests/lib/libc/stdlib: t_strtod.c Log Message: tests/strtold: test a few simple examples To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/tests/lib/libc/stdlib/t_strtod.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/stdlib/t_strtod.c diff -u src/tests/lib/libc/stdlib/t_strtod.c:1.36 src/tests/lib/libc/stdlib/t_strtod.c:1.37 --- src/tests/lib/libc/stdlib/t_strtod.c:1.36 Mon May 6 18:39:36 2024 +++ src/tests/lib/libc/stdlib/t_strtod.c Sat Jun 15 12:20:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: t_strtod.c,v 1.36 2024/05/06 18:39:36 riastradh Exp $ */ +/* $NetBSD: t_strtod.c,v 1.37 2024/06/15 12:20:22 rillig Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -32,9 +32,11 @@ /* Public domain, Otto Moerbeek , 2006. */ #include -__RCSID("$NetBSD: t_strtod.c,v 1.36 2024/05/06 18:39:36 riastradh Exp $"); +__RCSID("$NetBSD: t_strtod.c,v 1.37 2024/06/15 12:20:22 rillig Exp $"); #include +#include +#include #include #include #include @@ -42,8 +44,6 @@ __RCSID("$NetBSD: t_strtod.c,v 1.36 2024 #include -#include - static const char * const inf_strings[] = { "Inf", "INF", "-Inf", "-INF", "Infinity", "+Infinity", "INFINITY", "-INFINITY", "InFiNiTy", "+InFiNiTy" }; @@ -73,6 +73,38 @@ ATF_TC_BODY(strtod_basic, tc) } } +ATF_TC(strtold_basic); +ATF_TC_HEAD(strtold_basic, tc) +{ + atf_tc_set_md_var(tc, "descr", "Some examples of strtold(3)"); +} + +ATF_TC_BODY(strtold_basic, tc) +{ + static const struct { + const char *str; + long double val; + } testcases[] = { + { "0x0p0", 0.0L }, + { "0x1.234p0", 0x1234 / 4096.0L }, + { "0x1.234p0", 0x1234 / 4096.0L }, +#if FLT_RADIX == 2 && LDBL_MAX_EXP == 16384 && LDBL_MANT_DIG == 64 + { "2.16", 0x8.a3d70a3d70a3d71p-2L }, +#endif + }; + + for (size_t i = 0, n = __arraycount(testcases); i < n; i++) { + char *end; + errno = 0; + long double val = strtold(testcases[i].str, ); + + ATF_CHECK_MSG( + errno == 0 && *end == '\0' && val == testcases[i].val, + "'%s' want %La have %La errno %d end '%s'", + testcases[i].str, testcases[i].val, val, errno, end); + } +} + ATF_TC(strtod_hex); ATF_TC_HEAD(strtod_hex, tc) { @@ -306,6 +338,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, strtod_basic); + ATF_TP_ADD_TC(tp, strtold_basic); ATF_TP_ADD_TC(tp, strtod_hex); ATF_TP_ADD_TC(tp, strtod_inf); ATF_TP_ADD_TC(tp, strtof_inf);
CVS commit: src/tests/lib/libc/stdlib
Module Name:src Committed By: rillig Date: Sat Jun 15 12:20:22 UTC 2024 Modified Files: src/tests/lib/libc/stdlib: t_strtod.c Log Message: tests/strtold: test a few simple examples To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/tests/lib/libc/stdlib/t_strtod.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: rillig Date: Sat Jun 15 11:44:09 UTC 2024 Modified Files: src/sys/arch/m68k/include: float.h src/sys/arch/x86/include: float.h Log Message: {m68k,x86}/float.h: fix cross references To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/include/float.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/include/float.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/m68k/include/float.h diff -u src/sys/arch/m68k/include/float.h:1.22 src/sys/arch/m68k/include/float.h:1.23 --- src/sys/arch/m68k/include/float.h:1.22 Sun Dec 31 04:20:40 2023 +++ src/sys/arch/m68k/include/float.h Sat Jun 15 11:44:09 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: float.h,v 1.22 2023/12/31 04:20:40 dholland Exp $ */ +/* $NetBSD: float.h,v 1.23 2024/06/15 11:44:09 rillig Exp $ */ #ifndef _M68K_FLOAT_H_ #define _M68K_FLOAT_H_ @@ -23,7 +23,7 @@ * in particular and pp. 3-2 to 3-5 in general. * * If anyone needs to update this comment please make sure the copy in - * m68k/float.h also gets updated. + * x86/include/float.h also gets updated. */ #if defined(__LDBL_MANT_DIG__) Index: src/sys/arch/x86/include/float.h diff -u src/sys/arch/x86/include/float.h:1.7 src/sys/arch/x86/include/float.h:1.8 --- src/sys/arch/x86/include/float.h:1.7 Sun Dec 31 04:20:40 2023 +++ src/sys/arch/x86/include/float.h Sat Jun 15 11:44:09 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: float.h,v 1.7 2023/12/31 04:20:40 dholland Exp $ */ +/* $NetBSD: float.h,v 1.8 2024/06/15 11:44:09 rillig Exp $ */ #ifndef _X86_FLOAT_H_ #define _X86_FLOAT_H_ @@ -25,7 +25,7 @@ * in particular and pp. 3-2 to 3-5 in general. * * If anyone needs to update this comment please make sure the copy in - * x86/float.h also gets updated. + * m68k/include/float.h also gets updated. */ #define LDBL_MANT_DIG 64
CVS commit: src/sys/arch
Module Name:src Committed By: rillig Date: Sat Jun 15 11:44:09 UTC 2024 Modified Files: src/sys/arch/m68k/include: float.h src/sys/arch/x86/include: float.h Log Message: {m68k,x86}/float.h: fix cross references To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/include/float.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/include/float.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/systat
Module Name:src Committed By: rillig Date: Fri Jun 14 17:15:45 UTC 2024 Modified Files: src/usr.bin/systat: main.c Log Message: systat: don't compare integer to floating point constants No binary change. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/usr.bin/systat/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.56 src/usr.bin/systat/main.c:1.57 --- src/usr.bin/systat/main.c:1.56 Sat Aug 21 13:22:19 2021 +++ src/usr.bin/systat/main.c Fri Jun 14 17:15:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.56 2021/08/21 13:22:19 christos Exp $ */ +/* $NetBSD: main.c,v 1.57 2024/06/14 17:15:45 rillig Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.56 2021/08/21 13:22:19 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.57 2024/06/14 17:15:45 rillig Exp $"); #endif /* not lint */ #include @@ -237,7 +237,7 @@ main(int argc, char **argv) curmode->c_flags |= CF_INIT; labels(); - dellave = 0.0; + dellave = 0; display(0); if (!bflag) { @@ -291,13 +291,13 @@ display(int signo) if (curmode->c_flags & CF_LOADAV) { j = 5.0*avenrun[0] + 0.5; dellave -= avenrun[0]; - if (dellave >= 0.0) + if (dellave >= 0) c = '<'; else { c = '>'; dellave = -dellave; } - if (dellave < 0.1) + if (dellave < 1) c = '|'; dellave = avenrun[0]; wmove(wload, 0, 0);
CVS commit: src/usr.bin/systat
Module Name:src Committed By: rillig Date: Fri Jun 14 17:15:45 UTC 2024 Modified Files: src/usr.bin/systat: main.c Log Message: systat: don't compare integer to floating point constants No binary change. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/usr.bin/systat/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/fs/cd9660
Module Name:src Committed By: rillig Date: Tue Jun 11 17:12:36 UTC 2024 Modified Files: src/tests/fs/cd9660: t_high_ino_big_file.sh Log Message: tests/cd9660: use absolute path for mounting filesystem On amd64-compat32, the test failed with: > rump_cd9660: "./pr_48787.image" is a relative path. > rump_cd9660: using "/tmp/atf-run.dfxJMh/pr_48787.image" instead. > assertion "PU_GETSFLAG(pu, PU_PUFFSDAEMON)" failed: > file "/work/src/lib/libpuffs/puffs.c", line 718, function "puffs_cancel" > rump_cd9660: puffs_daemon: Invalid argument To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/fs/cd9660/t_high_ino_big_file.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/cd9660/t_high_ino_big_file.sh diff -u src/tests/fs/cd9660/t_high_ino_big_file.sh:1.6 src/tests/fs/cd9660/t_high_ino_big_file.sh:1.7 --- src/tests/fs/cd9660/t_high_ino_big_file.sh:1.6 Sun Apr 28 14:39:22 2024 +++ src/tests/fs/cd9660/t_high_ino_big_file.sh Tue Jun 11 17:12:36 2024 @@ -1,4 +1,4 @@ -# $NetBSD: t_high_ino_big_file.sh,v 1.6 2024/04/28 14:39:22 rillig Exp $ +# $NetBSD: t_high_ino_big_file.sh,v 1.7 2024/06/11 17:12:36 rillig Exp $ # # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -71,7 +71,7 @@ atf_test_case pr_kern_48787 cleanup pr_kern_48787_head() { atf_set "descr" "Verifies 32bit overflow issues from PR kern/48787 are fixed" atf_set "require.user" "root" - atf_set "require.progs" "rump_cd9660 bunzip2 stat" + atf_set "require.progs" "rump_cd9660 stat" atf_set "timeout" 6000 } @@ -81,10 +81,10 @@ pr_kern_48787_body() { atf_skip "not enough free disk space, have ${avail} Kbytes, need ~ 450 Kbytes" fi $(atf_get_srcdir)/h_hexdump_r < $(atf_get_srcdir)/pr_48787.image.hex > pr_48787.image || atf_fail "h_hexdump_r failed" - mntpnt=$(pwd)/mnt + mntpnt=$PWD/mnt mkdir ${mntpnt} - rump_cd9660 -o norrip ./pr_48787.image ${mntpnt} + rump_cd9660 -o norrip "$PWD"/pr_48787.image ${mntpnt} if [ ! -r ${mntpnt}/small_file ]; then atf_fail "${mntpnt}/small_file does not exist" fi @@ -93,7 +93,7 @@ pr_kern_48787_body() { fi umount ${mntpnt} - rump_cd9660 ./pr_48787.image ${mntpnt} + rump_cd9660 "$PWD/pr_48787.image" ${mntpnt} if [ ! -r ${mntpnt}/small_file ]; then atf_fail "${mntpnt}/small_file does not exist" fi
CVS commit: src/tests/fs/cd9660
Module Name:src Committed By: rillig Date: Tue Jun 11 17:12:36 UTC 2024 Modified Files: src/tests/fs/cd9660: t_high_ino_big_file.sh Log Message: tests/cd9660: use absolute path for mounting filesystem On amd64-compat32, the test failed with: > rump_cd9660: "./pr_48787.image" is a relative path. > rump_cd9660: using "/tmp/atf-run.dfxJMh/pr_48787.image" instead. > assertion "PU_GETSFLAG(pu, PU_PUFFSDAEMON)" failed: > file "/work/src/lib/libpuffs/puffs.c", line 718, function "puffs_cancel" > rump_cd9660: puffs_daemon: Invalid argument To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/fs/cd9660/t_high_ino_big_file.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jun 9 16:53:07 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: emit.exp-ln src/usr.bin/xlint/lint1: tree.c Log Message: lint: fix usage marker for nested function calls To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/emit.exp-ln cvs rdiff -u -r1.646 -r1.647 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/emit.exp-ln diff -u src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.14 src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.15 --- src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.14 Sun Jun 9 16:49:40 2024 +++ src/tests/usr.bin/xlint/lint1/emit.exp-ln Sun Jun 9 16:53:07 2024 @@ -87,6 +87,5 @@ S emit.c 319 d 0.319 e 14used_and_using F1 I I 320 d 0.320 e 9only_used F0 I 325 c 0.325 u 14used_and_using f1 I I -# FIXME: only_used's result is actually used, the 'i' for 'ignored' is wrong. -325 c 0.325 i 9only_used f0 I +325 c 0.325 u 9only_used f0 I 323 d 0.323 dr 10only_using F0 I Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.646 src/usr.bin/xlint/lint1/tree.c:1.647 --- src/usr.bin/xlint/lint1/tree.c:1.646 Sun Jun 9 10:27:39 2024 +++ src/usr.bin/xlint/lint1/tree.c Sun Jun 9 16:53:06 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.646 2024/06/09 10:27:39 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.647 2024/06/09 16:53:06 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.646 2024/06/09 10:27:39 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.647 2024/06/09 16:53:06 rillig Exp $"); #endif #include @@ -4649,7 +4649,7 @@ check_expr_misc(const tnode_t *tn, bool discard, szof); for (size_t i = 0, n = call->args_len; i < n; i++) check_expr_misc(call->args[i], - false, false, false, false, false, szof); + true, false, false, false, false, szof); return; }
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jun 9 16:53:07 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: emit.exp-ln src/usr.bin/xlint/lint1: tree.c Log Message: lint: fix usage marker for nested function calls To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/emit.exp-ln cvs rdiff -u -r1.646 -r1.647 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jun 9 16:49:41 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: emit.c emit.exp-ln Log Message: tests/lint: demonstrate wrong result for nested function calls To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/xlint/lint1/emit.c cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/emit.exp-ln Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/emit.c diff -u src/tests/usr.bin/xlint/lint1/emit.c:1.17 src/tests/usr.bin/xlint/lint1/emit.c:1.18 --- src/tests/usr.bin/xlint/lint1/emit.c:1.17 Mon May 22 17:53:27 2023 +++ src/tests/usr.bin/xlint/lint1/emit.c Sun Jun 9 16:49:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: emit.c,v 1.17 2023/05/22 17:53:27 rillig Exp $ */ +/* $NetBSD: emit.c,v 1.18 2024/06/09 16:49:40 rillig Exp $ */ # 3 "emit.c" /* @@ -315,3 +315,12 @@ struct compound_expression_in_initialize * initializer. */ const char array_of_unknown_size[] = "unknown"; + +int used_and_using(int); +int only_used(void); + +int +only_using(void) +{ + return used_and_using(only_used()); +} Index: src/tests/usr.bin/xlint/lint1/emit.exp-ln diff -u src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.13 src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.14 --- src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.13 Mon May 22 20:11:24 2023 +++ src/tests/usr.bin/xlint/lint1/emit.exp-ln Sun Jun 9 16:49:40 2024 @@ -83,3 +83,10 @@ S emit.c 286 d 0.286 d 8use_vars F0 V 305 d 0.305 d 8compound sT1 34compound_expression_in_initializer 317 d 0.317 d 21array_of_unknown_size A8cC + +319 d 0.319 e 14used_and_using F1 I I +320 d 0.320 e 9only_used F0 I +325 c 0.325 u 14used_and_using f1 I I +# FIXME: only_used's result is actually used, the 'i' for 'ignored' is wrong. +325 c 0.325 i 9only_used f0 I +323 d 0.323 dr 10only_using F0 I
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jun 9 16:49:41 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: emit.c emit.exp-ln Log Message: tests/lint: demonstrate wrong result for nested function calls To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/xlint/lint1/emit.c cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/emit.exp-ln Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcurses
Module Name:src Committed By: rillig Date: Sun Jun 9 13:02:24 UTC 2024 Modified Files: src/lib/libcurses: ctrace.c Log Message: libcurses: fix lint warning about function without header prototype To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libcurses/ctrace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcurses/ctrace.c diff -u src/lib/libcurses/ctrace.c:1.23 src/lib/libcurses/ctrace.c:1.24 --- src/lib/libcurses/ctrace.c:1.23 Mon Oct 29 00:31:57 2018 +++ src/lib/libcurses/ctrace.c Sun Jun 9 13:02:24 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ctrace.c,v 1.23 2018/10/29 00:31:57 uwe Exp $ */ +/* $NetBSD: ctrace.c,v 1.24 2024/06/09 13:02:24 rillig Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -30,13 +30,11 @@ */ #include -#ifndef lint #if 0 static char sccsid[] = "@(#)ctrace.c 8.2 (Berkeley) 10/5/93"; #else -__RCSID("$NetBSD: ctrace.c,v 1.23 2018/10/29 00:31:57 uwe Exp $"); +__RCSID("$NetBSD: ctrace.c,v 1.24 2024/06/09 13:02:24 rillig Exp $"); #endif -#endif/* not lint */ #ifdef DEBUG #include @@ -106,13 +104,6 @@ __CTRACE(int area, const char *fmt,...) (void)fflush(tracefp); } #else -/* this kills the empty translation unit message from lint... */ -void -__cursesi_make_lint_shut_up_if_debug_not_defined(void); - -void -__cursesi_make_lint_shut_up_if_debug_not_defined(void) -{ - return; -} +/* Prevent an 'empty translation unit' message from lint. */ +typedef int dummy; #endif
CVS commit: src/lib/libcurses
Module Name:src Committed By: rillig Date: Sun Jun 9 13:02:24 UTC 2024 Modified Files: src/lib/libcurses: ctrace.c Log Message: libcurses: fix lint warning about function without header prototype To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libcurses/ctrace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jun 9 10:27:39 UTC 2024 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: init_c99.c msg_259.c msg_298.c t_usage.sh src/usr.bin/xlint/lint1: err.c tree.c Added Files: src/tests/usr.bin/xlint/lint1: msg_380.c msg_381.c Log Message: lint: warn about lossy floating point constant to integer conversions To generate a diff of this commit: cvs rdiff -u -r1.1318 -r1.1319 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/init_c99.c cvs rdiff -u -r1.24 -r1.25 src/tests/usr.bin/xlint/lint1/msg_259.c cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_298.c cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_380.c \ src/tests/usr.bin/xlint/lint1/msg_381.c cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/xlint/lint1/t_usage.sh cvs rdiff -u -r1.245 -r1.246 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.645 -r1.646 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.