summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-04-28 15:37:25 +0000
committerharti <harti@FreeBSD.org>2005-04-28 15:37:25 +0000
commit5063114341528789e7028bb9807e2d1d364d9de9 (patch)
tree8f067ab4376d2e46aee60b3591c3912a0093058e
parentc2ee427f58870a57f71f4e20d3f83c4e6bdde733 (diff)
downloadFreeBSD-src-5063114341528789e7028bb9807e2d1d364d9de9.zip
FreeBSD-src-5063114341528789e7028bb9807e2d1d364d9de9.tar.gz
Introduce a flag to enable extended warnings (-x) and make them off
by default. This should fix the problem of getting lots of errors when building with an up-to-date make and old *.mk files.
-rw-r--r--usr.bin/make/cond.c11
-rw-r--r--usr.bin/make/globals.h4
-rw-r--r--usr.bin/make/main.c17
-rw-r--r--usr.bin/make/make.h7
4 files changed, 31 insertions, 8 deletions
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index 1269eec..792fe75 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -1123,8 +1123,9 @@ Cond_Else(char *line __unused, int code __unused, int lineno __unused)
while (isspace((u_char)*line))
line++;
- if (*line != '\0') {
- Parse_Error(PARSE_WARNING, "junk after .else ignored '%s'", line);
+ if (*line != '\0' && (warnflags & WARN_DIRSYNTAX)) {
+ Parse_Error(PARSE_WARNING, "junk after .else ignored '%s'",
+ line);
}
if (condTop == MAXIF) {
@@ -1163,9 +1164,11 @@ Cond_Endif(char *line __unused, int code __unused, int lineno __unused)
while (isspace((u_char)*line))
line++;
- if (*line != '\0') {
- Parse_Error(PARSE_WARNING, "junk after .endif ignored '%s'", line);
+ if (*line != '\0' && (warnflags & WARN_DIRSYNTAX)) {
+ Parse_Error(PARSE_WARNING, "junk after .endif ignored '%s'",
+ line);
}
+
/*
* End of a conditional section. If skipIfLevel is non-zero,
* that conditional was skipped, so lines following it should
diff --git a/usr.bin/make/globals.h b/usr.bin/make/globals.h
index 8b87ba3..9528272 100644
--- a/usr.bin/make/globals.h
+++ b/usr.bin/make/globals.h
@@ -46,6 +46,7 @@
*/
#include <time.h>
+#include <stdint.h>
#include "lst.h"
#include "sprite.h"
@@ -119,4 +120,7 @@ extern Boolean oldVars; /* Do old-style variable substitution */
extern int debug;
+/* warning flags */
+extern uint32_t warnflags;
+
#endif /* globals_h_1c1edb96 */
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index e031760..1588f3c 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -107,6 +107,7 @@ Lst create = Lst_Initializer(create);
time_t now; /* Time at start of make */
struct GNode *DEFAULT; /* .DEFAULT node */
Boolean allPrecious; /* .PRECIOUS given on line by itself */
+uint32_t warnflags;
static Boolean noBuiltins; /* -r flag */
@@ -188,7 +189,7 @@ MainParseArgs(int argc, char **argv)
rearg:
optind = 1; /* since we're called more than once */
optreset = 1;
-#define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nqrstv"
+#define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nqrstvx:"
while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
switch(c) {
@@ -345,6 +346,13 @@ rearg:
beVerbose = TRUE;
MFLAGS_append("-v", NULL);
break;
+ case 'x':
+ if (strncmp(optarg, "dirsyntax", strlen(optarg)) == 0) {
+ MFLAGS_append("-x", optarg);
+ warnflags |= WARN_DIRSYNTAX;
+ }
+ break;
+
default:
case '?':
usage();
@@ -1166,9 +1174,10 @@ Cmd_Exec(char *cmd, const char **error)
static void
usage(void)
{
- fprintf(stderr, "%s\n%s\n%s\n",
-"usage: make [-BPSXeiknqrstv] [-C directory] [-D variable] [-d flags]",
+ fprintf(stderr, "%s\n%s\n%s\n%s\n",
+"usage: make [-ABPSXeiknqrstv] [-C directory] [-D variable] [-d flags]",
" [-E variable] [-f makefile] [-I directory] [-j max_jobs]",
-" [-m directory] [-V variable] [variable=value] [target ...]");
+" [-m directory] [-V variable] [variable=value] [-x warn_flag]",
+" [target ...]");
exit(2);
}
diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h
index 9395e09..513b63d 100644
--- a/usr.bin/make/make.h
+++ b/usr.bin/make/make.h
@@ -134,6 +134,13 @@ struct Lst;
#define FPREFIX "*F" /* file part of PREFIX */
#define DPREFIX "*D" /* directory part of PREFIX */
+/*
+ * Warning flags
+ */
+enum {
+ WARN_DIRSYNTAX = 0x0001, /* syntax errors in directives */
+};
+
int Make_TimeStamp(struct GNode *, struct GNode *);
Boolean Make_OODate(struct GNode *);
int Make_HandleUse(struct GNode *, struct GNode *);
OpenPOWER on IntegriCloud