Teach lint about long double _Complex (C99)
This commit is contained in:
parent
9536f79402
commit
9364aa71ae
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: inittyp.c,v 1.9 2008/04/25 22:18:34 christos Exp $ */
|
||||
/* $NetBSD: inittyp.c,v 1.10 2008/09/26 22:52:24 matt 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.9 2008/04/25 22:18:34 christos Exp $");
|
||||
__RCSID("$NetBSD: inittyp.c,v 1.10 2008/09/26 22:52:24 matt Exp $");
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
@ -119,6 +119,9 @@ inittyp(void)
|
||||
{ DCOMPLEX, { DOUBLE_SIZE * 2, 8 * CHAR_BIT * 2,
|
||||
DCOMPLEX, DCOMPLEX,
|
||||
0, 0, 1, 1, 1, 1, "double _Complex" } },
|
||||
{ LCOMPLEX, { LDOUBLE_SIZE * 2, 8 * CHAR_BIT * 2,
|
||||
LCOMPLEX, LCOMPLEX,
|
||||
0, 0, 1, 1, 1, 1, "long double _Complex" } },
|
||||
{ VOID, { -1, -1,
|
||||
VOID, VOID,
|
||||
0, 0, 0, 0, 0, 0, "void" } },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lint.h,v 1.11 2008/04/25 22:18:34 christos Exp $ */
|
||||
/* $NetBSD: lint.h,v 1.12 2008/09/26 22:52:24 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -74,9 +74,10 @@ typedef enum {
|
||||
PTR, /* pointer */
|
||||
ARRAY, /* array */
|
||||
FUNC, /* function */
|
||||
COMPLEX, /* _Complex */
|
||||
FCOMPLEX, /* float _Complex */
|
||||
DCOMPLEX, /* double _Complex */
|
||||
COMPLEX, /* _Complex */
|
||||
LCOMPLEX, /* long double _Complex */
|
||||
NTSPEC
|
||||
} tspec_t;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tyname.c,v 1.8 2008/05/01 21:52:19 christos Exp $ */
|
||||
/* $NetBSD: tyname.c,v 1.9 2008/09/26 22:52:24 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: tyname.c,v 1.8 2008/05/01 21:52:19 christos Exp $");
|
||||
__RCSID("$NetBSD: tyname.c,v 1.9 2008/09/26 22:52:24 matt Exp $");
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
@ -80,6 +80,7 @@ basictyname(tspec_t t)
|
||||
case ARRAY: return "array";
|
||||
case FCOMPLEX: return "float _Complex";
|
||||
case DCOMPLEX: return "double _Complex";
|
||||
case LCOMPLEX: return "long double _Complex";
|
||||
case COMPLEX: return "_Complex";
|
||||
default:
|
||||
LERROR("basictyname(%d)", t);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: decl.c,v 1.41 2008/04/27 00:13:58 christos Exp $ */
|
||||
/* $NetBSD: decl.c,v 1.42 2008/09/26 22:52:24 matt 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.41 2008/04/27 00:13:58 christos Exp $");
|
||||
__RCSID("$NetBSD: decl.c,v 1.42 2008/09/26 22:52:24 matt Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -119,6 +119,7 @@ initdecl(void)
|
||||
typetab[LDOUBLE].t_tspec = LDOUBLE;
|
||||
typetab[FCOMPLEX].t_tspec = FCOMPLEX;
|
||||
typetab[DCOMPLEX].t_tspec = DCOMPLEX;
|
||||
typetab[LCOMPLEX].t_tspec = LCOMPLEX;
|
||||
typetab[COMPLEX].t_tspec = COMPLEX;
|
||||
typetab[VOID].t_tspec = VOID;
|
||||
/*
|
||||
@ -300,9 +301,9 @@ addtype(type_t *tp)
|
||||
if (t == COMPLEX) {
|
||||
if (dcs->d_cmod == FLOAT)
|
||||
t = FCOMPLEX;
|
||||
else if (dcs->d_cmod == DOUBLE)
|
||||
else if (dcs->d_cmod == DOUBLE) {
|
||||
t = DCOMPLEX;
|
||||
else
|
||||
} else
|
||||
error(308, basictyname(dcs->d_cmod));
|
||||
dcs->d_cmod = NOTSPEC;
|
||||
}
|
||||
@ -342,8 +343,9 @@ addtype(type_t *tp)
|
||||
dcs->d_terr = 1;
|
||||
dcs->d_lmod = t;
|
||||
} else if (t == FLOAT || t == DOUBLE) {
|
||||
if (dcs->d_lmod == NOTSPEC) {
|
||||
if (dcs->d_cmod != NOTSPEC)
|
||||
if (dcs->d_lmod == NOTSPEC || dcs->d_lmod == LONG) {
|
||||
if (dcs->d_cmod != NOTSPEC
|
||||
|| (t == FLOAT && dcs->d_lmod == LONG))
|
||||
dcs->d_terr = 1;
|
||||
dcs->d_cmod = t;
|
||||
} else {
|
||||
@ -398,7 +400,7 @@ tdeferr(type_t *td, tspec_t t)
|
||||
break;
|
||||
case LONG:
|
||||
if (t2 == INT || t2 == UINT || t2 == LONG || t2 == ULONG ||
|
||||
t2 == FLOAT || t2 == DOUBLE) {
|
||||
t2 == FLOAT || t2 == DOUBLE || t2 == DCOMPLEX) {
|
||||
/* modifying typedef with ... */
|
||||
warning(5, "long");
|
||||
if (t2 == INT) {
|
||||
@ -413,6 +415,8 @@ tdeferr(type_t *td, tspec_t t)
|
||||
td = gettyp(DOUBLE);
|
||||
} else if (t2 == DOUBLE) {
|
||||
td = gettyp(LDOUBLE);
|
||||
} else if (t2 == DCOMPLEX) {
|
||||
td = gettyp(LCOMPLEX);
|
||||
}
|
||||
td = duptyp(td);
|
||||
td->t_typedef = 1;
|
||||
@ -443,6 +447,7 @@ tdeferr(type_t *td, tspec_t t)
|
||||
case INT:
|
||||
case FCOMPLEX:
|
||||
case DCOMPLEX:
|
||||
case LCOMPLEX:
|
||||
case COMPLEX:
|
||||
break;
|
||||
|
||||
@ -709,9 +714,18 @@ deftyp(void)
|
||||
warning(266);
|
||||
}
|
||||
break;
|
||||
case DCOMPLEX:
|
||||
if (l == LONG) {
|
||||
l = NOTSPEC;
|
||||
t = LCOMPLEX;
|
||||
if (tflag)
|
||||
/* 'long double' is illegal in ... */
|
||||
warning(266);
|
||||
}
|
||||
break;
|
||||
case VOID:
|
||||
case FCOMPLEX:
|
||||
case DCOMPLEX:
|
||||
case LCOMPLEX:
|
||||
break;
|
||||
default:
|
||||
LERROR("deftyp()");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: emit1.c,v 1.18 2008/04/26 23:34:55 christos Exp $ */
|
||||
/* $NetBSD: emit1.c,v 1.19 2008/09/26 22:52:24 matt 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.18 2008/04/26 23:34:55 christos Exp $");
|
||||
__RCSID("$NetBSD: emit1.c,v 1.19 2008/09/26 22:52:24 matt Exp $");
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
@ -56,6 +56,7 @@ static void outfstrg(strg_t *);
|
||||
* _Bool B
|
||||
* _Complex float s X
|
||||
* _Complex double X
|
||||
* _Complex long double l X
|
||||
* char C
|
||||
* signed char s C
|
||||
* unsigned char u C
|
||||
@ -125,6 +126,7 @@ outtype(type_t *tp)
|
||||
case UNION: t = 'T'; s = 'u'; break;
|
||||
case FCOMPLEX: t = 'X'; s = 's'; break;
|
||||
case DCOMPLEX: t = 'X'; s = '\0'; break;
|
||||
case LCOMPLEX: t = 'X'; s = 'l'; break;
|
||||
default:
|
||||
LERROR("outtyp()");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
%{
|
||||
/* $NetBSD: scan.l,v 1.39 2008/09/10 14:05:00 joerg Exp $ */
|
||||
/* $NetBSD: scan.l,v 1.40 2008/09/26 22:52:24 matt 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.39 2008/09/10 14:05:00 joerg Exp $");
|
||||
__RCSID("$NetBSD: scan.l,v 1.40 2008/09/26 22:52:24 matt Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -605,6 +605,7 @@ icon(int base)
|
||||
case UNSIGN:
|
||||
case FCOMPLEX:
|
||||
case DCOMPLEX:
|
||||
case LCOMPLEX:
|
||||
case COMPLEX:
|
||||
break;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tree.c,v 1.51 2008/07/31 15:21:34 christos Exp $ */
|
||||
/* $NetBSD: tree.c,v 1.52 2008/09/26 22:52:24 matt 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.51 2008/07/31 15:21:34 christos Exp $");
|
||||
__RCSID("$NetBSD: tree.c,v 1.52 2008/09/26 22:52:24 matt Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -1982,6 +1982,7 @@ cvtcon(op_t op, int arg, type_t *tp, val_t *nv, val_t *v)
|
||||
case PTR:
|
||||
/* Got already an error because of float --> ptr */
|
||||
case LDOUBLE:
|
||||
case LCOMPLEX:
|
||||
max = LDBL_MAX; min = -LDBL_MAX; break;
|
||||
default:
|
||||
LERROR("cvtcon()");
|
||||
@ -2391,6 +2392,9 @@ bldri(op_t op, tnode_t *ln)
|
||||
LERROR("bldincdec()");
|
||||
|
||||
switch (ln->tn_type->t_tspec) {
|
||||
case LCOMPLEX:
|
||||
cn = getinode(LDOUBLE, (int64_t)1);
|
||||
break;
|
||||
case DCOMPLEX:
|
||||
cn = getinode(DOUBLE, (int64_t)1);
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: emit2.c,v 1.12 2008/04/26 20:31:45 christos Exp $ */
|
||||
/* $NetBSD: emit2.c,v 1.13 2008/09/26 22:52:24 matt 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.12 2008/04/26 20:31:45 christos Exp $");
|
||||
__RCSID("$NetBSD: emit2.c,v 1.13 2008/09/26 22:52:24 matt Exp $");
|
||||
#endif
|
||||
|
||||
#include "lint2.h"
|
||||
@ -81,6 +81,7 @@ outtype(type_t *tp)
|
||||
case UNION: t = 'T'; s = 'u'; break;
|
||||
case FCOMPLEX: t = 'X'; s = 's'; break;
|
||||
case DCOMPLEX: t = 'X'; s = '\0'; break;
|
||||
case LCOMPLEX: t = 'X'; s = 'l'; break;
|
||||
case FUNC:
|
||||
if (tp->t_args != NULL && !tp->t_proto) {
|
||||
t = 'f';
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: read.c,v 1.22 2008/04/26 20:11:09 christos Exp $ */
|
||||
/* $NetBSD: read.c,v 1.23 2008/09/26 22:52:24 matt 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.22 2008/04/26 20:11:09 christos Exp $");
|
||||
__RCSID("$NetBSD: read.c,v 1.23 2008/09/26 22:52:24 matt Exp $");
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
@ -633,7 +633,8 @@ inptype(const char *cp, const char **epp)
|
||||
tp->t_tspec = s == 'e' ? ENUM : (s == 's' ? STRUCT : UNION);
|
||||
break;
|
||||
case 'X':
|
||||
tp->t_tspec = s == 's' ? FCOMPLEX : DCOMPLEX;
|
||||
tp->t_tspec = s == 's' ? FCOMPLEX
|
||||
: (s == 'l' ? LCOMPLEX : DCOMPLEX);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -721,6 +722,7 @@ inptype(const char *cp, const char **epp)
|
||||
case NOTSPEC:
|
||||
case FCOMPLEX:
|
||||
case DCOMPLEX:
|
||||
case LCOMPLEX:
|
||||
case COMPLEX:
|
||||
break;
|
||||
case NTSPEC:
|
||||
@ -856,6 +858,8 @@ gettlen(const char *cp, const char **epp)
|
||||
case 'X':
|
||||
if (s == 's') {
|
||||
t = FCOMPLEX;
|
||||
} else if (s == 'l') {
|
||||
t = LCOMPLEX;
|
||||
} else if (s == '\0') {
|
||||
t = DCOMPLEX;
|
||||
}
|
||||
@ -948,6 +952,7 @@ gettlen(const char *cp, const char **epp)
|
||||
case LONG:
|
||||
case FCOMPLEX:
|
||||
case DCOMPLEX:
|
||||
case LCOMPLEX:
|
||||
case COMPLEX:
|
||||
break;
|
||||
#ifndef __COVERITY__
|
||||
|
Loading…
Reference in New Issue
Block a user