lint: quote placeholders in messages for unused variables

This commit is contained in:
rillig 2021-04-09 20:12:00 +00:00
parent f9065e3b5b
commit 18955dccde
27 changed files with 63 additions and 63 deletions

View File

@ -31,7 +31,7 @@ d_c99_bool_strict.c(253): error: return value type mismatch (_Bool) and (int) [2
d_c99_bool_strict.c(259): error: return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(265): error: return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(271): error: return value type mismatch (_Bool) and (pointer) [211]
d_c99_bool_strict.c(269): warning: argument p unused in function strict_bool_conversion_return_pointer [231]
d_c99_bool_strict.c(269): warning: argument 'p' unused in function 'strict_bool_conversion_return_pointer' [231]
d_c99_bool_strict.c(277): error: return value type mismatch (char) and (_Bool) [211]
d_c99_bool_strict.c(283): error: return value type mismatch (char) and (_Bool) [211]
d_c99_bool_strict.c(301): error: argument #2 expects 'int', gets passed '_Bool' [334]
@ -53,7 +53,7 @@ d_c99_bool_strict.c(352): error: operands of '=' have incompatible types (int !=
d_c99_bool_strict.c(353): error: operands of '=' have incompatible types (unsigned int != _Bool) [107]
d_c99_bool_strict.c(354): error: operands of '=' have incompatible types (double != _Bool) [107]
d_c99_bool_strict.c(355): error: operands of '=' have incompatible types (pointer != _Bool) [107]
d_c99_bool_strict.c(345): warning: argument b unused in function strict_bool_conversion_from_bool_to_scalar [231]
d_c99_bool_strict.c(345): warning: argument 'b' unused in function 'strict_bool_conversion_from_bool_to_scalar' [231]
d_c99_bool_strict.c(367): warning: constant in conditional context [161]
d_c99_bool_strict.c(368): warning: statement not reached [193]
d_c99_bool_strict.c(370): warning: constant in conditional context [161]
@ -159,7 +159,7 @@ d_c99_bool_strict.c(625): error: operands of '=' have incompatible types (int !=
d_c99_bool_strict.c(663): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(671): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(678): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(653): warning: argument flags unused in function strict_bool_bitwise_and_enum [231]
d_c99_bool_strict.c(653): warning: argument 'flags' unused in function 'strict_bool_bitwise_and_enum' [231]
d_c99_bool_strict.c(717): error: operands of '==' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(729): warning: expression has null effect [129]
d_c99_bool_strict.c(741): error: right operand of '+' must not be bool [337]

View File

@ -1 +1 @@
d_c99_union_cast.c(19): warning: a unused in function foo [192]
d_c99_union_cast.c(19): warning: 'a' unused in function 'foo' [192]

View File

@ -1 +1 @@
d_cvt_constant.c(8): warning: x set but not used in function main [191]
d_cvt_constant.c(8): warning: 'x' set but not used in function 'main' [191]

View File

@ -1,6 +1,6 @@
d_decl_old_style_arguments.c(14): warning: argument type defaults to 'int': def [32]
d_decl_old_style_arguments.c(14): error: parameter mismatch: 3 declared, 4 defined [51]
d_decl_old_style_arguments.c(10): warning: argument num unused in function func [231]
d_decl_old_style_arguments.c(10): warning: argument ptr unused in function func [231]
d_decl_old_style_arguments.c(10): warning: argument dbl unused in function func [231]
d_decl_old_style_arguments.c(10): warning: argument def unused in function func [231]
d_decl_old_style_arguments.c(10): warning: argument 'num' unused in function 'func' [231]
d_decl_old_style_arguments.c(10): warning: argument 'ptr' unused in function 'func' [231]
d_decl_old_style_arguments.c(10): warning: argument 'dbl' unused in function 'func' [231]
d_decl_old_style_arguments.c(10): warning: argument 'def' unused in function 'func' [231]

View File

@ -1,14 +1,14 @@
d_fold_test.c(59): error: controlling expressions must have scalar type [204]
d_fold_test.c(59): warning: argument s unused in function if_struct [231]
d_fold_test.c(59): warning: argument 's' unused in function 'if_struct' [231]
d_fold_test.c(60): error: controlling expressions must have scalar type [204]
d_fold_test.c(60): warning: argument u unused in function if_union [231]
d_fold_test.c(60): warning: argument 'u' unused in function 'if_union' [231]
d_fold_test.c(65): error: controlling expressions must have scalar type [204]
d_fold_test.c(65): warning: argument s unused in function while_struct [231]
d_fold_test.c(65): warning: argument 's' unused in function 'while_struct' [231]
d_fold_test.c(66): error: controlling expressions must have scalar type [204]
d_fold_test.c(66): warning: end-of-loop code not reached [223]
d_fold_test.c(66): warning: argument s unused in function for_struct [231]
d_fold_test.c(66): warning: argument 's' unused in function 'for_struct' [231]
d_fold_test.c(67): error: controlling expressions must have scalar type [204]
d_fold_test.c(67): warning: argument s unused in function do_while_struct [231]
d_fold_test.c(67): warning: argument 's' unused in function 'do_while_struct' [231]
d_fold_test.c(70): error: first operand must have scalar type, op ? : [170]
d_fold_test.c(70): warning: function conditional_struct expects to return value [214]
d_fold_test.c(70): warning: argument s unused in function conditional_struct [231]
d_fold_test.c(70): warning: argument 's' unused in function 'conditional_struct' [231]

View File

@ -1 +1 @@
d_init_pop_member.c(38): warning: st set but not used in function func [191]
d_init_pop_member.c(38): warning: 'st' set but not used in function 'func' [191]

View File

@ -2,5 +2,5 @@ msg_019.c(6): error: void type for 'global_variable' [19]
msg_019.c(8): error: void type for 'unit_variable' [19]
msg_019.c(11): error: void parameter cannot have name: parameter [61]
msg_019.c(13): error: void type for 'local_variable' [19]
msg_019.c(11): warning: argument parameter unused in function function [231]
msg_019.c(11): warning: argument 'parameter' unused in function 'function' [231]
msg_019.c(8): warning: static variable unit_variable unused [226]

View File

@ -1,2 +1,2 @@
msg_050.c(11): warning: a function is declared as an argument: f [50]
msg_050.c(10): warning: argument f unused in function example [231]
msg_050.c(10): warning: argument 'f' unused in function 'example' [231]

View File

@ -1,4 +1,4 @@
msg_051.c(12): error: parameter mismatch: 2 declared, 3 defined [51]
msg_051.c(10): warning: argument a unused in function example [231]
msg_051.c(10): warning: argument b unused in function example [231]
msg_051.c(10): warning: argument c unused in function example [231]
msg_051.c(10): warning: argument 'a' unused in function 'example' [231]
msg_051.c(10): warning: argument 'b' unused in function 'example' [231]
msg_051.c(10): warning: argument 'c' unused in function 'example' [231]

View File

@ -1,6 +1,6 @@
msg_057.c(10): warning: enumeration constant hides parameter: red [57]
msg_057.c(10): warning: enumeration constant hides parameter: green [57]
msg_057.c(11): warning: enumeration constant hides parameter: blue [57]
msg_057.c(7): warning: argument red unused in function rgb [231]
msg_057.c(7): warning: argument green unused in function rgb [231]
msg_057.c(7): warning: argument blue unused in function rgb [231]
msg_057.c(7): warning: argument 'red' unused in function 'rgb' [231]
msg_057.c(7): warning: argument 'green' unused in function 'rgb' [231]
msg_057.c(7): warning: argument 'blue' unused in function 'rgb' [231]

View File

@ -1,2 +1,2 @@
msg_084.c(6): warning: ANSI C requires formal parameter before '...' [84]
msg_084.c(10): warning: argument fmt unused in function ok_ellipsis [231]
msg_084.c(10): warning: argument 'fmt' unused in function 'ok_ellipsis' [231]

View File

@ -1,3 +1,3 @@
msg_096.c(21): error: cannot dereference non-pointer type [96]
msg_096.c(21): warning: function unary_asterisk expects to return value [214]
msg_096.c(19): warning: argument i unused in function unary_asterisk [231]
msg_096.c(19): warning: argument 'i' unused in function 'unary_asterisk' [231]

View File

@ -1,3 +1,3 @@
msg_109.c(9): error: void type illegal in expression [109]
msg_109.c(9): warning: function example expects to return value [214]
msg_109.c(7): warning: argument arg unused in function example [231]
msg_109.c(7): warning: argument 'arg' unused in function 'example' [231]

View File

@ -1,4 +1,4 @@
msg_114.c(9): error: operand of 'x++' must be lvalue [114]
msg_114.c(17): error: operand of 'x++' has invalid type (array) [108]
msg_114.c(19): error: operand of 'x++' must be lvalue [114]
msg_114.c(7): warning: argument a unused in function example [231]
msg_114.c(7): warning: argument 'a' unused in function 'example' [231]

View File

@ -1,5 +1,5 @@
msg_126.c(9): error: incompatible types 'pointer to void' and 'double' in conditional [126]
msg_126.c(9): warning: function max expects to return value [214]
msg_126.c(7): warning: argument cond unused in function max [231]
msg_126.c(7): warning: argument ptr unused in function max [231]
msg_126.c(7): warning: argument dbl unused in function max [231]
msg_126.c(7): warning: argument 'cond' unused in function 'max' [231]
msg_126.c(7): warning: argument 'ptr' unused in function 'max' [231]
msg_126.c(7): warning: argument 'dbl' unused in function 'max' [231]

View File

@ -1,3 +1,3 @@
msg_170.c(13): error: first operand must have scalar type, op ? : [170]
msg_170.c(13): warning: function example expects to return value [214]
msg_170.c(11): warning: argument num unused in function example [231]
msg_170.c(11): warning: argument 'num' unused in function 'example' [231]

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg_189.c,v 1.3 2021/03/28 15:36:37 rillig Exp $ */
/* $NetBSD: msg_189.c,v 1.4 2021/04/09 20:12:01 rillig Exp $ */
# 3 "msg_189.c"
/* Test for message: assignment of struct/union illegal in traditional C [189] */
@ -16,5 +16,5 @@ example()
a.member = 3;
b = a; /* message 189 is not triggered anymore */
/* expect-1: b set but not used in function example */
/* expect-1: 'b' set but not used in function 'example' */
}

View File

@ -1 +1 @@
msg_189.c(18): warning: b set but not used in function example [191]
msg_189.c(18): warning: 'b' set but not used in function 'example' [191]

View File

@ -1,7 +1,7 @@
/* $NetBSD: msg_191.c,v 1.2 2021/01/30 17:56:29 rillig Exp $ */
/* $NetBSD: msg_191.c,v 1.3 2021/04/09 20:12:01 rillig Exp $ */
# 3 "msg_191.c"
// Test for message: %s set but not used in function %s [191]
// Test for message: '%s' set but not used in function '%s' [191]
void
example(void)

View File

@ -1 +1 @@
msg_191.c(11): warning: local set but not used in function example [191]
msg_191.c(11): warning: 'local' set but not used in function 'example' [191]

View File

@ -1,7 +1,7 @@
/* $NetBSD: msg_192.c,v 1.2 2021/01/30 17:56:29 rillig Exp $ */
/* $NetBSD: msg_192.c,v 1.3 2021/04/09 20:12:01 rillig Exp $ */
# 3 "msg_192.c"
// Test for message: %s unused in function %s [192]
// Test for message: '%s' unused in function '%s' [192]
void
example(int param) /* expect: 231 */

View File

@ -1,2 +1,2 @@
msg_192.c(9): warning: local unused in function example [192]
msg_192.c(7): warning: argument param unused in function example [231]
msg_192.c(9): warning: 'local' unused in function 'example' [192]
msg_192.c(7): warning: argument 'param' unused in function 'example' [231]

View File

@ -1,14 +1,14 @@
msg_204.c(87): error: controlling expressions must have scalar type [204]
msg_204.c(87): warning: argument s unused in function if_struct [231]
msg_204.c(87): warning: argument 's' unused in function 'if_struct' [231]
msg_204.c(88): error: controlling expressions must have scalar type [204]
msg_204.c(88): warning: argument u unused in function if_union [231]
msg_204.c(88): warning: argument 'u' unused in function 'if_union' [231]
msg_204.c(93): error: controlling expressions must have scalar type [204]
msg_204.c(93): warning: argument s unused in function while_struct [231]
msg_204.c(93): warning: argument 's' unused in function 'while_struct' [231]
msg_204.c(94): error: controlling expressions must have scalar type [204]
msg_204.c(94): warning: end-of-loop code not reached [223]
msg_204.c(94): warning: argument s unused in function for_struct [231]
msg_204.c(94): warning: argument 's' unused in function 'for_struct' [231]
msg_204.c(95): error: controlling expressions must have scalar type [204]
msg_204.c(95): warning: argument s unused in function do_while_struct [231]
msg_204.c(95): warning: argument 's' unused in function 'do_while_struct' [231]
msg_204.c(101): error: first operand must have scalar type, op ? : [170]
msg_204.c(101): warning: function conditional_struct expects to return value [214]
msg_204.c(101): warning: argument s unused in function conditional_struct [231]
msg_204.c(101): warning: argument 's' unused in function 'conditional_struct' [231]

View File

@ -1,7 +1,7 @@
/* $NetBSD: msg_231.c,v 1.2 2021/01/30 17:56:29 rillig Exp $ */
/* $NetBSD: msg_231.c,v 1.3 2021/04/09 20:12:01 rillig Exp $ */
# 3 "msg_231.c"
// Test for message: argument %s unused in function %s [231]
// Test for message: argument '%s' unused in function '%s' [231]
void
example(int param) /* expect: 231 */

View File

@ -1,2 +1,2 @@
msg_231.c(9): warning: local unused in function example [192]
msg_231.c(7): warning: argument param unused in function example [231]
msg_231.c(9): warning: 'local' unused in function 'example' [192]
msg_231.c(7): warning: argument 'param' unused in function 'example' [231]

View File

@ -1,4 +1,4 @@
/* $NetBSD: decl.c,v 1.170 2021/04/02 12:16:50 rillig Exp $ */
/* $NetBSD: decl.c,v 1.171 2021/04/09 20:12:00 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: decl.c,v 1.170 2021/04/02 12:16:50 rillig Exp $");
__RCSID("$NetBSD: decl.c,v 1.171 2021/04/09 20:12:00 rillig Exp $");
#endif
#include <sys/param.h>
@ -3040,7 +3040,7 @@ check_argument_usage(bool novar, sym_t *arg)
if (!arg->s_used && vflag) {
curr_pos = arg->s_def_pos;
/* argument %s unused in function %s */
/* argument '%s' unused in function '%s' */
warning(231, arg->s_name, funcsym->s_name);
}
}
@ -3073,17 +3073,17 @@ check_variable_usage(bool novar, sym_t *sym)
if (sc == EXTERN) {
if (!sym->s_used && !sym->s_set) {
curr_pos = sym->s_def_pos;
/* %s unused in function %s */
/* '%s' unused in function '%s' */
warning(192, sym->s_name, funcsym->s_name);
}
} else {
if (sym->s_set && !sym->s_used) {
curr_pos = sym->s_set_pos;
/* %s set but not used in function %s */
/* '%s' set but not used in function '%s' */
warning(191, sym->s_name, funcsym->s_name);
} else if (!sym->s_used) {
curr_pos = sym->s_def_pos;
/* %s unused in function %s */
/* '%s' unused in function '%s' */
warning(192, sym->s_name, funcsym->s_name);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: err.c,v 1.105 2021/04/09 15:58:43 rillig Exp $ */
/* $NetBSD: err.c,v 1.106 2021/04/09 20:12:00 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: err.c,v 1.105 2021/04/09 15:58:43 rillig Exp $");
__RCSID("$NetBSD: err.c,v 1.106 2021/04/09 20:12:00 rillig Exp $");
#endif
#include <sys/types.h>
@ -245,8 +245,8 @@ const char *msgs[] = {
"no automatic aggregate initialization in traditional C", /* 188 */
"", /* no longer used */ /* 189 */
"empty array declaration: %s", /* 190 */
"%s set but not used in function %s", /* 191 */
"%s unused in function %s", /* 192 */
"'%s' set but not used in function '%s'", /* 191 */
"'%s' unused in function '%s'", /* 192 */
"statement not reached", /* 193 */
"label %s redefined", /* 194 */
"case not in switch", /* 195 */
@ -285,7 +285,7 @@ const char *msgs[] = {
"function cannot return const or volatile object", /* 228 */
"converting '%s' to '%s' is questionable", /* 229 */
"nonportable character comparison, op %s", /* 230 */
"argument %s unused in function %s", /* 231 */
"argument '%s' unused in function '%s'", /* 231 */
"label %s unused in function %s", /* 232 */
"struct %s never defined", /* 233 */
"union %s never defined", /* 234 */