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 compat code for lexing hex ...
details: https://anonhg.NetBSD.org/src/rev/c511efbf4367
branches: trunk
changeset: 373574:c511efbf4367
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Feb 18 14:32:32 2023 +0000
description:
lint: remove compat code for lexing hex floating point literals
Hex floating literals are required by C99.
diffstat:
tests/usr.bin/xlint/lint1/lex_floating.c | 8 +++++++-
usr.bin/xlint/lint1/lex.c | 24 +++---------------------
2 files changed, 10 insertions(+), 22 deletions(-)
diffs (64 lines):
diff -r f73843a6abb4 -r c511efbf4367 tests/usr.bin/xlint/lint1/lex_floating.c
--- a/tests/usr.bin/xlint/lint1/lex_floating.c Sat Feb 18 14:04:17 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/lex_floating.c Sat Feb 18 14:32:32 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex_floating.c,v 1.2 2022/01/15 14:22:03 rillig Exp $ */
+/* $NetBSD: lex_floating.c,v 1.3 2023/02/18 14:32:32 rillig Exp $ */
# 3 "lex_floating.c"
/*
@@ -34,3 +34,9 @@
{
sinkl(2.2250738585072012e-308L);
}
+
+void
+test_hex(void)
+{
+ sinkd(0x1.cp4);
+}
diff -r f73843a6abb4 -r c511efbf4367 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sat Feb 18 14:04:17 2023 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sat Feb 18 14:32:32 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.148 2023/02/02 22:23:30 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.149 2023/02/18 14:32:32 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.148 2023/02/02 22:23:30 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.149 2023/02/18 14:32:32 rillig Exp $");
#endif
#include <ctype.h>
@@ -663,25 +663,7 @@
/* TODO: Handle precision and exponents of 'long double'. */
errno = 0;
d = strtod(cp, &eptr);
- if (eptr != cp + len) {
- switch (*eptr) {
- /*
- * XXX: Non-native non-current strtod() may not
- * handle hex floats, ignore the rest if we find
- * traces of hex float syntax.
- */
- case 'p':
- case 'P':
- case 'x':
- case 'X':
- d = 0;
- errno = 0;
- break;
- default:
- INTERNAL_ERROR("lex_floating_constant(%.*s)",
- (int)(eptr - cp), cp);
- }
- }
+ lint_assert(eptr == cp + len);
if (errno != 0)
/* floating-point constant out of range */
warning(248);
Home |
Main Index |
Thread Index |
Old Index