Module Name:    src
Committed By:   rillig
Date:           Tue Apr  6 21:44:12 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_121.c msg_121.exp

Log Message:
lint: test what happens for 'int << double'

I just wanted to see whether typeok_shift would be reached in this case,
to ensure that is_uinteger applies as expected.  It does.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_121.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_121.exp

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_121.c
diff -u src/tests/usr.bin/xlint/lint1/msg_121.c:1.3 src/tests/usr.bin/xlint/lint1/msg_121.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_121.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_121.c	Tue Apr  6 21:44:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_121.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_121.c,v 1.4 2021/04/06 21:44:12 rillig Exp $	*/
 # 3 "msg_121.c"
 
 // Test for message: negative shift [121]
@@ -8,3 +8,13 @@ example(int x)
 {
 	return x << (3 - 5);		/* expect: 121 */
 }
+
+void /*ARGSUSED*/
+shift_by_double(int x, double amount)
+{
+	/*
+	 * This is already caught by typeok_scalar, so it doesn't reach
+	 * typeok_shift via typeok_op.
+	 */
+	return x << amount;		/* expect: incompatible types */
+}

Index: src/tests/usr.bin/xlint/lint1/msg_121.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_121.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_121.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_121.exp:1.2	Fri Jan  8 21:25:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_121.exp	Tue Apr  6 21:44:12 2021
@@ -1 +1,2 @@
 msg_121.c(9): warning: negative shift [121]
+msg_121.c(19): error: operands of '<<' have incompatible types (int != double) [107]

Reply via email to