Module Name: src Committed By: rillig Date: Sat Feb 18 14:32:32 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: lex_floating.c src/usr.bin/xlint/lint1: lex.c Log Message: lint: remove compat code for lexing hex floating point literals Hex floating literals are required by C99. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/lex_floating.c cvs rdiff -u -r1.148 -r1.149 src/usr.bin/xlint/lint1/lex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/lex_floating.c diff -u src/tests/usr.bin/xlint/lint1/lex_floating.c:1.2 src/tests/usr.bin/xlint/lint1/lex_floating.c:1.3 --- src/tests/usr.bin/xlint/lint1/lex_floating.c:1.2 Sat Jan 15 14:22:03 2022 +++ src/tests/usr.bin/xlint/lint1/lex_floating.c Sat Feb 18 14:32:32 2023 @@ -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 @@ test_long_double(void) { sinkl(2.2250738585072012e-308L); } + +void +test_hex(void) +{ + sinkd(0x1.cp4); +} Index: src/usr.bin/xlint/lint1/lex.c diff -u src/usr.bin/xlint/lint1/lex.c:1.148 src/usr.bin/xlint/lint1/lex.c:1.149 --- src/usr.bin/xlint/lint1/lex.c:1.148 Thu Feb 2 22:23:30 2023 +++ src/usr.bin/xlint/lint1/lex.c Sat Feb 18 14:32:32 2023 @@ -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 @@ lex_floating_constant(const char *yytext /* 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);