Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint recognize _Bool.
details: https://anonhg.NetBSD.org/src/rev/dd986cfb8db4
branches: trunk
changeset: 569887:dd986cfb8db4
user: yamt <yamt%NetBSD.org@localhost>
date: Sun Sep 12 08:58:52 2004 +0000
description:
recognize _Bool.
diffstat:
usr.bin/xlint/common/inittyp.c | 7 +++++--
usr.bin/xlint/common/lint.h | 3 ++-
usr.bin/xlint/lint1/decl.c | 14 +++++++++-----
usr.bin/xlint/lint1/emit1.c | 6 ++++--
usr.bin/xlint/lint1/scan.l | 6 ++++--
usr.bin/xlint/lint1/tree.c | 8 ++++++--
usr.bin/xlint/lint2/emit2.c | 5 +++--
usr.bin/xlint/lint2/read.c | 13 +++++++++++--
8 files changed, 44 insertions(+), 18 deletions(-)
diffs (294 lines):
diff -r 9b48b3c27390 -r dd986cfb8db4 usr.bin/xlint/common/inittyp.c
--- a/usr.bin/xlint/common/inittyp.c Sun Sep 12 08:41:47 2004 +0000
+++ b/usr.bin/xlint/common/inittyp.c Sun Sep 12 08:58:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inittyp.c,v 1.6 2004/06/20 22:20:16 jmc Exp $ */
+/* $NetBSD: inittyp.c,v 1.7 2004/09/12 08:58:52 yamt Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.6 2004/06/20 22:20:16 jmc Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.7 2004/09/12 08:58:52 yamt Exp $");
#endif
#include <ctype.h>
@@ -69,6 +69,9 @@
{ UNSIGN, { 0, 0,
SIGNED, UNSIGN,
0, 0, 0, 0, 0, "unsigned" } },
+ { BOOL, { CHAR_SIZE, 1,
+ BOOL, BOOL,
+ 1, 1, 0, 1, 1, "_Bool" } },
{ CHAR, { CHAR_SIZE, CHAR_BIT,
SCHAR, UCHAR,
1, 0, 0, 1, 1, "char" } },
diff -r 9b48b3c27390 -r dd986cfb8db4 usr.bin/xlint/common/lint.h
--- a/usr.bin/xlint/common/lint.h Sun Sep 12 08:41:47 2004 +0000
+++ b/usr.bin/xlint/common/lint.h Sun Sep 12 08:58:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint.h,v 1.7 2003/10/27 00:12:44 lukem Exp $ */
+/* $NetBSD: lint.h,v 1.8 2004/09/12 08:58:52 yamt Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -52,6 +52,7 @@
NOTSPEC = 0,
SIGNED, /* keyword "signed", only used in the parser */
UNSIGN, /* keyword "unsigned", only used in the parser */
+ BOOL, /* _Bool */
CHAR, /* char */
SCHAR, /* signed char */
UCHAR, /* unsigned char */
diff -r 9b48b3c27390 -r dd986cfb8db4 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun Sep 12 08:41:47 2004 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun Sep 12 08:58:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.33 2004/06/20 22:20:16 jmc Exp $ */
+/* $NetBSD: decl.c,v 1.34 2004/09/12 08:58:52 yamt Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.33 2004/06/20 22:20:16 jmc Exp $");
+__RCSID("$NetBSD: decl.c,v 1.34 2004/09/12 08:58:52 yamt Exp $");
#endif
#include <sys/param.h>
@@ -102,6 +102,7 @@
typetab = xcalloc(NTSPEC, sizeof (type_t));
for (i = 0; i < NTSPEC; i++)
typetab[i].t_tspec = NOTSPEC;
+ typetab[BOOL].t_tspec = BOOL;
typetab[CHAR].t_tspec = CHAR;
typetab[SCHAR].t_tspec = SCHAR;
typetab[UCHAR].t_tspec = UCHAR;
@@ -400,6 +401,7 @@
case UCHAR:
case SCHAR:
case CHAR:
+ case BOOL:
case FUNC:
case ARRAY:
case PTR:
@@ -627,9 +629,9 @@
type_t *tp;
scl_t scl;
- t = dcs->d_atyp; /* CHAR, INT, FLOAT, DOUBLE, VOID */
- s = dcs->d_smod; /* SIGNED, UNSIGNED */
- l = dcs->d_lmod; /* SHORT, LONG, QUAD */
+ t = dcs->d_atyp; /* BOOL, CHAR, INT, FLOAT, DOUBLE, VOID */
+ s = dcs->d_smod; /* SIGNED, UNSIGNED */
+ l = dcs->d_lmod; /* SHORT, LONG, QUAD */
tp = dcs->d_type;
scl = dcs->d_scl;
@@ -643,6 +645,8 @@
if (tp == NULL) {
switch (t) {
+ case BOOL:
+ break;
case NOTSPEC:
t = INT;
/* FALLTHROUGH */
diff -r 9b48b3c27390 -r dd986cfb8db4 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c Sun Sep 12 08:41:47 2004 +0000
+++ b/usr.bin/xlint/lint1/emit1.c Sun Sep 12 08:58:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.14 2004/06/20 22:20:16 jmc Exp $ */
+/* $NetBSD: emit1.c,v 1.15 2004/09/12 08:58:52 yamt Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.14 2004/06/20 22:20:16 jmc Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.15 2004/09/12 08:58:52 yamt Exp $");
#endif
#include <ctype.h>
@@ -53,6 +53,7 @@
* The type is written as a sequence of substrings, each of which describes a
* node of type type_t
* a node is coded as follows:
+ * _Bool B
* char C
* signed char s C
* unsigned char u C
@@ -98,6 +99,7 @@
if ((ts = tp->t_tspec) == INT && tp->t_isenum)
ts = ENUM;
switch (ts) {
+ case BOOL: t = 'B'; s = '\0'; break;
case CHAR: t = 'C'; s = '\0'; break;
case SCHAR: t = 'C'; s = 's'; break;
case UCHAR: t = 'C'; s = 'u'; break;
diff -r 9b48b3c27390 -r dd986cfb8db4 usr.bin/xlint/lint1/scan.l
--- a/usr.bin/xlint/lint1/scan.l Sun Sep 12 08:41:47 2004 +0000
+++ b/usr.bin/xlint/lint1/scan.l Sun Sep 12 08:58:52 2004 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: scan.l,v 1.32 2002/11/02 01:42:22 perry Exp $ */
+/* $NetBSD: scan.l,v 1.33 2004/09/12 08:58:52 yamt 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: scan.l,v 1.32 2002/11/02 01:42:22 perry Exp $");
+__RCSID("$NetBSD: scan.l,v 1.33 2004/09/12 08:58:52 yamt Exp $");
#endif
#include <stdlib.h>
@@ -197,6 +197,7 @@
{ "__asm__", T_ASM, 0, 0, 0, 0, 0, 0 },
{ "auto", T_SCLASS, AUTO, 0, 0, 0, 0, 0 },
{ "break", T_BREAK, 0, 0, 0, 0, 0, 0 },
+ { "_Bool", T_TYPE, 0, BOOL, 0, 0, 1, 0 },
{ "case", T_CASE, 0, 0, 0, 0, 0, 0 },
{ "char", T_TYPE, 0, CHAR, 0, 0, 0, 0 },
{ "const", T_QUAL, 0, 0, CONST, 1, 0, 0 },
@@ -578,6 +579,7 @@
case UCHAR:
case SCHAR:
case CHAR:
+ case BOOL:
case UNSIGN:
break;
diff -r 9b48b3c27390 -r dd986cfb8db4 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sun Sep 12 08:41:47 2004 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sun Sep 12 08:58:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.37 2004/06/20 22:20:17 jmc Exp $ */
+/* $NetBSD: tree.c,v 1.38 2004/09/12 08:58:52 yamt Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.37 2004/06/20 22:20:17 jmc Exp $");
+__RCSID("$NetBSD: tree.c,v 1.38 2004/09/12 08:58:52 yamt Exp $");
#endif
#include <stdlib.h>
@@ -1911,6 +1911,8 @@
if (ot == FLOAT || ot == DOUBLE || ot == LDOUBLE) {
switch (nt) {
+ case BOOL:
+ max = 1; min = 0; break;
case CHAR:
max = CHAR_MAX; min = CHAR_MIN; break;
case UCHAR:
@@ -2253,6 +2255,7 @@
basictyname(tspec_t t)
{
switch (t) {
+ case BOOL: return "_Bool";
case CHAR: return "char";
case UCHAR: return "unsigned char";
case SCHAR: return "signed char";
@@ -2293,6 +2296,7 @@
switch (t) {
+ case BOOL:
case CHAR:
case UCHAR:
case SCHAR:
diff -r 9b48b3c27390 -r dd986cfb8db4 usr.bin/xlint/lint2/emit2.c
--- a/usr.bin/xlint/lint2/emit2.c Sun Sep 12 08:41:47 2004 +0000
+++ b/usr.bin/xlint/lint2/emit2.c Sun Sep 12 08:58:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit2.c,v 1.9 2002/01/31 19:36:55 tv Exp $ */
+/* $NetBSD: emit2.c,v 1.10 2004/09/12 08:58:52 yamt 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: emit2.c,v 1.9 2002/01/31 19:36:55 tv Exp $");
+__RCSID("$NetBSD: emit2.c,v 1.10 2004/09/12 08:58:52 yamt Exp $");
#endif
#include "lint2.h"
@@ -58,6 +58,7 @@
if ((ts = tp->t_tspec) == INT && tp->t_isenum)
ts = ENUM;
switch (ts) {
+ case BOOL: t = 'B'; s = '\0'; break;
case CHAR: t = 'C'; s = '\0'; break;
case SCHAR: t = 'C'; s = 's'; break;
case UCHAR: t = 'C'; s = 'u'; break;
diff -r 9b48b3c27390 -r dd986cfb8db4 usr.bin/xlint/lint2/read.c
--- a/usr.bin/xlint/lint2/read.c Sun Sep 12 08:41:47 2004 +0000
+++ b/usr.bin/xlint/lint2/read.c Sun Sep 12 08:58:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.14 2004/06/20 22:20:17 jmc Exp $ */
+/* $NetBSD: read.c,v 1.15 2004/09/12 08:58:52 yamt Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: read.c,v 1.14 2004/06/20 22:20:17 jmc Exp $");
+__RCSID("$NetBSD: read.c,v 1.15 2004/09/12 08:58:52 yamt Exp $");
#endif
#include <ctype.h>
@@ -576,6 +576,9 @@
}
switch (c) {
+ case 'B':
+ tp->t_tspec = BOOL;
+ break;
case 'C':
tp->t_tspec = s == 's' ? SCHAR : (s == 'u' ? UCHAR : CHAR);
break;
@@ -687,6 +690,7 @@
case UCHAR:
case SCHAR:
case CHAR:
+ case BOOL:
case UNSIGN:
case SIGNED:
case NOTSPEC:
@@ -739,6 +743,10 @@
t = NOTSPEC;
switch (c) {
+ case 'B':
+ if (s == '\0')
+ t = BOOL;
+ break;
case 'C':
if (s == 's') {
t = SCHAR;
@@ -883,6 +891,7 @@
case UCHAR:
case SCHAR:
case CHAR:
+ case BOOL:
case UNSIGN:
case SIGNED:
case NOTSPEC:
Home |
Main Index |
Thread Index |
Old Index