mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-01 17:00:36 +00:00
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.
This commit is contained in:
parent
a2a775011c
commit
48c49ace00
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145627
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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 @@ MainParseArgs(int argc, char **argv)
|
||||
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);
|
||||
}
|
||||
|
@ -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 *);
|
||||
|
Loading…
Reference in New Issue
Block a user