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 Minimize diffs with my C99 capable versi...
details: https://anonhg.NetBSD.org/src/rev/8d333db906d2
branches: trunk
changeset: 536329:8d333db906d2
user: christos <christos%NetBSD.org@localhost>
date: Fri Sep 13 14:59:24 2002 +0000
description:
Minimize diffs with my C99 capable version [this commit does not include
C99 support.
- turn lerror() into a macro so that the filename and the line number of the
error are printed before we abort.
- recurse in type printing to provide the proper type name.
diffstat:
usr.bin/xlint/lint1/cgram.y | 8 +-
usr.bin/xlint/lint1/decl.c | 72 ++++++------
usr.bin/xlint/lint1/emit1.c | 10 +-
usr.bin/xlint/lint1/err.c | 11 +-
usr.bin/xlint/lint1/externs1.h | 8 +-
usr.bin/xlint/lint1/func.c | 20 +-
usr.bin/xlint/lint1/init.c | 22 ++--
usr.bin/xlint/lint1/lint1.h | 4 +-
usr.bin/xlint/lint1/scan.l | 20 +-
usr.bin/xlint/lint1/tree.c | 217 ++++++++++++++++++++++++++--------------
10 files changed, 230 insertions(+), 162 deletions(-)
diffs (truncated from 1394 to 300 lines):
diff -r 9ef733f7a4ba -r 8d333db906d2 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Fri Sep 13 14:51:25 2002 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Fri Sep 13 14:59:24 2002 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.24 2002/02/05 03:04:27 thorpej Exp $ */
+/* $NetBSD: cgram.y,v 1.25 2002/09/13 14:59:24 christos Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.24 2002/02/05 03:04:27 thorpej Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.25 2002/09/13 14:59:24 christos Exp $");
#endif
#include <stdlib.h>
@@ -1721,7 +1721,7 @@
case EXTERN:
if (rename != NULL) {
if (decl->s_rename != NULL)
- lerror("idecl() 1");
+ LERROR("idecl()");
s = getlblk(1, rename->sb_len + 1);
(void)memcpy(s, rename->sb_name, rename->sb_len + 1);
@@ -1749,7 +1749,7 @@
decl1loc(decl, initflg);
break;
default:
- lerror("idecl() 2");
+ LERROR("idecl()");
}
if (initflg && !initerr)
diff -r 9ef733f7a4ba -r 8d333db906d2 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Fri Sep 13 14:51:25 2002 +0000
+++ b/usr.bin/xlint/lint1/decl.c Fri Sep 13 14:59:24 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.30 2002/01/31 19:36:53 tv Exp $ */
+/* $NetBSD: decl.c,v 1.31 2002/09/13 14:59:24 christos Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.30 2002/01/31 19:36:53 tv Exp $");
+__RCSID("$NetBSD: decl.c,v 1.31 2002/09/13 14:59:24 christos Exp $");
#endif
#include <sys/param.h>
@@ -194,7 +194,7 @@
tp->t_str->sincompl = ic;
} else {
if (t != ENUM)
- lerror("setcompl() 1");
+ LERROR("setcompl()");
tp->t_enum->eincompl = ic;
}
}
@@ -253,7 +253,7 @@
* something like "typedef int a; int a b;"
* This should not happen with current grammar.
*/
- lerror("addtype()");
+ LERROR("addtype()");
}
dcs->d_type = tp;
return;
@@ -466,7 +466,7 @@
dcs->d_const = 1;
} else {
if (q != VOLATILE)
- lerror("addqual() 1");
+ LERROR("addqual()");
if (dcs->d_volatile) {
/* duplicate "%s" */
warning(10, "volatile");
@@ -507,13 +507,13 @@
(void)printf("popdecl(%d)\n", (int)dcs->d_ctx);
if (dcs->d_nxt == NULL)
- lerror("popdecl() 1");
+ LERROR("popdecl()");
di = dcs;
dcs = di->d_nxt;
switch (di->d_ctx) {
case EXTERN:
/* there is nothing after external declarations */
- lerror("popdecl() 2");
+ LERROR("popdecl()");
/* NOTREACHED */
case MOS:
case MOU:
@@ -561,7 +561,7 @@
rmsyms(di->d_dlsyms);
break;
default:
- lerror("popdecl() 3");
+ LERROR("popdecl()");
}
free(di);
}
@@ -634,7 +634,7 @@
if (tp != NULL && (t != NOTSPEC || s != NOTSPEC || l != NOTSPEC)) {
/* should never happen */
- lerror("deftyp() 1");
+ LERROR("deftyp()");
}
if (tp == NULL) {
@@ -673,7 +673,7 @@
case VOID:
break;
default:
- lerror("deftyp() 2");
+ LERROR("deftyp()");
}
if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
dcs->d_terr = 1;
@@ -711,13 +711,13 @@
if (dcs->d_const && dcs->d_type->t_const) {
if (!dcs->d_type->t_typedef)
- lerror("deftyp() 3");
+ LERROR("deftyp()");
/* typedef already qualified with "%s" */
warning(68, "const");
}
if (dcs->d_volatile && dcs->d_type->t_volatile) {
if (!dcs->d_type->t_typedef)
- lerror("deftyp() 4");
+ LERROR("deftyp()");
/* typedef already qualified with "%s" */
warning(68, "volatile");
}
@@ -776,7 +776,7 @@
switch (tp->t_tspec) {
case FUNC:
/* compiler takes size of function */
- lerror(msgs[12]);
+ LERROR(msgs[12]);
/* NOTREACHED */
case STRUCT:
case UNION:
@@ -795,7 +795,7 @@
default:
elsz = size(tp->t_tspec);
if (elsz <= 0)
- lerror("length()");
+ LERROR("length()");
break;
}
return (elem * elsz);
@@ -830,7 +830,7 @@
}
}
if (a < CHAR_BIT || a > ALIGN(1) * CHAR_BIT)
- lerror("getbound() 1");
+ LERROR("getbound()");
return (a);
}
@@ -924,7 +924,7 @@
if (dcs->d_ctx == PARG) {
if (sym->s_scl != ABSTRACT) {
if (sym->s_name == unnamed)
- lerror("chktyp()");
+ LERROR("chktyp()");
/* void param cannot have name: %s */
error(61, sym->s_name);
*tpp = gettyp(INT);
@@ -962,12 +962,12 @@
scl_t sc;
if ((sc = dsym->s_scl) != MOS && sc != MOU)
- lerror("decl1str() 1");
+ LERROR("decl1str()");
if (dcs->d_rdcsym != NULL) {
if ((sc = dcs->d_rdcsym->s_scl) != MOS && sc != MOU)
/* should be ensured by storesym() */
- lerror("decl1str() 2");
+ LERROR("decl1str()");
if (dsym->s_styp == dcs->d_rdcsym->s_styp) {
/* duplicate member name: %s */
error(33, dsym->s_name);
@@ -990,11 +990,13 @@
t == SHORT || t == USHORT || t == ENUM) {
if (bitfieldtype_ok == 0) {
if (sflag) {
+ char buf[64];
/*
* bit-field type '%s' invalid in
* ANSI C
*/
- warning(273, tyname(tp));
+ warning(273,
+ tyname(buf, sizeof(buf), tp));
} else if (pflag) {
/* nonportable bit-field type */
warning(34);
@@ -1416,7 +1418,7 @@
} else if (sc == EXTERN) {
sym->s_def = DECL;
} else {
- lerror("dname() 1");
+ LERROR("dname()");
}
break;
case PARG:
@@ -1429,7 +1431,7 @@
sym->s_reg = 1;
sc = AUTO;
} else {
- lerror("dname() 2");
+ LERROR("dname()");
}
sym->s_def = DEF;
break;
@@ -1452,11 +1454,11 @@
} else if (sc == EXTERN) {
sym->s_def = DECL;
} else {
- lerror("dname() 3");
+ LERROR("dname()");
}
break;
default:
- lerror("dname() 4");
+ LERROR("dname()");
}
sym->s_scl = sc;
@@ -1480,7 +1482,7 @@
/* redeclaration of formal parameter %s */
error(21, sym->s_name);
if (!sym->s_defarg)
- lerror("iname()");
+ LERROR("iname()");
}
sym = pushdown(sym);
}
@@ -1513,7 +1515,7 @@
} else if (kind == ENUM) {
scl = ENUMTAG;
} else {
- lerror("mktag()");
+ LERROR("mktag()");
}
if (tag != NULL) {
@@ -1635,7 +1637,7 @@
case STRTAG: s = "struct"; break;
case UNIONTAG: s = "union"; break;
case ENUMTAG: s = "enum"; break;
- default: lerror("tagttoa()");
+ default: LERROR("tagttoa()");
}
return (s);
}
@@ -2142,7 +2144,7 @@
while ((dst = *dstp) != NULL) {
if (src == NULL || dst->t_tspec != src->t_tspec)
- lerror("compltyp() 1");
+ LERROR("compltyp()");
if (dst->t_tspec == ARRAY) {
if (dst->t_dim == 0 && src->t_dim != 0) {
*dstp = dst = duptyp(dst);
@@ -2471,7 +2473,7 @@
*/
break;
default:
- lerror("decl1loc() 1");
+ LERROR("decl1loc()");
}
} else if (dcs->d_rdcsym->s_blklev == blklev) {
@@ -2620,7 +2622,7 @@
sym_t *sym;
if (dcs->d_ctx != ABSTRACT && dcs->d_ctx != PARG)
- lerror("aname()");
+ LERROR("aname()");
sym = getblk(sizeof (sym_t));
@@ -2790,7 +2792,7 @@
{
if (!arg->s_set)
- lerror("chkausg() 1");
+ LERROR("chkausg()");
Home |
Main Index |
Thread Index |
Old Index