Module Name:    src
Committed By:   rillig
Date:           Sat Apr 15 12:47:32 UTC 2023

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

Log Message:
tests/lint: add more tests for returning local objects


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_302.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_302.c
diff -u src/tests/usr.bin/xlint/lint1/msg_302.c:1.5 src/tests/usr.bin/xlint/lint1/msg_302.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_302.c:1.5	Sat Apr 15 10:53:59 2023
+++ src/tests/usr.bin/xlint/lint1/msg_302.c	Sat Apr 15 12:47:32 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_302.c,v 1.5 2023/04/15 10:53:59 rillig Exp $	*/
+/*	$NetBSD: msg_302.c,v 1.6 2023/04/15 12:47:32 rillig Exp $	*/
 # 3 "msg_302.c"
 
 // Test for message: '%s' returns pointer to automatic object [302]
@@ -42,6 +42,14 @@ return_local_array(int x)
 	case 5:
 		/* XXX: lint doesn't track this indirection, but Clang-tidy does. */
 		return indirect;
+	case 6:
+		/* expect+1: warning: 'return_local_array' returns pointer to automatic object [302] */
+		return (local);
+	case 7:
+		/* C99 6.5.2.5p6 */
+		/* Neither GCC 10 nor Clang 15 warn about this case. */
+		/* expect+1: warning: 'return_local_array' returns pointer to automatic object [302] */
+		return (char[]){"local string"};
 	default:
 		return "OK";
 	}

Reply via email to