Wed Nov 4 13:27:00 2020 UTC ()
make(1): remove mistyped extern variable

Robust programs don't have extern variable declarations in .c files, as
that risks incomatible definitions that are not detected by the compiler
and invoke undefined behavior.  Make make a little more robust.


(rillig)
diff -r1.136 -r1.137 src/usr.bin/make/meta.c

cvs diff -r1.136 -r1.137 src/usr.bin/make/meta.c (expand / switch to unified diff)

--- src/usr.bin/make/meta.c 2020/10/31 12:04:24 1.136
+++ src/usr.bin/make/meta.c 2020/11/04 13:27:00 1.137
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: meta.c,v 1.136 2020/10/31 12:04:24 rillig Exp $ */ 1/* $NetBSD: meta.c,v 1.137 2020/11/04 13:27:00 rillig Exp $ */
2 2
3/* 3/*
4 * Implement 'meta' mode. 4 * Implement 'meta' mode.
5 * Adapted from John Birrell's patches to FreeBSD make. 5 * Adapted from John Birrell's patches to FreeBSD make.
6 * --sjg 6 * --sjg
7 */ 7 */
8/* 8/*
9 * Copyright (c) 2009-2016, Juniper Networks, Inc. 9 * Copyright (c) 2009-2016, Juniper Networks, Inc.
10 * Portions Copyright (c) 2009, John Birrell. 10 * Portions Copyright (c) 2009, John Birrell.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -70,27 +70,26 @@ Boolean useMeta = FALSE; @@ -70,27 +70,26 @@ Boolean useMeta = FALSE;
70static Boolean useFilemon = FALSE; 70static Boolean useFilemon = FALSE;
71static Boolean writeMeta = FALSE; 71static Boolean writeMeta = FALSE;
72static Boolean metaMissing = FALSE; /* oodate if missing */ 72static Boolean metaMissing = FALSE; /* oodate if missing */
73static Boolean filemonMissing = FALSE; /* oodate if missing */ 73static Boolean filemonMissing = FALSE; /* oodate if missing */
74static Boolean metaEnv = FALSE; /* don't save env unless asked */ 74static Boolean metaEnv = FALSE; /* don't save env unless asked */
75static Boolean metaVerbose = FALSE; 75static Boolean metaVerbose = FALSE;
76static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */ 76static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */
77static Boolean metaIgnorePatterns = FALSE; /* do we need to do pattern matches */ 77static Boolean metaIgnorePatterns = FALSE; /* do we need to do pattern matches */
78static Boolean metaIgnoreFilter = FALSE; /* do we have more complex filtering? */ 78static Boolean metaIgnoreFilter = FALSE; /* do we have more complex filtering? */
79static Boolean metaCurdirOk = FALSE; /* write .meta in .CURDIR Ok? */ 79static Boolean metaCurdirOk = FALSE; /* write .meta in .CURDIR Ok? */
80static Boolean metaSilent = FALSE; /* if we have a .meta be SILENT */ 80static Boolean metaSilent = FALSE; /* if we have a .meta be SILENT */
81 81
82extern Boolean forceJobs; 82extern Boolean forceJobs;
83extern Boolean comatMake; 
84extern char **environ; 83extern char **environ;
85 84
86#define MAKE_META_PREFIX ".MAKE.META.PREFIX" 85#define MAKE_META_PREFIX ".MAKE.META.PREFIX"
87 86
88#ifndef N2U 87#ifndef N2U
89# define N2U(n, u) (((n) + ((u) - 1)) / (u)) 88# define N2U(n, u) (((n) + ((u) - 1)) / (u))
90#endif 89#endif
91#ifndef ROUNDUP 90#ifndef ROUNDUP
92# define ROUNDUP(n, u) (N2U((n), (u)) * (u)) 91# define ROUNDUP(n, u) (N2U((n), (u)) * (u))
93#endif 92#endif
94 93
95#if !defined(HAVE_STRSEP) 94#if !defined(HAVE_STRSEP)
96# define strsep(s, d) stresep((s), (d), 0) 95# define strsep(s, d) stresep((s), (d), 0)