| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: parse.c,v 1.532 2021/01/26 23:44:56 rillig Exp $ */ | | 1 | /* $NetBSD: parse.c,v 1.533 2021/01/27 00:02:38 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | | 4 | * Copyright (c) 1988, 1989, 1990, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Adam de Boor. | | 8 | * Adam de Boor. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -99,27 +99,27 @@ | | | @@ -99,27 +99,27 @@ |
99 | | | 99 | |
100 | #include <sys/types.h> | | 100 | #include <sys/types.h> |
101 | #include <sys/stat.h> | | 101 | #include <sys/stat.h> |
102 | #include <errno.h> | | 102 | #include <errno.h> |
103 | #include <stdarg.h> | | 103 | #include <stdarg.h> |
104 | #include <stdint.h> | | 104 | #include <stdint.h> |
105 | | | 105 | |
106 | #include "make.h" | | 106 | #include "make.h" |
107 | #include "dir.h" | | 107 | #include "dir.h" |
108 | #include "job.h" | | 108 | #include "job.h" |
109 | #include "pathnames.h" | | 109 | #include "pathnames.h" |
110 | | | 110 | |
111 | /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ | | 111 | /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ |
112 | MAKE_RCSID("$NetBSD: parse.c,v 1.532 2021/01/26 23:44:56 rillig Exp $"); | | 112 | MAKE_RCSID("$NetBSD: parse.c,v 1.533 2021/01/27 00:02:38 rillig Exp $"); |
113 | | | 113 | |
114 | /* types and constants */ | | 114 | /* types and constants */ |
115 | | | 115 | |
116 | /* | | 116 | /* |
117 | * Structure for a file being read ("included file") | | 117 | * Structure for a file being read ("included file") |
118 | */ | | 118 | */ |
119 | typedef struct IFile { | | 119 | typedef struct IFile { |
120 | char *fname; /* name of file (relative? absolute?) */ | | 120 | char *fname; /* name of file (relative? absolute?) */ |
121 | Boolean fromForLoop; /* simulated .include by the .for loop */ | | 121 | Boolean fromForLoop; /* simulated .include by the .for loop */ |
122 | int lineno; /* current line number in file */ | | 122 | int lineno; /* current line number in file */ |
123 | int first_lineno; /* line number of start of text */ | | 123 | int first_lineno; /* line number of start of text */ |
124 | unsigned int cond_depth; /* 'if' nesting when file opened */ | | 124 | unsigned int cond_depth; /* 'if' nesting when file opened */ |
125 | Boolean depending; /* state of doing_depend on EOF */ | | 125 | Boolean depending; /* state of doing_depend on EOF */ |
| @@ -601,33 +601,30 @@ ParseVErrorInternal(FILE *f, const char | | | @@ -601,33 +601,30 @@ ParseVErrorInternal(FILE *f, const char |
601 | | | 601 | |
602 | (void)fprintf(f, "%s: ", progname); | | 602 | (void)fprintf(f, "%s: ", progname); |
603 | | | 603 | |
604 | if (fname != NULL) | | 604 | if (fname != NULL) |
605 | PrintLocation(f, fname, lineno); | | 605 | PrintLocation(f, fname, lineno); |
606 | if (type == PARSE_WARNING) | | 606 | if (type == PARSE_WARNING) |
607 | (void)fprintf(f, "warning: "); | | 607 | (void)fprintf(f, "warning: "); |
608 | (void)vfprintf(f, fmt, ap); | | 608 | (void)vfprintf(f, fmt, ap); |
609 | (void)fprintf(f, "\n"); | | 609 | (void)fprintf(f, "\n"); |
610 | (void)fflush(f); | | 610 | (void)fflush(f); |
611 | | | 611 | |
612 | if (type == PARSE_INFO) | | 612 | if (type == PARSE_INFO) |
613 | goto print_stack_trace; | | 613 | goto print_stack_trace; |
614 | if (type == PARSE_FATAL || opts.parseWarnFatal) | | 614 | if (type == PARSE_WARNING && !opts.parseWarnFatal) |
615 | fatals++; | | 615 | goto print_stack_trace; |
616 | if (opts.parseWarnFatal && !fatal_warning_error_printed) { | | 616 | fatals++; |
617 | /* | | 617 | if (type == PARSE_WARNING && !fatal_warning_error_printed) { |
618 | * FIXME: Also gets printed on .error, even though it | | | |
619 | * doesn't apply to it. | | | |
620 | */ | | | |
621 | Error("parsing warnings being treated as errors"); | | 618 | Error("parsing warnings being treated as errors"); |
622 | fatal_warning_error_printed = TRUE; | | 619 | fatal_warning_error_printed = TRUE; |
623 | } | | 620 | } |
624 | | | 621 | |
625 | print_stack_trace: | | 622 | print_stack_trace: |
626 | PrintStackTrace(); | | 623 | PrintStackTrace(); |
627 | } | | 624 | } |
628 | | | 625 | |
629 | static void | | 626 | static void |
630 | ParseErrorInternal(const char *fname, size_t lineno, | | 627 | ParseErrorInternal(const char *fname, size_t lineno, |
631 | ParseErrorLevel type, const char *fmt, ...) | | 628 | ParseErrorLevel type, const char *fmt, ...) |
632 | { | | 629 | { |
633 | va_list ap; | | 630 | va_list ap; |