Module Name: src Committed By: rillig Date: Fri Jun 17 06:59:16 UTC 2022
Modified Files: src/tests/usr.bin/xlint: check-expect.lua src/tests/usr.bin/xlint/lint1: msg_300.c msg_300.exp msg_301.c msg_301.exp msg_302.c msg_302.exp msg_306.c msg_306.exp msg_308.c msg_308.exp msg_309.c msg_309.exp msg_310.c msg_310.exp msg_311.c msg_311.exp msg_316.c msg_316.exp msg_318.c msg_318.exp msg_320.c msg_320.exp msg_322.c msg_322.exp msg_324.c msg_324.exp msg_325.c msg_325.exp msg_326.c msg_326.exp msg_327.c msg_327.exp msg_329.c msg_329.exp msg_330.c msg_330.exp msg_331.c msg_331.exp msg_332.c msg_332.exp msg_334.c msg_334.exp msg_335.c msg_335.exp msg_336.c msg_336.exp msg_337.c msg_337.exp msg_338.c msg_338.exp msg_339.c msg_339.exp msg_340.c msg_340.exp msg_343.c msg_343.exp Log Message: tests/lint: add more details to tests from msg_300 until msg_343 To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/xlint/check-expect.lua cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_300.c \ src/tests/usr.bin/xlint/lint1/msg_300.exp \ src/tests/usr.bin/xlint/lint1/msg_301.c \ src/tests/usr.bin/xlint/lint1/msg_301.exp \ src/tests/usr.bin/xlint/lint1/msg_302.c \ src/tests/usr.bin/xlint/lint1/msg_302.exp \ src/tests/usr.bin/xlint/lint1/msg_306.c \ src/tests/usr.bin/xlint/lint1/msg_306.exp \ src/tests/usr.bin/xlint/lint1/msg_310.c \ src/tests/usr.bin/xlint/lint1/msg_310.exp \ src/tests/usr.bin/xlint/lint1/msg_311.c \ src/tests/usr.bin/xlint/lint1/msg_311.exp \ src/tests/usr.bin/xlint/lint1/msg_316.c \ src/tests/usr.bin/xlint/lint1/msg_316.exp \ src/tests/usr.bin/xlint/lint1/msg_318.c \ src/tests/usr.bin/xlint/lint1/msg_318.exp \ src/tests/usr.bin/xlint/lint1/msg_320.c \ src/tests/usr.bin/xlint/lint1/msg_320.exp \ src/tests/usr.bin/xlint/lint1/msg_322.c \ src/tests/usr.bin/xlint/lint1/msg_322.exp \ src/tests/usr.bin/xlint/lint1/msg_325.c \ src/tests/usr.bin/xlint/lint1/msg_325.exp \ src/tests/usr.bin/xlint/lint1/msg_326.c \ src/tests/usr.bin/xlint/lint1/msg_326.exp \ src/tests/usr.bin/xlint/lint1/msg_334.exp \ src/tests/usr.bin/xlint/lint1/msg_335.exp \ src/tests/usr.bin/xlint/lint1/msg_339.c cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_308.c cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_308.exp \ src/tests/usr.bin/xlint/lint1/msg_324.c \ src/tests/usr.bin/xlint/lint1/msg_327.c \ src/tests/usr.bin/xlint/lint1/msg_338.exp \ src/tests/usr.bin/xlint/lint1/msg_343.c \ src/tests/usr.bin/xlint/lint1/msg_343.exp cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_309.c \ src/tests/usr.bin/xlint/lint1/msg_309.exp \ src/tests/usr.bin/xlint/lint1/msg_327.exp \ src/tests/usr.bin/xlint/lint1/msg_329.exp \ src/tests/usr.bin/xlint/lint1/msg_330.c \ src/tests/usr.bin/xlint/lint1/msg_340.exp cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_324.exp \ src/tests/usr.bin/xlint/lint1/msg_329.c \ src/tests/usr.bin/xlint/lint1/msg_330.exp \ src/tests/usr.bin/xlint/lint1/msg_331.c \ src/tests/usr.bin/xlint/lint1/msg_331.exp \ src/tests/usr.bin/xlint/lint1/msg_332.c \ src/tests/usr.bin/xlint/lint1/msg_332.exp \ src/tests/usr.bin/xlint/lint1/msg_336.c \ src/tests/usr.bin/xlint/lint1/msg_336.exp \ src/tests/usr.bin/xlint/lint1/msg_337.c \ src/tests/usr.bin/xlint/lint1/msg_337.exp \ src/tests/usr.bin/xlint/lint1/msg_340.c cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_334.c \ src/tests/usr.bin/xlint/lint1/msg_335.c \ src/tests/usr.bin/xlint/lint1/msg_339.exp cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_338.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/check-expect.lua diff -u src/tests/usr.bin/xlint/check-expect.lua:1.17 src/tests/usr.bin/xlint/check-expect.lua:1.18 --- src/tests/usr.bin/xlint/check-expect.lua:1.17 Thu Jun 16 21:24:41 2022 +++ src/tests/usr.bin/xlint/check-expect.lua Fri Jun 17 06:59:16 2022 @@ -1,5 +1,5 @@ #! /usr/bin/lua --- $NetBSD: check-expect.lua,v 1.17 2022/06/16 21:24:41 rillig Exp $ +-- $NetBSD: check-expect.lua,v 1.18 2022/06/17 06:59:16 rillig Exp $ --[[ @@ -64,7 +64,7 @@ local function load_expect_comments_from -- only the raw message ID, without the actual message text, -- which makes them harder to understand without looking up more context. for comment in line:gmatch("/%* expect: (.-) %*/") do - if not fname:match("^msg_[012]") then + if not fname:match("^msg_") then add_expectation(0, comment) end end Index: src/tests/usr.bin/xlint/lint1/msg_300.c diff -u src/tests/usr.bin/xlint/lint1/msg_300.c:1.2 src/tests/usr.bin/xlint/lint1/msg_300.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_300.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_300.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,16 @@ -/* $NetBSD: msg_300.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_300.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_300.c" -// Test for message: old style definition [300] +/* Test for message: old style definition [300] */ -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -wr */ + +/* expect+1: old style definition [300] */ +old_style(x) + double x; +{ + return x > 0.0; +} + +/* expect+1: error: prototype does not match old style definition, arg #1 [299] */ +void old_style(char ch); Index: src/tests/usr.bin/xlint/lint1/msg_300.exp diff -u src/tests/usr.bin/xlint/lint1/msg_300.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_300.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_300.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_300.exp Fri Jun 17 06:59:16 2022 @@ -1 +1,2 @@ -msg_300.c(6): error: syntax error ':' [249] +msg_300.c(16): error: prototype does not match old style definition, arg #1 [299] +msg_300.c(9): old style definition [300] Index: src/tests/usr.bin/xlint/lint1/msg_301.c diff -u src/tests/usr.bin/xlint/lint1/msg_301.c:1.2 src/tests/usr.bin/xlint/lint1/msg_301.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_301.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_301.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,15 @@ -/* $NetBSD: msg_301.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_301.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_301.c" // Test for message: array of incomplete type [301] +// This message is not used. +// TODO: This message occurs in the code but is deactivated. -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+1: warning: struct 'incomplete' never defined [233] */ +struct incomplete; + +/* expect+1: error: 'var' has incomplete type 'incomplete struct incomplete' [31] */ +struct incomplete var[3]; + +/* expect+1: error: cannot take size/alignment of incomplete type [143] */ +unsigned long sizeof_3 = sizeof(struct incomplete[3]); Index: src/tests/usr.bin/xlint/lint1/msg_301.exp diff -u src/tests/usr.bin/xlint/lint1/msg_301.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_301.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_301.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_301.exp Fri Jun 17 06:59:16 2022 @@ -1 +1,3 @@ -msg_301.c(6): error: syntax error ':' [249] +msg_301.c(15): error: cannot take size/alignment of incomplete type [143] +msg_301.c(9): warning: struct 'incomplete' never defined [233] +msg_301.c(12): error: 'var' has incomplete type 'incomplete struct incomplete' [31] Index: src/tests/usr.bin/xlint/lint1/msg_302.c diff -u src/tests/usr.bin/xlint/lint1/msg_302.c:1.2 src/tests/usr.bin/xlint/lint1/msg_302.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_302.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_302.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,40 @@ -/* $NetBSD: msg_302.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_302.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_302.c" // Test for message: %s returns pointer to automatic object [302] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +void * +return_arg(int arg) +{ + /* expect+1: warning: return_arg returns pointer to automatic object [302] */ + return &arg; +} + +void * +return_local(void) +{ + int local = 3; + /* expect+1: warning: return_local returns pointer to automatic object [302] */ + return &local; +} + +void * +return_local_array(_Bool cond) +{ + int local[5]; + int *p = local; + + /* XXX: lint doesn't track this indirection, but Clang-tidy does. */ + if (cond) + return p; + + /* expect+1: warning: return_local_array returns pointer to automatic object [302] */ + return local + 5; +} + +void * +return_static(void) +{ + static int long_lived = 3; + return &long_lived; +} Index: src/tests/usr.bin/xlint/lint1/msg_302.exp diff -u src/tests/usr.bin/xlint/lint1/msg_302.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_302.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_302.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_302.exp Fri Jun 17 06:59:16 2022 @@ -1 +1,3 @@ -msg_302.c(6): error: syntax error ':' [249] +msg_302.c(10): warning: return_arg returns pointer to automatic object [302] +msg_302.c(18): warning: return_local returns pointer to automatic object [302] +msg_302.c(32): warning: return_local_array returns pointer to automatic object [302] Index: src/tests/usr.bin/xlint/lint1/msg_306.c diff -u src/tests/usr.bin/xlint/lint1/msg_306.c:1.2 src/tests/usr.bin/xlint/lint1/msg_306.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_306.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_306.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,30 @@ -/* $NetBSD: msg_306.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_306.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_306.c" // Test for message: constant truncated by conversion, op %s [306] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +unsigned char +to_u8(void) +{ + /* expect+1: warning: conversion of 'int' to 'unsigned char' is out of range [119] */ + return 12345; +} + +unsigned char +and_u8(unsigned char a) +{ + /* XXX: unused bits in constant */ + return a & 0x1234; +} + +unsigned char +or_u8(unsigned char a) +{ + /* expect+1: warning: constant truncated by conversion, op |= [306] */ + a |= 0x1234; + + /* XXX: Lint doesn't care about the expanded form of the same code. */ + a = a | 0x1234; + + return a; +} Index: src/tests/usr.bin/xlint/lint1/msg_306.exp diff -u src/tests/usr.bin/xlint/lint1/msg_306.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_306.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_306.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_306.exp Fri Jun 17 06:59:16 2022 @@ -1 +1,2 @@ -msg_306.c(6): error: syntax error ':' [249] +msg_306.c(10): warning: conversion of 'int' to 'unsigned char' is out of range [119] +msg_306.c(24): warning: constant truncated by conversion, op |= [306] Index: src/tests/usr.bin/xlint/lint1/msg_310.c diff -u src/tests/usr.bin/xlint/lint1/msg_310.c:1.2 src/tests/usr.bin/xlint/lint1/msg_310.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_310.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_310.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,14 @@ -/* $NetBSD: msg_310.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_310.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_310.c" // Test for message: symbol renaming can't be used on function arguments [310] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +/* expect+2: warning: argument 'callback' unused in function 'function' [231] */ +void +function(int (*callback)(void) __symbolrename(argument)) +{ +} + +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_310.exp diff -u src/tests/usr.bin/xlint/lint1/msg_310.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_310.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_310.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_310.exp Fri Jun 17 06:59:16 2022 @@ -1 +1,2 @@ -msg_310.c(6): error: syntax error ':' [249] +msg_310.c(8): warning: argument 'callback' unused in function 'function' [231] +msg_310.c(13): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_311.c diff -u src/tests/usr.bin/xlint/lint1/msg_311.c:1.2 src/tests/usr.bin/xlint/lint1/msg_311.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_311.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_311.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,19 @@ -/* $NetBSD: msg_311.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_311.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_311.c" // Test for message: symbol renaming can't be used on automatic variables [311] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +typedef int (*callback)(void); + +callback +example(void) +{ + int (*func)(void) __symbolrename(function); + + func = (void *)0; + return func; +} + +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_311.exp diff -u src/tests/usr.bin/xlint/lint1/msg_311.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_311.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_311.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_311.exp Fri Jun 17 06:59:16 2022 @@ -1 +1 @@ -msg_311.c(6): error: syntax error ':' [249] +msg_311.c(18): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_316.c diff -u src/tests/usr.bin/xlint/lint1/msg_316.c:1.2 src/tests/usr.bin/xlint/lint1/msg_316.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_316.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_316.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,16 @@ -/* $NetBSD: msg_316.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_316.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_316.c" // Test for message: __FUNCTION__/__PRETTY_FUNCTION__ is a GCC extension [316] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -Sw */ + +void println(const char *); + +void debug(void) +{ + /* expect+1: warning: __FUNCTION__/__PRETTY_FUNCTION__ is a GCC extension [316] */ + println(__FUNCTION__); + /* expect+1: warning: __FUNCTION__/__PRETTY_FUNCTION__ is a GCC extension [316] */ + println(__PRETTY_FUNCTION__); +} Index: src/tests/usr.bin/xlint/lint1/msg_316.exp diff -u src/tests/usr.bin/xlint/lint1/msg_316.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_316.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_316.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_316.exp Fri Jun 17 06:59:16 2022 @@ -1 +1,2 @@ -msg_316.c(6): error: syntax error ':' [249] +msg_316.c(13): warning: __FUNCTION__/__PRETTY_FUNCTION__ is a GCC extension [316] +msg_316.c(15): warning: __FUNCTION__/__PRETTY_FUNCTION__ is a GCC extension [316] Index: src/tests/usr.bin/xlint/lint1/msg_318.c diff -u src/tests/usr.bin/xlint/lint1/msg_318.c:1.2 src/tests/usr.bin/xlint/lint1/msg_318.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_318.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_318.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,20 @@ -/* $NetBSD: msg_318.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_318.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_318.c" // Test for message: variable array dimension is a C99/GCC extension [318] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +/* lint1-flags: -Sw */ + +unsigned long +example(int n) +{ + unsigned long arr[n]; + + arr[n - 1] = '\0'; + arr[0] = sizeof(unsigned long[n]); + return arr[n - 1]; +} + +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_318.exp diff -u src/tests/usr.bin/xlint/lint1/msg_318.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_318.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_318.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_318.exp Fri Jun 17 06:59:16 2022 @@ -1 +1 @@ -msg_318.c(6): error: syntax error ':' [249] +msg_318.c(19): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_320.c diff -u src/tests/usr.bin/xlint/lint1/msg_320.c:1.2 src/tests/usr.bin/xlint/lint1/msg_320.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_320.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_320.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,17 @@ -/* $NetBSD: msg_320.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_320.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_320.c" // Test for message: ({ }) is a GCC extension [320] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -Sw */ + +int +example(void) +{ + return ({ + int base = 10; + int square = base * base; + square * base; + }); + /* expect-1: warning: ({ }) is a GCC extension [320] */ +} Index: src/tests/usr.bin/xlint/lint1/msg_320.exp diff -u src/tests/usr.bin/xlint/lint1/msg_320.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_320.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_320.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_320.exp Fri Jun 17 06:59:16 2022 @@ -1 +1 @@ -msg_320.c(6): error: syntax error ':' [249] +msg_320.c(15): warning: ({ }) is a GCC extension [320] Index: src/tests/usr.bin/xlint/lint1/msg_322.c diff -u src/tests/usr.bin/xlint/lint1/msg_322.c:1.2 src/tests/usr.bin/xlint/lint1/msg_322.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_322.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_322.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,9 @@ -/* $NetBSD: msg_322.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_322.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_322.c" -// Test for message: zero sized array is a C99 extension [322] +/* Test for message: zero sized array is a C99 extension [322] */ -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -sw */ + +/* expect+1: error: zero sized array is a C99 extension [322] */ +typedef int empty_array[0]; Index: src/tests/usr.bin/xlint/lint1/msg_322.exp diff -u src/tests/usr.bin/xlint/lint1/msg_322.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_322.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_322.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_322.exp Fri Jun 17 06:59:16 2022 @@ -1 +1 @@ -msg_322.c(6): error: syntax error ':' [249] +msg_322.c(9): error: zero sized array is a C99 extension [322] Index: src/tests/usr.bin/xlint/lint1/msg_325.c diff -u src/tests/usr.bin/xlint/lint1/msg_325.c:1.2 src/tests/usr.bin/xlint/lint1/msg_325.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_325.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_325.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,15 @@ -/* $NetBSD: msg_325.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_325.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_325.c" -// Test for message: variable declaration in for loop [325] +/* Test for message: variable declaration in for loop [325] */ -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -sw */ + +int printf(const char *, ...); + +void example(void) +{ + /* expect+1: error: variable declaration in for loop [325] */ + for (int i = 0; i < 10; i++) + printf("%d\n", i); +} Index: src/tests/usr.bin/xlint/lint1/msg_325.exp diff -u src/tests/usr.bin/xlint/lint1/msg_325.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_325.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_325.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_325.exp Fri Jun 17 06:59:16 2022 @@ -1 +1 @@ -msg_325.c(6): error: syntax error ':' [249] +msg_325.c(13): error: variable declaration in for loop [325] Index: src/tests/usr.bin/xlint/lint1/msg_326.c diff -u src/tests/usr.bin/xlint/lint1/msg_326.c:1.2 src/tests/usr.bin/xlint/lint1/msg_326.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_326.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_326.c Fri Jun 17 06:59:16 2022 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_326.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_326.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_326.c" // Test for message: %s attribute ignored for %s [326] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+1: warning: packed attribute ignored for int [326] */ +int variable __packed; Index: src/tests/usr.bin/xlint/lint1/msg_326.exp diff -u src/tests/usr.bin/xlint/lint1/msg_326.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_326.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_326.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_326.exp Fri Jun 17 06:59:16 2022 @@ -1 +1 @@ -msg_326.c(6): error: syntax error ':' [249] +msg_326.c(7): warning: packed attribute ignored for int [326] Index: src/tests/usr.bin/xlint/lint1/msg_334.exp diff -u src/tests/usr.bin/xlint/lint1/msg_334.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_334.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_334.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_334.exp Fri Jun 17 06:59:16 2022 @@ -1,2 +1,2 @@ -msg_334.c(21): error: argument #1 expects '_Bool', gets passed 'int' [334] -msg_334.c(22): error: argument #1 expects 'int', gets passed '_Bool' [334] +msg_334.c(23): error: argument #1 expects '_Bool', gets passed 'int' [334] +msg_334.c(26): error: argument #1 expects 'int', gets passed '_Bool' [334] Index: src/tests/usr.bin/xlint/lint1/msg_335.exp diff -u src/tests/usr.bin/xlint/lint1/msg_335.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_335.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_335.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_335.exp Fri Jun 17 06:59:16 2022 @@ -1,6 +1,6 @@ -msg_335.c(15): error: operand of '+' must not be bool [335] -msg_335.c(16): error: operand of '-' must not be bool [335] -msg_335.c(18): error: operand of 'x++' must not be bool [335] -msg_335.c(19): error: operand of '++x' must not be bool [335] -msg_335.c(20): error: operand of 'x--' must not be bool [335] -msg_335.c(21): error: operand of '--x' must not be bool [335] +msg_335.c(16): error: operand of '+' must not be bool [335] +msg_335.c(19): error: operand of '-' must not be bool [335] +msg_335.c(24): error: operand of 'x++' must not be bool [335] +msg_335.c(27): error: operand of '++x' must not be bool [335] +msg_335.c(30): error: operand of 'x--' must not be bool [335] +msg_335.c(33): error: operand of '--x' must not be bool [335] Index: src/tests/usr.bin/xlint/lint1/msg_339.c diff -u src/tests/usr.bin/xlint/lint1/msg_339.c:1.2 src/tests/usr.bin/xlint/lint1/msg_339.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_339.c:1.2 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_339.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_339.c,v 1.2 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_339.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_339.c" // Test for message: option '%c' should be listed in the options string [339] @@ -11,7 +11,9 @@ main(int argc, char **argv) { int o; - while ((o = getopt(argc, argv, "a:bc:d")) != -1) { /* expect: 338 *//* expect: 338 */ + /* expect+2: warning: option 'c' should be handled in the switch [338] */ + /* expect+1: warning: option 'd' should be handled in the switch [338] */ + while ((o = getopt(argc, argv, "a:bc:d")) != -1) { switch (o) { case 'a': break; @@ -23,9 +25,11 @@ main(int argc, char **argv) while (optarg[0] != '\0') optarg++; break; - case 'e': /* expect: option 'e' should be listed */ + case 'e': + /* expect-1: warning: option 'e' should be listed in the options string [339] */ break; - case 'f': /* expect: option 'f' should be listed */ + case 'f': + /* expect-1: warning: option 'f' should be listed in the options string [339] */ /* * The case labels in nested switch statements are * ignored by the check for getopt options. Index: src/tests/usr.bin/xlint/lint1/msg_308.c diff -u src/tests/usr.bin/xlint/lint1/msg_308.c:1.6 src/tests/usr.bin/xlint/lint1/msg_308.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_308.c:1.6 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_308.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_308.c,v 1.6 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_308.c,v 1.7 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_308.c" // Test for message: invalid type for _Complex [308] @@ -6,5 +6,10 @@ float _Complex float_complex; double _Complex double_complex; long double _Complex long_double_complex; -_Complex plain_complex; /* expect: 308 */ -int _Complex int_complex; /* expect: 308 *//* expect: 4 */ + +/* expect+1: error: invalid type for _Complex [308] */ +_Complex plain_complex; + +/* expect+2: error: invalid type for _Complex [308] */ +/* expect+1: error: illegal type combination [4] */ +int _Complex int_complex; Index: src/tests/usr.bin/xlint/lint1/msg_308.exp diff -u src/tests/usr.bin/xlint/lint1/msg_308.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_308.exp:1.6 --- src/tests/usr.bin/xlint/lint1/msg_308.exp:1.5 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_308.exp Fri Jun 17 06:59:16 2022 @@ -1,3 +1,3 @@ -msg_308.c(9): error: invalid type for _Complex [308] -msg_308.c(10): error: invalid type for _Complex [308] -msg_308.c(10): error: illegal type combination [4] +msg_308.c(11): error: invalid type for _Complex [308] +msg_308.c(15): error: invalid type for _Complex [308] +msg_308.c(15): error: illegal type combination [4] Index: src/tests/usr.bin/xlint/lint1/msg_324.c diff -u src/tests/usr.bin/xlint/lint1/msg_324.c:1.5 src/tests/usr.bin/xlint/lint1/msg_324.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_324.c:1.5 Sun Jan 31 11:12:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_324.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_324.c,v 1.5 2021/01/31 11:12:07 rillig Exp $ */ +/* $NetBSD: msg_324.c,v 1.6 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_324.c" // Test for message: suggest cast from '%s' to '%s' on op %s to avoid overflow [324] @@ -22,13 +22,20 @@ example(char c, int i, unsigned u) long long ll; unsigned long long ull; - ll = c + i; /* expect: 324 */ - ll = i - c; /* expect: 324 */ - ull = c * u; /* expect: 324 */ - ull = u + c; /* expect: 324 */ - ull = i - u; /* expect: 324 */ - ull = u * i; /* expect: 324 */ - ll = i << c; /* expect: 324 */ + /* expect+1: warning: suggest cast from 'int' to 'long long' on op + to avoid overflow [324] */ + ll = c + i; + /* expect+1: warning: suggest cast from 'int' to 'long long' on op - to avoid overflow [324] */ + ll = i - c; + /* expect+1: warning: suggest cast from 'unsigned int' to 'unsigned long long' on op * to avoid overflow [324] */ + ull = c * u; + /* expect+1: warning: suggest cast from 'unsigned int' to 'unsigned long long' on op + to avoid overflow [324] */ + ull = u + c; + /* expect+1: warning: suggest cast from 'unsigned int' to 'unsigned long long' on op - to avoid overflow [324] */ + ull = i - u; + /* expect+1: warning: suggest cast from 'unsigned int' to 'unsigned long long' on op * to avoid overflow [324] */ + ull = u * i; + /* expect+1: warning: suggest cast from 'int' to 'long long' on op << to avoid overflow [324] */ + ll = i << c; /* * The operators SHR, DIV and MOD cannot produce an overflow, Index: src/tests/usr.bin/xlint/lint1/msg_327.c diff -u src/tests/usr.bin/xlint/lint1/msg_327.c:1.5 src/tests/usr.bin/xlint/lint1/msg_327.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_327.c:1.5 Sat Mar 20 15:28:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_327.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_327.c,v 1.5 2021/03/20 15:28:07 rillig Exp $ */ +/* $NetBSD: msg_327.c,v 1.6 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_327.c" /* Test for message: declarations after statements is a C99 feature [327] */ @@ -12,9 +12,12 @@ void example(void) { statement(); - int declaration_1; /* expect: 327 */ + /* expect+1: warning: declarations after statements is a C99 feature [327] */ + int declaration_1; statement(); - int declaration_2; /* expect: 327 */ + /* expect+1: warning: declarations after statements is a C99 feature [327] */ + int declaration_2; statement(); - int declaration_3; /* expect: 327 */ + /* expect+1: warning: declarations after statements is a C99 feature [327] */ + int declaration_3; } Index: src/tests/usr.bin/xlint/lint1/msg_338.exp diff -u src/tests/usr.bin/xlint/lint1/msg_338.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_338.exp:1.6 --- src/tests/usr.bin/xlint/lint1/msg_338.exp:1.5 Sat Oct 9 14:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_338.exp Fri Jun 17 06:59:16 2022 @@ -1,8 +1,8 @@ -msg_338.c(26): warning: option 'e' should be listed in the options string [339] -msg_338.c(28): warning: option 'f' should be listed in the options string [339] -msg_338.c(14): warning: option 'c' should be handled in the switch [338] -msg_338.c(14): warning: option 'd' should be handled in the switch [338] -msg_338.c(94): warning: option 'o' should be handled in the switch [338] -msg_338.c(116): warning: option 'o' should be handled in the switch [338] -msg_338.c(145): warning: option ':' should be listed in the options string [339] -msg_338.c(142): warning: option 'b' should be handled in the switch [338] +msg_338.c(28): warning: option 'e' should be listed in the options string [339] +msg_338.c(31): warning: option 'f' should be listed in the options string [339] +msg_338.c(16): warning: option 'c' should be handled in the switch [338] +msg_338.c(16): warning: option 'd' should be handled in the switch [338] +msg_338.c(98): warning: option 'o' should be handled in the switch [338] +msg_338.c(120): warning: option 'o' should be handled in the switch [338] +msg_338.c(149): warning: option ':' should be listed in the options string [339] +msg_338.c(146): warning: option 'b' should be handled in the switch [338] Index: src/tests/usr.bin/xlint/lint1/msg_343.c diff -u src/tests/usr.bin/xlint/lint1/msg_343.c:1.5 src/tests/usr.bin/xlint/lint1/msg_343.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_343.c:1.5 Thu Jul 15 21:00:05 2021 +++ src/tests/usr.bin/xlint/lint1/msg_343.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_343.c,v 1.5 2021/07/15 21:00:05 rillig Exp $ */ +/* $NetBSD: msg_343.c,v 1.6 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_343.c" /* Test for message: static array size is a C11 extension [343] */ @@ -7,7 +7,8 @@ void takes_int_pointer(int []); void takes_int_pointer_with_ignored_size(int [3]); -void takes_int_array(int[static 3]); /* expect: 343 */ +/* expect+1: error: static array size is a C11 extension [343] */ +void takes_int_array(int[static 3]); /* expect+1: syntax error '3' */ void takes_volatile_int_array(int[volatile 3]); @@ -24,7 +25,8 @@ returns_int_pointer_with_ignored_size(in } int -returns_int_array(int a[static 3]) /* expect: 343 */ +/* expect+1: error: static array size is a C11 extension [343] */ +returns_int_array(int a[static 3]) { return a[0]; } Index: src/tests/usr.bin/xlint/lint1/msg_343.exp diff -u src/tests/usr.bin/xlint/lint1/msg_343.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_343.exp:1.6 --- src/tests/usr.bin/xlint/lint1/msg_343.exp:1.5 Tue Aug 3 18:44:33 2021 +++ src/tests/usr.bin/xlint/lint1/msg_343.exp Fri Jun 17 06:59:16 2022 @@ -1,8 +1,8 @@ -msg_343.c(10): error: static array size is a C11 extension [343] -msg_343.c(12): error: syntax error '3' [249] -msg_343.c(27): error: static array size is a C11 extension [343] -msg_343.c(34): error: syntax error '3' [249] -msg_343.c(38): error: cannot dereference non-pointer type [96] -msg_343.c(38): warning: function 'returns_volatile_int_array' expects to return value [214] -msg_343.c(47): error: syntax error ']' [249] -msg_343.c(47): error: static array size is a C11 extension [343] +msg_343.c(11): error: static array size is a C11 extension [343] +msg_343.c(13): error: syntax error '3' [249] +msg_343.c(29): error: static array size is a C11 extension [343] +msg_343.c(36): error: syntax error '3' [249] +msg_343.c(40): error: cannot dereference non-pointer type [96] +msg_343.c(40): warning: function 'returns_volatile_int_array' expects to return value [214] +msg_343.c(49): error: syntax error ']' [249] +msg_343.c(49): error: static array size is a C11 extension [343] Index: src/tests/usr.bin/xlint/lint1/msg_309.c diff -u src/tests/usr.bin/xlint/lint1/msg_309.c:1.4 src/tests/usr.bin/xlint/lint1/msg_309.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_309.c:1.4 Sun May 16 10:18:25 2021 +++ src/tests/usr.bin/xlint/lint1/msg_309.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_309.c,v 1.4 2021/05/16 10:18:25 rillig Exp $ */ +/* $NetBSD: msg_309.c,v 1.5 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_309.c" // Test for message: extra bits set to 0 in conversion of '%s' to '%s', op '%s' [309] @@ -20,7 +20,8 @@ scale(unsigned long long x) { * bit mask here. This situation may occur during migration from a * 32-bit to a 64-bit platform. */ - if ((x & 0xffff0000) != 0) /* expect: 309 */ + /* expect+1: warning: extra bits set to 0 in conversion of 'unsigned int' to 'unsigned long long', op '&' [309] */ + if ((x & 0xffff0000) != 0) return 16; /* Index: src/tests/usr.bin/xlint/lint1/msg_309.exp diff -u src/tests/usr.bin/xlint/lint1/msg_309.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_309.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_309.exp:1.4 Sun May 16 10:18:25 2021 +++ src/tests/usr.bin/xlint/lint1/msg_309.exp Fri Jun 17 06:59:16 2022 @@ -1 +1 @@ -msg_309.c(23): warning: extra bits set to 0 in conversion of 'unsigned int' to 'unsigned long long', op '&' [309] +msg_309.c(24): warning: extra bits set to 0 in conversion of 'unsigned int' to 'unsigned long long', op '&' [309] Index: src/tests/usr.bin/xlint/lint1/msg_327.exp diff -u src/tests/usr.bin/xlint/lint1/msg_327.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_327.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_327.exp:1.4 Sat Mar 20 15:28:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_327.exp Fri Jun 17 06:59:16 2022 @@ -1,3 +1,3 @@ -msg_327.c(15): warning: declarations after statements is a C99 feature [327] -msg_327.c(17): warning: declarations after statements is a C99 feature [327] +msg_327.c(16): warning: declarations after statements is a C99 feature [327] msg_327.c(19): warning: declarations after statements is a C99 feature [327] +msg_327.c(22): warning: declarations after statements is a C99 feature [327] Index: src/tests/usr.bin/xlint/lint1/msg_329.exp diff -u src/tests/usr.bin/xlint/lint1/msg_329.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_329.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_329.exp:1.4 Tue Aug 3 20:57:06 2021 +++ src/tests/usr.bin/xlint/lint1/msg_329.exp Fri Jun 17 06:59:16 2022 @@ -1 +1 @@ -msg_329.c(36): error: type 'pointer to char' is not a member of 'union u' [329] +msg_329.c(37): error: type 'pointer to char' is not a member of 'union u' [329] Index: src/tests/usr.bin/xlint/lint1/msg_330.c diff -u src/tests/usr.bin/xlint/lint1/msg_330.c:1.4 src/tests/usr.bin/xlint/lint1/msg_330.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_330.c:1.4 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_330.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_330.c,v 1.4 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_330.c,v 1.5 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_330.c" // Test for message: operand of '%s' must be bool, not '%s' [330] @@ -17,6 +17,12 @@ void example(bool b, char c, int i) { called(!b); - called(!c); /* expect: 330 *//* expect: 334 */ - called(!i); /* expect: 330 *//* expect: 334 */ + + /* expect+2: error: operand of '!' must be bool, not 'char' [330] */ + /* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */ + called(!c); + + /* expect+2: error: operand of '!' must be bool, not 'int' [330] */ + /* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */ + called(!i); } Index: src/tests/usr.bin/xlint/lint1/msg_340.exp diff -u src/tests/usr.bin/xlint/lint1/msg_340.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_340.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_340.exp:1.4 Sat Apr 16 13:25:27 2022 +++ src/tests/usr.bin/xlint/lint1/msg_340.exp Fri Jun 17 06:59:16 2022 @@ -1 +1 @@ -msg_340.c(16): warning: initialization with '[a...b]' is a GCC extension [340] +msg_340.c(17): warning: initialization with '[a...b]' is a GCC extension [340] Index: src/tests/usr.bin/xlint/lint1/msg_324.exp diff -u src/tests/usr.bin/xlint/lint1/msg_324.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_324.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_324.exp:1.3 Wed Jan 6 09:23:04 2021 +++ src/tests/usr.bin/xlint/lint1/msg_324.exp Fri Jun 17 06:59:16 2022 @@ -1,7 +1,7 @@ -msg_324.c(25): warning: suggest cast from 'int' to 'long long' on op + to avoid overflow [324] -msg_324.c(26): warning: suggest cast from 'int' to 'long long' on op - to avoid overflow [324] -msg_324.c(27): warning: suggest cast from 'unsigned int' to 'unsigned long long' on op * to avoid overflow [324] -msg_324.c(28): warning: suggest cast from 'unsigned int' to 'unsigned long long' on op + to avoid overflow [324] -msg_324.c(29): warning: suggest cast from 'unsigned int' to 'unsigned long long' on op - to avoid overflow [324] +msg_324.c(26): warning: suggest cast from 'int' to 'long long' on op + to avoid overflow [324] +msg_324.c(28): warning: suggest cast from 'int' to 'long long' on op - to avoid overflow [324] msg_324.c(30): warning: suggest cast from 'unsigned int' to 'unsigned long long' on op * to avoid overflow [324] -msg_324.c(31): warning: suggest cast from 'int' to 'long long' on op << to avoid overflow [324] +msg_324.c(32): warning: suggest cast from 'unsigned int' to 'unsigned long long' on op + to avoid overflow [324] +msg_324.c(34): warning: suggest cast from 'unsigned int' to 'unsigned long long' on op - to avoid overflow [324] +msg_324.c(36): warning: suggest cast from 'unsigned int' to 'unsigned long long' on op * to avoid overflow [324] +msg_324.c(38): warning: suggest cast from 'int' to 'long long' on op << to avoid overflow [324] Index: src/tests/usr.bin/xlint/lint1/msg_329.c diff -u src/tests/usr.bin/xlint/lint1/msg_329.c:1.3 src/tests/usr.bin/xlint/lint1/msg_329.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_329.c:1.3 Tue Aug 3 20:57:06 2021 +++ src/tests/usr.bin/xlint/lint1/msg_329.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_329.c,v 1.3 2021/08/03 20:57:06 rillig Exp $ */ +/* $NetBSD: msg_329.c,v 1.4 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_329.c" // Test for message: type '%s' is not a member of '%s' [329] @@ -33,5 +33,6 @@ example(void) */ union u u_i1 = (union u)3; union u u_vp = (union u)(void *)0; - union u u_cp = (union u)(char *)0; /* expect: 329 */ + /* expect+1: error: type 'pointer to char' is not a member of 'union u' [329] */ + union u u_cp = (union u)(char *)0; } Index: src/tests/usr.bin/xlint/lint1/msg_330.exp diff -u src/tests/usr.bin/xlint/lint1/msg_330.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_330.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_330.exp:1.3 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_330.exp Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -msg_330.c(20): error: operand of '!' must be bool, not 'char' [330] -msg_330.c(20): error: argument #1 expects '_Bool', gets passed 'int' [334] -msg_330.c(21): error: operand of '!' must be bool, not 'int' [330] -msg_330.c(21): error: argument #1 expects '_Bool', gets passed 'int' [334] +msg_330.c(23): error: operand of '!' must be bool, not 'char' [330] +msg_330.c(23): error: argument #1 expects '_Bool', gets passed 'int' [334] +msg_330.c(27): error: operand of '!' must be bool, not 'int' [330] +msg_330.c(27): error: argument #1 expects '_Bool', gets passed 'int' [334] Index: src/tests/usr.bin/xlint/lint1/msg_331.c diff -u src/tests/usr.bin/xlint/lint1/msg_331.c:1.3 src/tests/usr.bin/xlint/lint1/msg_331.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_331.c:1.3 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_331.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_331.c,v 1.3 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_331.c,v 1.4 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_331.c" // Test for message: left operand of '%s' must be bool, not '%s' [331] @@ -16,8 +16,14 @@ void example(bool b, char c, int i) { test(b && b); - test(c && b); /* expect: 331 *//* expect: 334 */ - test(i && b); /* expect: 331 *//* expect: 334 */ + + /* expect+2: error: left operand of '&&' must be bool, not 'char' [331] */ + /* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */ + test(c && b); + + /* expect+2: error: left operand of '&&' must be bool, not 'int' [331] */ + /* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */ + test(i && b); test(c != '\0'); test(i != 0); Index: src/tests/usr.bin/xlint/lint1/msg_331.exp diff -u src/tests/usr.bin/xlint/lint1/msg_331.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_331.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_331.exp:1.3 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_331.exp Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -msg_331.c(19): error: left operand of '&&' must be bool, not 'char' [331] -msg_331.c(19): error: argument #1 expects '_Bool', gets passed 'int' [334] -msg_331.c(20): error: left operand of '&&' must be bool, not 'int' [331] -msg_331.c(20): error: argument #1 expects '_Bool', gets passed 'int' [334] +msg_331.c(22): error: left operand of '&&' must be bool, not 'char' [331] +msg_331.c(22): error: argument #1 expects '_Bool', gets passed 'int' [334] +msg_331.c(26): error: left operand of '&&' must be bool, not 'int' [331] +msg_331.c(26): error: argument #1 expects '_Bool', gets passed 'int' [334] Index: src/tests/usr.bin/xlint/lint1/msg_332.c diff -u src/tests/usr.bin/xlint/lint1/msg_332.c:1.3 src/tests/usr.bin/xlint/lint1/msg_332.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_332.c:1.3 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_332.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_332.c,v 1.3 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_332.c,v 1.4 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_332.c" // Test for message: right operand of '%s' must be bool, not '%s' [332] @@ -16,8 +16,14 @@ void example(bool b, char c, int i) { test(b && b); - test(b && c); /* expect: 332 *//* expect: 334 */ - test(b && i); /* expect: 332 *//* expect: 334 */ + + /* expect+2: error: right operand of '&&' must be bool, not 'char' [332] */ + /* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */ + test(b && c); + + /* expect+2: error: right operand of '&&' must be bool, not 'int' [332] */ + /* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */ + test(b && i); test(c != '\0'); test(i != 0); Index: src/tests/usr.bin/xlint/lint1/msg_332.exp diff -u src/tests/usr.bin/xlint/lint1/msg_332.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_332.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_332.exp:1.3 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_332.exp Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -msg_332.c(19): error: right operand of '&&' must be bool, not 'char' [332] -msg_332.c(19): error: argument #1 expects '_Bool', gets passed 'int' [334] -msg_332.c(20): error: right operand of '&&' must be bool, not 'int' [332] -msg_332.c(20): error: argument #1 expects '_Bool', gets passed 'int' [334] +msg_332.c(22): error: right operand of '&&' must be bool, not 'char' [332] +msg_332.c(22): error: argument #1 expects '_Bool', gets passed 'int' [334] +msg_332.c(26): error: right operand of '&&' must be bool, not 'int' [332] +msg_332.c(26): error: argument #1 expects '_Bool', gets passed 'int' [334] Index: src/tests/usr.bin/xlint/lint1/msg_336.c diff -u src/tests/usr.bin/xlint/lint1/msg_336.c:1.3 src/tests/usr.bin/xlint/lint1/msg_336.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_336.c:1.3 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_336.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_336.c,v 1.3 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_336.c,v 1.4 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_336.c" // Test for message: left operand of '%s' must not be bool [336] @@ -15,7 +15,11 @@ test(bool); void example(bool b, int i) { - test(b + i); /* expect: 336 *//* expect: 334 */ + /* expect+2: error: left operand of '+' must not be bool [336] */ + /* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */ + test(b + i); + test(b); + test(i != 0); } Index: src/tests/usr.bin/xlint/lint1/msg_336.exp diff -u src/tests/usr.bin/xlint/lint1/msg_336.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_336.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_336.exp:1.3 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_336.exp Fri Jun 17 06:59:16 2022 @@ -1,2 +1,2 @@ -msg_336.c(18): error: left operand of '+' must not be bool [336] -msg_336.c(18): error: argument #1 expects '_Bool', gets passed 'int' [334] +msg_336.c(20): error: left operand of '+' must not be bool [336] +msg_336.c(20): error: argument #1 expects '_Bool', gets passed 'int' [334] Index: src/tests/usr.bin/xlint/lint1/msg_337.c diff -u src/tests/usr.bin/xlint/lint1/msg_337.c:1.3 src/tests/usr.bin/xlint/lint1/msg_337.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_337.c:1.3 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_337.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_337.c,v 1.3 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_337.c,v 1.4 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_337.c" // Test for message: right operand of '%s' must not be bool [337] @@ -15,7 +15,11 @@ test(bool); void example(bool b, int i) { - test(i + b); /* expect: 337 *//* expect: 334 */ + /* expect+2: error: right operand of '+' must not be bool [337] */ + /* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */ + test(i + b); + test(b); + test(i != 0); } Index: src/tests/usr.bin/xlint/lint1/msg_337.exp diff -u src/tests/usr.bin/xlint/lint1/msg_337.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_337.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_337.exp:1.3 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_337.exp Fri Jun 17 06:59:16 2022 @@ -1,2 +1,2 @@ -msg_337.c(18): error: right operand of '+' must not be bool [337] -msg_337.c(18): error: argument #1 expects '_Bool', gets passed 'int' [334] +msg_337.c(20): error: right operand of '+' must not be bool [337] +msg_337.c(20): error: argument #1 expects '_Bool', gets passed 'int' [334] Index: src/tests/usr.bin/xlint/lint1/msg_340.c diff -u src/tests/usr.bin/xlint/lint1/msg_340.c:1.3 src/tests/usr.bin/xlint/lint1/msg_340.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_340.c:1.3 Sat Apr 16 13:25:27 2022 +++ src/tests/usr.bin/xlint/lint1/msg_340.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_340.c,v 1.3 2022/04/16 13:25:27 rillig Exp $ */ +/* $NetBSD: msg_340.c,v 1.4 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_340.c" // Test for message: initialization with '[a...b]' is a GCC extension [340] @@ -13,7 +13,8 @@ int example(void) { int numbers[] = { - [2 ... 3] = 12 /* expect: 340 */ + /* expect+1: warning: initialization with '[a...b]' is a GCC extension [340] */ + [2 ... 3] = 12 }; return numbers[0]; } Index: src/tests/usr.bin/xlint/lint1/msg_334.c diff -u src/tests/usr.bin/xlint/lint1/msg_334.c:1.1 src/tests/usr.bin/xlint/lint1/msg_334.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_334.c:1.1 Thu Jan 14 22:18:14 2021 +++ src/tests/usr.bin/xlint/lint1/msg_334.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_334.c,v 1.1 2021/01/14 22:18:14 rillig Exp $ */ +/* $NetBSD: msg_334.c,v 1.2 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_334.c" // Test for message: argument #%d expects '%s', gets passed '%s' [334] @@ -18,7 +18,12 @@ void caller(bool b, int i) { test_bool(b); - test_bool(i); /* expect: 334 */ - test_int(b); /* expect: 334 */ + + /* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */ + test_bool(i); + + /* expect+1: error: argument #1 expects 'int', gets passed '_Bool' [334] */ + test_int(b); + test_int(i); } Index: src/tests/usr.bin/xlint/lint1/msg_335.c diff -u src/tests/usr.bin/xlint/lint1/msg_335.c:1.1 src/tests/usr.bin/xlint/lint1/msg_335.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_335.c:1.1 Thu Jan 14 22:18:14 2021 +++ src/tests/usr.bin/xlint/lint1/msg_335.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_335.c,v 1.1 2021/01/14 22:18:14 rillig Exp $ */ +/* $NetBSD: msg_335.c,v 1.2 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_335.c" // Test for message: operand of '%s' must not be bool [335] @@ -12,11 +12,23 @@ typedef _Bool bool; void example(bool b) { - b = +b; /* expect: 335 */ - b = -b; /* expect: 335 */ + /* expect+1: error: operand of '+' must not be bool [335] */ + b = +b; + + /* expect+1: error: operand of '-' must not be bool [335] */ + b = -b; + b = !b; - b++; /* expect: 335 */ - ++b; /* expect: 335 */ - b--; /* expect: 335 */ - --b; /* expect: 335 */ + + /* expect+1: error: operand of 'x++' must not be bool [335] */ + b++; + + /* expect+1: error: operand of '++x' must not be bool [335] */ + ++b; + + /* expect+1: error: operand of 'x--' must not be bool [335] */ + b--; + + /* expect+1: error: operand of '--x' must not be bool [335] */ + --b; } Index: src/tests/usr.bin/xlint/lint1/msg_339.exp diff -u src/tests/usr.bin/xlint/lint1/msg_339.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_339.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_339.exp:1.1 Fri Feb 19 12:28:56 2021 +++ src/tests/usr.bin/xlint/lint1/msg_339.exp Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -msg_339.c(26): warning: option 'e' should be listed in the options string [339] -msg_339.c(28): warning: option 'f' should be listed in the options string [339] -msg_339.c(14): warning: option 'c' should be handled in the switch [338] -msg_339.c(14): warning: option 'd' should be handled in the switch [338] +msg_339.c(28): warning: option 'e' should be listed in the options string [339] +msg_339.c(31): warning: option 'f' should be listed in the options string [339] +msg_339.c(16): warning: option 'c' should be handled in the switch [338] +msg_339.c(16): warning: option 'd' should be handled in the switch [338] Index: src/tests/usr.bin/xlint/lint1/msg_338.c diff -u src/tests/usr.bin/xlint/lint1/msg_338.c:1.7 src/tests/usr.bin/xlint/lint1/msg_338.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_338.c:1.7 Sat Oct 9 14:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_338.c Fri Jun 17 06:59:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_338.c,v 1.7 2021/10/09 14:22:42 rillig Exp $ */ +/* $NetBSD: msg_338.c,v 1.8 2022/06/17 06:59:16 rillig Exp $ */ # 3 "msg_338.c" // Test for message: option '%c' should be handled in the switch [338] @@ -11,7 +11,9 @@ main(int argc, char **argv) { int o; - while ((o = getopt(argc, argv, "a:bc:d")) != -1) { /* expect: 338 *//* expect: 338 */ + /* expect+2: warning: option 'c' should be handled in the switch [338] */ + /* expect+1: warning: option 'd' should be handled in the switch [338] */ + while ((o = getopt(argc, argv, "a:bc:d")) != -1) { switch (o) { case 'a': break; @@ -23,9 +25,11 @@ main(int argc, char **argv) while (optarg[0] != '\0') optarg++; break; - case 'e': /* expect: option 'e' should be listed */ + case 'e': + /* expect-1: warning: option 'e' should be listed in the options string [339] */ break; - case 'f': /* expect: option 'f' should be listed */ + case 'f': + /* expect-1: warning: option 'f' should be listed in the options string [339] */ /* * The case labels in nested switch statements are * ignored by the check for getopt options.