diff --git a/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c b/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c index f82025bc1632..58b02213a305 100644 --- a/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c +++ b/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c @@ -1,4 +1,4 @@ -/* $NetBSD: lex_integer_ilp32.c,v 1.8 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: lex_integer_ilp32.c,v 1.9 2024/01/28 06:57:41 rillig Exp $ */ # 3 "lex_integer_ilp32.c" /* @@ -23,12 +23,11 @@ test_signed_int(void) sinki(2147483647); - /* expect+1: warning: conversion of 'unsigned long' to 'int' is out of range, arg #1 [295] */ + /* expect+1: warning: conversion of 'long long' to 'int' is out of range, arg #1 [295] */ sinki(2147483648); sinki(-2147483647); - /* expect+1: warning: conversion of 'unsigned long' to 'int' is out of range, arg #1 [295] */ sinki(-2147483648); } @@ -43,6 +42,6 @@ test_unsigned_int(void) sinku(2147483648U); sinku(4294967295U); - /* expect+1: warning: integer constant out of range [252] */ + /* expect+1: warning: conversion of 'unsigned long long' to 'unsigned int' is out of range, arg #1 [295] */ sinku(4294967296U); } diff --git a/tests/usr.bin/xlint/lint1/msg_218.c b/tests/usr.bin/xlint/lint1/msg_218.c index b4023dfb12ae..3379e0aab13c 100644 --- a/tests/usr.bin/xlint/lint1/msg_218.c +++ b/tests/usr.bin/xlint/lint1/msg_218.c @@ -1,4 +1,4 @@ -/* $NetBSD: msg_218.c,v 1.9 2023/08/26 10:43:53 rillig Exp $ */ +/* $NetBSD: msg_218.c,v 1.10 2024/01/28 06:57:41 rillig Exp $ */ # 3 "msg_218.c" /* Test for message: C90 treats constant as unsigned, op '%s' [218] */ @@ -20,40 +20,41 @@ void sink_int(int); void test_signed_int(void) { + /* expect+3: warning: integer constant out of range [252] */ /* expect+2: warning: C90 treats constant as unsigned, op '-' [218] */ /* expect+1: warning: conversion of 'unsigned long' to 'int' is out of range, arg #1 [295] */ sink_int(-2147483648); } /* - * In traditional C, integer constants with an 'L' suffix that didn't fit - * into 'long' were promoted to the next larger integer type, if that existed - * at all, as the suffix 'LL' was introduced by C90. - * - * Starting with C90, integer constants with an 'L' suffix that didn't fit - * into 'long' were promoted to 'unsigned long' first, before trying 'long - * long'. - * - * In C99 mode, this distinction is no longer necessary since it is far - * enough from traditional C. + * TODO: Investigate whether the message 218 is actually correct. + * See C1978 2.4.1 "Integer constants" and 6.6 "Arithmetic conversions". */ void compare_large_constant(void) { + /* expect+2: warning: integer constant out of range [252] */ /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = s32 < 3000000000L; + /* expect+2: warning: integer constant out of range [252] */ /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = 3000000000L < s32; + /* expect+2: warning: integer constant out of range [252] */ /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = u32 < 3000000000L; + /* expect+2: warning: integer constant out of range [252] */ /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = 3000000000L < u32; + /* expect+2: warning: integer constant out of range [252] */ /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = s64 < 3000000000L; + /* expect+2: warning: integer constant out of range [252] */ /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = 3000000000L < s64; + /* expect+2: warning: integer constant out of range [252] */ /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = u64 < 3000000000L; + /* expect+2: warning: integer constant out of range [252] */ /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = 3000000000L < u64; }