Module Name:    src
Committed By:   rillig
Date:           Sun Feb 19 12:00:16 UTC 2023

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_218.c
        src/usr.bin/xlint/lint1: lex.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_218.c
cvs rdiff -u -r1.153 -r1.154 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/msg_218.c
diff -u src/tests/usr.bin/xlint/lint1/msg_218.c:1.5 src/tests/usr.bin/xlint/lint1/msg_218.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_218.c:1.5	Sun Feb 19 11:50:29 2023
+++ src/tests/usr.bin/xlint/lint1/msg_218.c	Sun Feb 19 12:00:15 2023
@@ -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 @@ test_signed_int(void)
 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;
 }

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.153 src/usr.bin/xlint/lint1/lex.c:1.154
--- src/usr.bin/xlint/lint1/lex.c:1.153	Sun Feb 19 11:50:29 2023
+++ src/usr.bin/xlint/lint1/lex.c	Sun Feb 19 12:00:15 2023
@@ -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 @@ lex_integer_constant(const char *yytext,
 	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 @@ lex_integer_constant(const char *yytext,
 		}
 		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) {

Reply via email to