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: do not warn about traditional C mi...
details: https://anonhg.NetBSD.org/src/rev/884a9f0dcfa3
branches: trunk
changeset: 373588:884a9f0dcfa3
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Feb 19 12:00:15 2023 +0000
description:
lint: do not warn about traditional C migration in C99 mode
For large integer constants, the resulting type could differ between
traditional C and C90. In C99 mode, this difference is no longer
relevant since it is too far away from traditional C.
diffstat:
tests/usr.bin/xlint/lint1/msg_218.c | 10 +---------
usr.bin/xlint/lint1/lex.c | 13 ++++---------
2 files changed, 5 insertions(+), 18 deletions(-)
diffs (72 lines):
diff -r e9b816b87fba -r 884a9f0dcfa3 tests/usr.bin/xlint/lint1/msg_218.c
--- a/tests/usr.bin/xlint/lint1/msg_218.c Sun Feb 19 11:50:29 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_218.c Sun Feb 19 12:00:15 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_218.c,v 1.5 2023/02/19 11:50:29 rillig Exp $ */
+/* $NetBSD: msg_218.c,v 1.6 2023/02/19 12:00:15 rillig Exp $ */
# 3 "msg_218.c"
// Test for message: ANSI C treats constant as unsigned, op '%s' [218]
@@ -36,20 +36,12 @@
void
compare_large_constant(void)
{
- /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */
cond = s32 < 3000000000L;
- /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */
cond = 3000000000L < s32;
- /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */
cond = u32 < 3000000000L;
- /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */
cond = 3000000000L < u32;
- /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */
cond = s64 < 3000000000L;
- /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */
cond = 3000000000L < s64;
- /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */
cond = u64 < 3000000000L;
- /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */
cond = 3000000000L < u64;
}
diff -r e9b816b87fba -r 884a9f0dcfa3 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Feb 19 11:50:29 2023 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Feb 19 12:00:15 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.153 2023/02/19 11:50:29 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.154 2023/02/19 12:00:15 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.153 2023/02/19 11:50:29 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.154 2023/02/19 12:00:15 rillig Exp $");
#endif
#include <ctype.h>
@@ -558,8 +558,7 @@
case LONG:
if (uq > TARG_LONG_MAX && allow_c90) {
typ = ULONG;
- /* TODO: C99 behaves like C90 here. */
- if (allow_trad || allow_c99)
+ if (allow_trad)
ansiu = true;
if (uq > TARG_ULONG_MAX && !warned) {
/* integer constant out of range */
@@ -574,12 +573,8 @@
}
break;
case QUAD:
- if (uq > TARG_QUAD_MAX && allow_c90) {
+ if (uq > TARG_QUAD_MAX && allow_c90)
typ = UQUAD;
- /* TODO: C99 behaves like C90 here. */
- if (allow_trad || allow_c99)
- ansiu = true;
- }
break;
case UQUAD:
if (uq > TARG_UQUAD_MAX && !warned) {
Home |
Main Index |
Thread Index |
Old Index