Module Name:    src
Committed By:   rillig
Date:           Fri Jan  3 01:27:36 UTC 2025

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_132.c msg_132_lp64.c

Log Message:
tests/lint: move a platform-specific test

The test failed on i386, as ptrdiff_t fits in a uint32_t after
conversion, thus not generating a warning.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/tests/usr.bin/xlint/lint1/msg_132.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_132_lp64.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_132.c
diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.52 src/tests/usr.bin/xlint/lint1/msg_132.c:1.53
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.52	Thu Jan  2 20:02:59 2025
+++ src/tests/usr.bin/xlint/lint1/msg_132.c	Fri Jan  3 01:27:35 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132.c,v 1.52 2025/01/02 20:02:59 rillig Exp $	*/
+/*	$NetBSD: msg_132.c,v 1.53 2025/01/03 01:27:35 rillig Exp $	*/
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -424,8 +424,6 @@ test_ic_minus(void)
 
 	ptr = ptr - 3;
 	s64 = ptr + 3 - ptr;
-	/* expect+1: warning: conversion from 'long' to 'unsigned int' may lose accuracy [132] */
-	u32 = ptr + 3 - ptr;
 }
 
 void

Index: src/tests/usr.bin/xlint/lint1/msg_132_lp64.c
diff -u src/tests/usr.bin/xlint/lint1/msg_132_lp64.c:1.2 src/tests/usr.bin/xlint/lint1/msg_132_lp64.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_132_lp64.c:1.2	Fri Jul  7 19:45:22 2023
+++ src/tests/usr.bin/xlint/lint1/msg_132_lp64.c	Fri Jan  3 01:27:35 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132_lp64.c,v 1.2 2023/07/07 19:45:22 rillig Exp $	*/
+/*	$NetBSD: msg_132_lp64.c,v 1.3 2025/01/03 01:27:35 rillig Exp $	*/
 # 3 "msg_132_lp64.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -6,9 +6,21 @@
 /* lint1-extra-flags: -a -X 351 */
 /* lint1-only-if: lp64 */
 
+typedef unsigned int u32_t;
+
+u32_t u32;
+const char *ptr;
+
 unsigned int
-convert_pointer_to_smaller_integer(void *ptr)
+convert_pointer_to_smaller_integer(void)
 {
 	/* expect+1: warning: conversion from 'unsigned long' to 'unsigned int' may lose accuracy [132] */
 	return (unsigned long)(ptr) >> 12;
 }
+
+void
+test_ic_minus(void)
+{
+	/* expect+1: warning: conversion from 'long' to 'unsigned int' may lose accuracy [132] */
+	u32 = ptr + 3 - ptr;
+}

Reply via email to