Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 - support for -X flag
details: https://anonhg.NetBSD.org/src/rev/ca1439e75be2
branches: trunk
changeset: 494369:ca1439e75be2
user: christos <christos%NetBSD.org@localhost>
date: Thu Jul 06 01:09:20 2000 +0000
description:
- support for -X flag
- support for -m flag
- print the error number in each message
diffstat:
usr.bin/xlint/lint1/err.c | 48 +++++++++++++++++++++++++++++++++++++---------
1 files changed, 38 insertions(+), 10 deletions(-)
diffs (114 lines):
diff -r 042fb84e4097 -r ca1439e75be2 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Thu Jul 06 01:08:10 2000 +0000
+++ b/usr.bin/xlint/lint1/err.c Thu Jul 06 01:09:20 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.11 1998/07/27 13:50:47 mycroft Exp $ */
+/* $NetBSD: err.c,v 1.12 2000/07/06 01:09:20 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -36,12 +36,8 @@
__RCSID("$NetBSD");
#endif
-/* number of errors found */
-int nerr;
-
-/* number of syntax errors */
-int sytxerr;
-
+#define FD_SETSIZE 512
+#include <sys/types.h>
#include <stdlib.h>
#ifdef __STDC__
#include <stdarg.h>
@@ -51,6 +47,15 @@
#include "lint1.h"
+/* number of errors found */
+int nerr;
+
+/* number of syntax errors */
+int sytxerr;
+
+extern fd_set msgset;
+
+
static const char *basename __P((const char *));
static void verror __P((int, va_list));
static void vwarning __P((int, va_list));
@@ -372,6 +377,18 @@
};
/*
+ * print a list of the messages with their ids
+ */
+void
+msglist()
+{
+ int i;
+
+ for (i = 0; i < sizeof(msgs) / sizeof(msgs[0]); i++)
+ printf("%d\t%s\n", i, msgs[i]);
+}
+
+/*
* If Fflag is not set basename() returns a pointer to the last
* component of the path, otherwise it returns the argument.
*/
@@ -401,10 +418,13 @@
{
const char *fn;
+ if (FD_ISSET(n, &msgset))
+ return;
+
fn = basename(curr_pos.p_file);
(void)printf("%s(%d): ", fn, curr_pos.p_line);
(void)vprintf(msgs[n], ap);
- (void)printf("\n");
+ (void)printf(" [%d]\n", n);
nerr++;
}
@@ -415,6 +435,9 @@
{
const char *fn;
+ if (FD_ISSET(n, &msgset))
+ return;
+
if (nowarn)
/* this warning is suppressed by a LINTED comment */
return;
@@ -422,7 +445,9 @@
fn = basename(curr_pos.p_file);
(void)printf("%s(%d): warning: ", fn, curr_pos.p_line);
(void)vprintf(msgs[n], ap);
- (void)printf("\n");
+ (void)printf(" [%d]\n", n);
+ if (wflag)
+ nerr++;
}
void
@@ -502,6 +527,9 @@
va_list ap;
const char *fn;
+ if (FD_ISSET(n, &msgset))
+ return;
+
#ifdef __STDC__
va_start(ap, n);
#else
@@ -510,7 +538,7 @@
fn = basename(curr_pos.p_file);
(void)printf("%s(%d): ", fn, curr_pos.p_line);
(void)vprintf(msgs[n], ap);
- (void)printf("\n");
+ (void)printf(" [%d]\n", n);
va_end(ap);
}
Home |
Main Index |
Thread Index |
Old Index