Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint1 lint: add test for floating consta...



details:   https://anonhg.NetBSD.org/src/rev/c6d5aa110a03
branches:  trunk
changeset: 373153:c6d5aa110a03
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 21 17:48:29 2023 +0000

description:
lint: add test for floating constant overflow

diffstat:

 tests/usr.bin/xlint/lint1/msg_248.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (20 lines):

diff -r 44c19d3ce513 -r c6d5aa110a03 tests/usr.bin/xlint/lint1/msg_248.c
--- a/tests/usr.bin/xlint/lint1/msg_248.c       Sat Jan 21 16:50:05 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_248.c       Sat Jan 21 17:48:29 2023 +0000
@@ -1,8 +1,12 @@
-/*     $NetBSD: msg_248.c,v 1.3 2022/06/16 21:24:41 rillig Exp $       */
+/*     $NetBSD: msg_248.c,v 1.4 2023/01/21 17:48:29 rillig Exp $       */
 # 3 "msg_248.c"
 
 // Test for message: floating-point constant out of range [248]
 
-/* expect+1: error: syntax error ':' [249] */
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+float fits_flt = 1e37f;
+/* expect+1: warning: floating-point constant out of range [248] */
+float too_large_flt = 1e40f;
+
+double fits_dbl = 1e300;
+/* expect+1: warning: floating-point constant out of range [248] */
+double too_large_dbl = 1e310;



Home | Main Index | Thread Index | Old Index