Sat Jul 10 18:42:28 2021 UTC ()
tests/lint: test lexing of integer suffixes


(rillig)
diff -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/lex_integer.c

cvs diff -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/lex_integer.c (expand / switch to unified diff)

--- src/tests/usr.bin/xlint/lint1/lex_integer.c 2021/06/29 13:58:13 1.4
+++ src/tests/usr.bin/xlint/lint1/lex_integer.c 2021/07/10 18:42:28 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lex_integer.c,v 1.4 2021/06/29 13:58:13 rillig Exp $ */ 1/* $NetBSD: lex_integer.c,v 1.5 2021/07/10 18:42:28 rillig Exp $ */
2# 3 "lex_integer.c" 2# 3 "lex_integer.c"
3 3
4/* 4/*
5 * Tests for lexical analysis of integer constants. 5 * Tests for lexical analysis of integer constants.
6 * 6 *
7 * C99 6.4.4.1 "Integer constants" 7 * C99 6.4.4.1 "Integer constants"
8 */ 8 */
9 9
10/* lint1-only-if lp64 */ 10/* lint1-only-if lp64 */
11 11
12void sinki(int); 12void sinki(int);
13void sinku(unsigned int); 13void sinku(unsigned int);
14 14
@@ -33,13 +33,29 @@ test_signed_int(void) @@ -33,13 +33,29 @@ test_signed_int(void)
33} 33}
34 34
35void 35void
36test_unsigned_int(void) 36test_unsigned_int(void)
37{ 37{
38 sinku(0); 38 sinku(0);
39 39
40 sinku(4294967295U); 40 sinku(4294967295U);
41 41
42 /* expect+2: from 'unsigned long' to 'unsigned int' due to prototype */ 42 /* expect+2: from 'unsigned long' to 'unsigned int' due to prototype */
43 /* expect+1: conversion of 'unsigned long' to 'unsigned int' is out of range */ 43 /* expect+1: conversion of 'unsigned long' to 'unsigned int' is out of range */
44 sinku(4294967296U); 44 sinku(4294967296U);
45} 45}
 46
 47void sinkull(unsigned long long);
 48
 49void
 50suffixes(void)
 51{
 52 sinkull(3u);
 53 sinkull(3ll);
 54 sinkull(3llu);
 55 sinkull(3Ull);
 56
 57 /* The 'LL' must not be split. Checked by the compiler. */
 58 sinkull(3lul);
 59 /* The 'Ll' must not used mixed case. Checked by the compiler. */
 60 sinkull(3ULl);
 61}