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 lint: remove unreachable code for parsin...
details: https://anonhg.NetBSD.org/src/rev/4963940e3393
branches: trunk
changeset: 1023188:4963940e3393
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 28 21:14:32 2021 +0000
description:
lint: remove unreachable code for parsing integer constants
The largest possible type of an integer constant is 'unsigned long
long'. Any larger type can only be expressed using casts.
See also https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html.
diffstat:
usr.bin/xlint/lint1/lex.c | 40 ++++++----------------------------------
1 files changed, 6 insertions(+), 34 deletions(-)
diffs (79 lines):
diff -r f6eda31cf034 -r 4963940e3393 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sat Aug 28 21:01:34 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sat Aug 28 21:14:32 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.76 2021/08/28 19:27:44 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.77 2021/08/28 21:14:32 rillig 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: lex.c,v 1.76 2021/08/28 19:27:44 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.77 2021/08/28 21:14:32 rillig Exp $");
#endif
#include <ctype.h>
@@ -510,22 +510,13 @@
tspec_t typ;
bool ansiu;
bool warned = false;
-#ifdef TARG_INT128_MAX
- __uint128_t uq = 0;
- /* FIXME: INT128 doesn't belong here. */
- /* TODO: const */
- /* TODO: remove #ifdef */
- static tspec_t contypes[2][4] = {
- { INT, LONG, QUAD, INT128, },
- { UINT, ULONG, UQUAD, UINT128, }
- };
-#else
uint64_t uq = 0;
- static tspec_t contypes[2][3] = {
+
+ /* C11 6.4.4.1p5 */
+ static const tspec_t suffix_type[2][3] = {
{ INT, LONG, QUAD, },
{ UINT, ULONG, UQUAD, }
};
-#endif
cp = yytext;
len = yyleng;
@@ -560,7 +551,7 @@
/* suffix U is illegal in traditional C */
warning(97);
}
- typ = contypes[u_suffix][l_suffix];
+ typ = suffix_type[u_suffix][l_suffix];
errno = 0;
@@ -643,25 +634,6 @@
warning(252);
}
break;
-#ifdef INT128_SIZE
- case INT128:
-#ifdef TARG_INT128_MAX
- if (uq > TARG_INT128_MAX && !tflag) {
- typ = UINT128;
- if (!sflag)
- ansiu = true;
- }
-#endif
- break;
- case UINT128:
-#ifdef TARG_INT128_MAX
- if (uq > TARG_UINT128_MAX && !warned) {
- /* integer constant out of range */
- warning(252);
- }
-#endif
- break;
-#endif
default:
break;
}
Home |
Main Index |
Thread Index |
Old Index