Module Name: src
Committed By: rillig
Date: Fri Jan 1 00:00:24 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: check-msgs.lua decl.c func.c init.c tree.c
Log Message:
lint: align comments in code with actual messages
Redundancy is bad. Especially in this case, separating the format
strings from the actual arguments prevents the compiler from
cross-checking them.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/xlint/lint1/check-msgs.lua
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/xlint/lint1/tree.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/check-msgs.lua
diff -u src/usr.bin/xlint/lint1/check-msgs.lua:1.1 src/usr.bin/xlint/lint1/check-msgs.lua:1.2
--- src/usr.bin/xlint/lint1/check-msgs.lua:1.1 Thu Dec 31 22:48:33 2020
+++ src/usr.bin/xlint/lint1/check-msgs.lua Fri Jan 1 00:00:24 2021
@@ -1,5 +1,5 @@
#! /usr/bin/lua
--- $NetBSD: check-msgs.lua,v 1.1 2020/12/31 22:48:33 rillig Exp $
+-- $NetBSD: check-msgs.lua,v 1.2 2021/01/01 00:00:24 rillig Exp $
--[[
@@ -36,12 +36,28 @@ local function check_message(fname, line
return
end
+ msg = string.gsub(msg, "/%*", "**")
+ msg = string.gsub(msg, "%*/", "**")
+ comment = string.gsub(comment, "arg%.", "argument")
+ comment = string.gsub(comment, "bitop%.", "bitwise operation")
+ comment = string.gsub(comment, "comb%.", "combination")
+ comment = string.gsub(comment, "conv%.", "conversion")
+ comment = string.gsub(comment, "decl%.", "declaration")
+ comment = string.gsub(comment, "defn%.", "definition")
+ comment = string.gsub(comment, "expr%.", "expression")
+ comment = string.gsub(comment, "func%.", "function")
+ comment = string.gsub(comment, "incomp%.", "incompatible")
+ comment = string.gsub(comment, "init%.", "initialize")
+ comment = string.gsub(comment, "param%.", "parameter")
+ comment = string.gsub(comment, "poss%.", "possibly")
+ comment = string.gsub(comment, "trad%.", "traditional")
+
if comment == msg then
return
end
- local prefix = comment:match("(.*) %.%.%.$")
- if prefix ~= nil and msg:find(prefix) == 1 then
+ local prefix = comment:match("^(.-)%s*%.%.%.$")
+ if prefix ~= nil and msg:find(prefix, 1, 1) == 1 then
return
end
@@ -66,7 +82,7 @@ local function collect_errors(fname, msg
id = line:match("^%s+error%((%d+)[),]")
end
if id ~= nil then
- local comment = prev:match("^%s+/%*%s+(.+)%s+%*/$")
+ local comment = prev:match("^%s+/%* (.+) %*/$")
if comment ~= nil then
check_message(fname, lineno, tonumber(id), comment, msgs, errors)
end
Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.87 src/usr.bin/xlint/lint1/decl.c:1.88
--- src/usr.bin/xlint/lint1/decl.c:1.87 Wed Dec 30 13:17:42 2020
+++ src/usr.bin/xlint/lint1/decl.c Fri Jan 1 00:00:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.87 2020/12/30 13:17:42 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.88 2021/01/01 00:00:24 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.87 2020/12/30 13:17:42 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.88 2021/01/01 00:00:24 rillig Exp $");
#endif
#include <sys/param.h>
@@ -562,7 +562,7 @@ add_qualifier(tqual_t q)
if (q == CONST) {
if (dcs->d_const) {
- /* duplicate "%s" */
+ /* duplicate '%s' */
warning(10, "const");
}
dcs->d_const = 1;
@@ -572,7 +572,7 @@ add_qualifier(tqual_t q)
if (q != VOLATILE)
LERROR("add_qualifier()");
if (dcs->d_volatile) {
- /* duplicate "%s" */
+ /* duplicate '%s' */
warning(10, "volatile");
}
dcs->d_volatile = 1;
@@ -772,7 +772,7 @@ deftyp(void)
l = NOTSPEC;
t = DOUBLE;
if (!tflag)
- /* use 'double' instead of ... */
+ /* use 'double' instead of 'long ... */
warning(6);
}
break;
@@ -828,7 +828,7 @@ deftyp(void)
}
} else if (dcs->d_ctx == ARG || dcs->d_ctx == PARG) {
if (scl != NOSCL && scl != REG) {
- /* only "register" valid ... */
+ /* only register valid ... */
error(9);
scl = NOSCL;
}
@@ -839,13 +839,13 @@ deftyp(void)
if (dcs->d_const && dcs->d_type->t_const) {
if (!dcs->d_type->t_typedef)
LERROR("deftyp()");
- /* typedef already qualified with "%s" */
+ /* typedef already qualified with '%s' */
warning(68, "const");
}
if (dcs->d_volatile && dcs->d_type->t_volatile) {
if (!dcs->d_type->t_typedef)
LERROR("deftyp()");
- /* typedef already qualified with "%s" */
+ /* typedef already qualified with '%s' */
warning(68, "volatile");
}
@@ -1034,7 +1034,7 @@ check_type(sym_t *sym)
error(17);
return;
} else if (t == VOID) {
- /* illegal use of void */
+ /* illegal use of 'void' */
error(18);
*tpp = gettyp(INT);
#if 0 /* errors are produced by length() */
@@ -1052,7 +1052,7 @@ check_type(sym_t *sym)
if (sym->s_scl != ABSTRACT) {
if (sym->s_name == unnamed)
LERROR("check_type()");
- /* void param cannot have name: %s */
+ /* void param. cannot have name: %s */
error(61, sym->s_name);
*tpp = gettyp(INT);
}
@@ -1066,7 +1066,7 @@ check_type(sym_t *sym)
}
if (t == VOID && to != PTR) {
if (tp->t_const || tp->t_volatile) {
- /* inappropriate qualifiers with "void" */
+ /* inappropriate qualifiers with 'void' */
warning(69);
tp->t_const = tp->t_volatile = 0;
}
@@ -1149,7 +1149,7 @@ declarator_1_struct_union(sym_t *dsym)
}
}
if ((len = tp->t_flen) < 0 || len > (ssize_t)size(t)) {
- /* illegal bit-field size */
+ /* illegal bit-field size: %d */
error(36, len);
tp->t_flen = size(t);
} else if (len == 0 && dsym->s_name != unnamed) {
@@ -1276,14 +1276,14 @@ merge_pointers_and_qualifiers(pqinf_t *p
} else {
if (p2->p_const) {
if (p1->p_const) {
- /* duplicate %s */
+ /* duplicate '%s' */
warning(10, "const");
}
p1->p_const = 1;
}
if (p2->p_volatile) {
if (p1->p_volatile) {
- /* duplicate %s */
+ /* duplicate '%s' */
warning(10, "volatile");
}
p1->p_volatile = 1;
@@ -1347,7 +1347,7 @@ add_array(sym_t *decl, int dim, int n)
tp->t_dim = n;
if (n < 0) {
- /* negative array dimension */
+ /* negative array dimension (%d) */
error(20, n);
n = 0;
} else if (n == 0 && dim) {
@@ -1433,7 +1433,7 @@ new_style_function(sym_t *decl, sym_t *a
for (arg = args; arg != NULL; arg = arg->s_next) {
if (arg->s_type->t_tspec == VOID) {
if (n > 1 || arg->s_next != NULL) {
- /* "void" must be sole parameter */
+ /* void must be sole parameter */
error(60);
arg->s_type = gettyp(INT);
}
@@ -1707,7 +1707,7 @@ newtag(sym_t *tag, scl_t scl, int decl,
tag->s_name);
tag = pushdown(tag);
} else if (tag->s_scl != scl) {
- /* base type is really "%s %s" */
+ /* base type is really '%s %s' */
warning(45, storage_class_name(tag->s_scl),
tag->s_name);
}
@@ -1720,7 +1720,7 @@ newtag(sym_t *tag, scl_t scl, int decl,
tag = pushdown(tag);
dcs->d_next->d_nedecl = 1;
} else if (tag->s_scl != scl) {
- /* base type is really "%s %s" */
+ /* base type is really '%s %s' */
warning(45, storage_class_name(tag->s_scl),
tag->s_name);
/* declaration introduces new type in ANSI C: %s %s */
@@ -2274,7 +2274,7 @@ check_old_style_definition(sym_t *rdsym,
* not set we print only a warning.
*/
if (!eqtype(arg->s_type, parg->s_type, 1, 1, &dowarn) || dowarn) {
- /* prototype does not match old-style def., arg #%d */
+ /* prototype does not match old style defn., arg #%d */
error(299, n);
msg = 1;
}
@@ -2477,7 +2477,7 @@ check_func_old_style_arguments(void)
*/
for (arg = args; arg != NULL; arg = arg->s_next) {
if (arg->s_defarg) {
- /* argument type defaults to int: %s */
+ /* argument type defaults to 'int': %s */
warning(32, arg->s_name);
arg->s_defarg = 0;
mark_as_set(arg);
@@ -3053,7 +3053,7 @@ check_label_usage(sym_t *lab)
if (lab->s_set && !lab->s_used) {
curr_pos = lab->s_set_pos;
- /* label %s unused in function %s */
+ /* %s unused in function %s */
warning(192, lab->s_name, funcsym->s_name);
} else if (!lab->s_set) {
curr_pos = lab->s_use_pos;
@@ -3143,7 +3143,7 @@ check_global_variable(sym_t *sym)
if (sym->s_type->t_tspec == FUNC) {
if (sym->s_used && sym->s_def != DEF) {
curr_pos = sym->s_use_pos;
- /* static func. called but not def.. */
+ /* static func. called but not def... */
error(225, sym->s_name);
}
}
@@ -3155,7 +3155,7 @@ check_global_variable(sym_t *sym)
/* static function %s unused */
warning(236, sym->s_name);
} else {
- /* static function %s decl. but ... */
+ /* static function %s declared but... */
warning(290, sym->s_name);
}
} else if (!sym->s_set) {
Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.39 src/usr.bin/xlint/lint1/func.c:1.40
--- src/usr.bin/xlint/lint1/func.c:1.39 Thu Dec 31 18:51:28 2020
+++ src/usr.bin/xlint/lint1/func.c Fri Jan 1 00:00:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.39 2020/12/31 18:51:28 rillig Exp $ */
+/* $NetBSD: func.c,v 1.40 2021/01/01 00:00:24 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.39 2020/12/31 18:51:28 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.40 2021/01/01 00:00:24 rillig Exp $");
#endif
#include <stdlib.h>
@@ -483,10 +483,10 @@ label(int typ, sym_t *sym, tnode_t *tn)
break;
}
if (cl != NULL && tspec_is_uint(nv.v_tspec)) {
- /* duplicate case in switch, %lu */
+ /* duplicate case in switch: %lu */
error(200, (u_long)nv.v_quad);
} else if (cl != NULL) {
- /* duplicate case in switch, %ld */
+ /* duplicate case in switch: %ld */
error(199, (long)nv.v_quad);
} else {
/*
@@ -1046,7 +1046,7 @@ global_clean_up_decl(int silent)
if (nargusg != -1) {
if (!silent) {
curr_pos = argsused_pos;
- /* must precede function definition: %s */
+ /* must precede function definition: ** %s ** */
warning(282, "ARGSUSED");
}
nargusg = -1;
@@ -1054,7 +1054,7 @@ global_clean_up_decl(int silent)
if (nvararg != -1) {
if (!silent) {
curr_pos = vapos;
- /* must precede function definition: %s */
+ /* must precede function definition: ** %s ** */
warning(282, "VARARGS");
}
nvararg = -1;
@@ -1062,7 +1062,7 @@ global_clean_up_decl(int silent)
if (prflstrg != -1) {
if (!silent) {
curr_pos = printflike_pos;
- /* must precede function definition: %s */
+ /* must precede function definition: ** %s ** */
warning(282, "PRINTFLIKE");
}
prflstrg = -1;
@@ -1070,7 +1070,7 @@ global_clean_up_decl(int silent)
if (scflstrg != -1) {
if (!silent) {
curr_pos = scanflike_pos;
- /* must precede function definition: %s */
+ /* must precede function definition: ** %s ** */
warning(282, "SCANFLIKE");
}
scflstrg = -1;
@@ -1126,7 +1126,7 @@ varargs(int n)
return;
}
if (nvararg != -1) {
- /* duplicate use of ** %s ** */
+ /* duplicate use of ** %s ** */
warning(281, "VARARGS");
}
nvararg = n;
Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.48 src/usr.bin/xlint/lint1/init.c:1.49
--- src/usr.bin/xlint/lint1/init.c:1.48 Wed Dec 30 11:04:48 2020
+++ src/usr.bin/xlint/lint1/init.c Fri Jan 1 00:00:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.48 2020/12/30 11:04:48 rillig Exp $ */
+/* $NetBSD: init.c,v 1.49 2021/01/01 00:00:24 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.48 2020/12/30 11:04:48 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.49 2021/01/01 00:00:24 rillig Exp $");
#endif
#include <ctype.h>
@@ -397,7 +397,7 @@ initstack_check_too_many(void)
if (istk->i_remaining == 0 && !istk->i_nolimit && !istk->i_namedmem) {
switch (istk->i_type->t_tspec) {
case ARRAY:
- /* too many array initializers */
+ /* too many array initializers, expected %d */
error(173, istk->i_type->t_dim);
break;
case STRUCT:
@@ -422,7 +422,7 @@ initstack_next_brace(void)
DPRINTF(("%s\n", __func__));
if (initstk->i_type != NULL &&
tspec_is_scalar(initstk->i_type->t_tspec)) {
- /* invalid initializer */
+ /* invalid initializer type %s */
error(176, tyname(buf, sizeof(buf), initstk->i_type));
initerr = 1;
}
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.107 src/usr.bin/xlint/lint1/tree.c:1.108
--- src/usr.bin/xlint/lint1/tree.c:1.107 Wed Dec 30 12:22:51 2020
+++ src/usr.bin/xlint/lint1/tree.c Fri Jan 1 00:00:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.107 2020/12/30 12:22:51 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.108 2021/01/01 00:00:24 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.107 2020/12/30 12:22:51 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.108 2021/01/01 00:00:24 rillig Exp $");
#endif
#include <float.h>
@@ -449,7 +449,7 @@ struct_or_union_member(tnode_t *tn, op_t
/* non-unique member requires struct/union %s */
error(105, op == POINT ? "object" : "pointer");
} else {
- /* unacceptable operand of %s */
+ /* unacceptable operand of '%s' */
error(111, modtab[op].m_name);
}
}
@@ -762,7 +762,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
((lt != STRUCT && lt != UNION) && !ln->tn_lvalue)) {
/* Without tflag we got already an error */
if (tflag)
- /* unacceptable operand of %s */
+ /* unacceptable operand of '%s' */
error(111, mp->m_name);
return 0;
}
@@ -772,7 +772,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
if (lt != PTR && !(tflag && tspec_is_int(lt))) {
/* Without tflag we got already an error */
if (tflag)
- /* unacceptable operand of %s */
+ /* unacceptable operand of '%s' */
error(111, mp->m_name);
return 0;
}
@@ -790,11 +790,11 @@ typeok(op_t op, int arg, tnode_t *ln, tn
break;
error(163);
}
- /* %soperand of %s must be lvalue */
+ /* %soperand of '%s' must be lvalue */
error(114, "", mp->m_name);
return 0;
} else if (ltp->t_const) {
- /* %soperand of %s must be modifiable lvalue */
+ /* %soperand of '%s' must be modifiable lvalue */
if (!tflag)
warning(115, "", mp->m_name);
}
@@ -810,7 +810,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
break;
error(163);
}
- /* %soperand of %s must be lvalue */
+ /* %soperand of '%s' must be lvalue */
error(114, "", mp->m_name);
return 0;
} else if (tspec_is_scalar(lt)) {
@@ -820,7 +820,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
return 0;
}
} else if (lt != STRUCT && lt != UNION) {
- /* unacceptable operand of %s */
+ /* unacceptable operand of '%s' */
error(111, mp->m_name);
return 0;
}
@@ -869,11 +869,11 @@ typeok(op_t op, int arg, tnode_t *ln, tn
* The left operand is signed. This means that
* the operation is (possibly) nonportable.
*/
- /* bitwise operation on signed value nonportable */
if (ln->tn_op != CON) {
- /* possibly nonportable */
+ /* bitop. on signed value poss. nonportable */
warning(117);
} else if (ln->tn_val->v_quad < 0) {
+ /* bitop. on signed value nonportable */
warning(120);
}
} else if (!tflag && !sflag &&
@@ -884,7 +884,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
*/
if (hflag &&
(ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
- /* semantics of %s change in ANSI C; use ... */
+ /* semantics of '%s' change in ANSI C; ... */
warning(118, mp->m_name);
}
} else if (!tflag && !sflag &&
@@ -896,7 +896,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
*/
if (hflag &&
(ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
- /* semantics of %s change in ANSI C; use ... */
+ /* semantics of '%s' change in ANSI C; ... */
warning(118, mp->m_name);
}
}
@@ -917,7 +917,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
* ANSI C and traditional C.
*/
if (hflag)
- /* semantics of %s change in ANSI C; use ... */
+ /* semantics of '%s' change in ANSI C; ... */
warning(118, mp->m_name);
}
shift:
@@ -926,7 +926,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
/* negative shift */
warning(121);
} else if ((uint64_t)rn->tn_val->v_quad == (uint64_t)size(lt)) {
- /* shift equal to size fo object */
+ /* shift equal to size of object */
warning(267);
} else if ((uint64_t)rn->tn_val->v_quad > (uint64_t)size(lt)) {
/* shift greater than size of object */
@@ -963,7 +963,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
"pointer" : "integer";
tyname(lbuf, sizeof(lbuf), ltp);
tyname(rbuf, sizeof(rbuf), rtp);
- /* illegal comb. of pointer and int., op %s */
+ /* illegal combination of %s (%s) and ... */
warning(123, lx, lbuf, rx, rbuf, mp->m_name);
} else {
warn_incompatible_types(op, lt, rt);
@@ -1010,7 +1010,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
const char *rx = rt == PTR ? "pointer" : "integer";
tyname(lbuf, sizeof(lbuf), ltp);
tyname(rbuf, sizeof(rbuf), rtp);
- /* illegal comb. of ptr. and int., op %s */
+ /* illegal combination of %s (%s) and %s (%s), op %s */
warning(123, lx, lbuf, rx, rbuf, mp->m_name);
break;
}
@@ -1068,7 +1068,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
case SHRASS:
if (pflag && !tspec_is_uint(lt) &&
!(tflag && tspec_is_uint(rt))) {
- /* bitwise operation on s.v. possibly nonportable */
+ /* bitop. on signed value possibly nonportable */
warning(117);
}
goto assign;
@@ -1085,7 +1085,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn
break;
error(163);
}
- /* %soperand of %s must be lvalue */
+ /* %soperand of '%s' must be lvalue */
error(114, "left ", mp->m_name);
return 0;
} else if (ltp->t_const || ((lt == STRUCT || lt == UNION) &&
@@ -1172,7 +1172,7 @@ check_pointer_comparison(op_t op, tnode_
if (lt == FUNC && rt == FUNC) {
if (sflag && op != EQ && op != NE)
- /* ANSI C forbids ordered comp. of func ptr */
+ /* ANSI C forbids ordered comparisons of ... */
warning(125);
}
}
@@ -1246,15 +1246,15 @@ check_assign_types_compatible(op_t op, i
switch (op) {
case INIT:
case RETURN:
- /* incompatible pointer types */
+ /* incompatible pointer types (%s != %s) */
warning(182, lbuf, rbuf);
break;
case FARG:
- /* argument has incompat. ptr. type, arg #%d */
+ /* argument has incompatible pointer type... */
warning(153, arg, lbuf, rbuf);
break;
default:
- /* operands have incompat. ptr. types, op %s */
+ /* operands have incompatible pointer type... */
warning(128, mp->m_name, lbuf, rbuf);
break;
}
@@ -1272,15 +1272,15 @@ check_assign_types_compatible(op_t op, i
switch (op) {
case INIT:
case RETURN:
- /* illegal combination of pointer and integer */
+ /* illegal combination of %s (%s) and %s (%s) */
warning(183, lx, lbuf, rx, rbuf);
break;
case FARG:
- /* illegal comb. of ptr. and int., arg #%d */
+ /* illegal comb. of %s (%s) and %s (%s), arg #%d */
warning(154, lx, lbuf, rx, rbuf, arg);
break;
default:
- /* illegal comb. of ptr. and int., op %s */
+ /* illegal combination of %s (%s) and %s (%s), op %s */
warning(123, lx, lbuf, rx, rbuf, mp->m_name);
break;
}
@@ -1294,7 +1294,7 @@ check_assign_types_compatible(op_t op, i
warn_incompatible_pointers(NULL, ltp, rtp);
break;
case FARG:
- /* argument has incompatible pointer type, arg #%d */
+ /* arg. has incomp. pointer type, arg #%d (%s != %s) */
warning(153, arg, tyname(lbuf, sizeof(lbuf), ltp),
tyname(rbuf, sizeof(rbuf), rtp));
break;
@@ -1307,12 +1307,12 @@ check_assign_types_compatible(op_t op, i
switch (op) {
case INIT:
- /* initialisation type mismatch */
+ /* initialisation type mismatch (%s) and (%s) */
error(185, tyname(lbuf, sizeof(lbuf), ltp),
tyname(rbuf, sizeof(rbuf), rtp));
break;
case RETURN:
- /* return value type mismatch */
+ /* return value type mismatch (%s) and (%s) */
error(211, tyname(lbuf, sizeof(lbuf), ltp),
tyname(rbuf, sizeof(rbuf), rtp));
break;
@@ -1383,7 +1383,7 @@ check_enum_type_mismatch(op_t op, int ar
warning(156, arg);
break;
case RETURN:
- /* return value type mismatch */
+ /* return value type mismatch (%s) and (%s) */
warning(211);
break;
default:
@@ -1393,7 +1393,7 @@ check_enum_type_mismatch(op_t op, int ar
}
} else if (Pflag && mp->m_comp && op != EQ && op != NE) {
if (eflag)
- /* dubious comparisons of enums */
+ /* dubious comparison of enums, op %s */
warning(243, mp->m_name);
}
}
@@ -1437,7 +1437,7 @@ check_enum_int_mismatch(op_t op, int arg
tyname(rbuf, sizeof(rbuf), rn->tn_type));
break;
default:
- /* combination of '%s' and %s, op %s */
+ /* combination of '%s' and '%s', op %s */
warning(242, tyname(lbuf, sizeof(lbuf), ln->tn_type),
tyname(rbuf, sizeof(rbuf), rn->tn_type),
modtab[op].m_name);
@@ -1857,10 +1857,10 @@ check_pointer_integer_conversion(op_t op
if (psize(nt) < psize(PTR)) {
if (pflag && size(nt) >= size(PTR)) {
- /* conv. of pointer to %s may lose bits */
+ /* conv. of pointer to '%s' may lose bits */
warning(134, tyname(buf, sizeof(buf), tp));
} else {
- /* conv. of pointer to %s loses bits */
+ /* conv. of pointer to '%s' loses bits */
warning(133, tyname(buf, sizeof(buf), tp));
}
}
@@ -1984,13 +1984,13 @@ cvtcon(op_t op, int arg, type_t *tp, val
if (v->v_ldbl > max || v->v_ldbl < min) {
lint_assert(nt != LDOUBLE);
if (op == FARG) {
- /* conv. of %s to %s is out of rng., arg #%d */
+ /* conv. of '%s' to '%s' is out of range, ... */
warning(295,
tyname(lbuf, sizeof(lbuf), gettyp(ot)),
tyname(rbuf, sizeof(rbuf), tp),
arg);
} else {
- /* conversion of %s to %s is out of range */
+ /* conversion of '%s' to '%s' is out of range */
warning(119,
tyname(lbuf, sizeof(lbuf), gettyp(ot)),
tyname(rbuf, sizeof(rbuf), tp));
@@ -2087,7 +2087,7 @@ cvtcon(op_t op, int arg, type_t *tp, val
} else if (nsz < osz &&
(v->v_quad & xmask) != xmask &&
(v->v_quad & xmask) != 0) {
- /* const. truncated by conv., op %s */
+ /* constant truncated by conv., op %s */
warning(306, modtab[op].m_name);
}
} else if ((nt != PTR && tspec_is_uint(nt)) &&
@@ -2096,10 +2096,10 @@ cvtcon(op_t op, int arg, type_t *tp, val
/* assignment of negative constant to ... */
warning(164);
} else if (op == INIT) {
- /* initialisation of unsigned with neg. ... */
+ /* initialisation of unsigned with neg... */
warning(221);
} else if (op == FARG) {
- /* conversion of neg. const. to ..., arg #%d */
+ /* conversion of negative constant to ... */
warning(296, arg);
} else if (modtab[op].m_comp) {
/* handled by check_integer_comparison() */
@@ -2143,13 +2143,13 @@ cvtcon(op_t op, int arg, type_t *tp, val
/* case label affected by conversion */
warning(196);
} else if (op == FARG) {
- /* conv. of %s to %s is out of rng., arg #%d */
+ /* conv. of '%s' to '%s' is out of range, ... */
warning(295,
tyname(lbuf, sizeof(lbuf), gettyp(ot)),
tyname(rbuf, sizeof(rbuf), tp),
arg);
} else {
- /* conversion of %s to %s is out of range */
+ /* conversion of '%s' to '%s' is out of range */
warning(119,
tyname(lbuf, sizeof(lbuf), gettyp(ot)),
tyname(rbuf, sizeof(rbuf), tp));
@@ -2165,13 +2165,13 @@ cvtcon(op_t op, int arg, type_t *tp, val
/* case label affected by conversion */
warning(196);
} else if (op == FARG) {
- /* conv. of %s to %s is out of rng., arg #%d */
+ /* conv. of '%s' to '%s' is out of range, ... */
warning(295,
tyname(lbuf, sizeof(lbuf), gettyp(ot)),
tyname(rbuf, sizeof(rbuf), tp),
arg);
} else {
- /* conversion of %s to %s is out of range */
+ /* conversion of '%s' to '%s' is out of range */
warning(119,
tyname(lbuf, sizeof(lbuf), gettyp(ot)),
tyname(rbuf, sizeof(rbuf), tp));
@@ -2625,7 +2625,7 @@ build_assignment(op_t op, tnode_t *ln, t
if (op == SHLASS) {
if (psize(lt) < psize(rt)) {
if (hflag)
- /* semantics of %s change in ANSI C; use ... */
+ /* semantics of '%s' change in ANSI C; ... */
warning(118, "<<=");
}
} else if (op != SHRASS) {
@@ -3057,21 +3057,21 @@ tsize(type_t *tp)
}
if (elem == 0) {
if (!flex) {
- /* cannot take size of incomplete type */
+ /* cannot take size/alignment of incomplete type */
error(143);
elem = 1;
}
}
switch (tp->t_tspec) {
case FUNC:
- /* cannot take size of function */
+ /* cannot take size/alignment of function */
error(144);
elsz = 1;
break;
case STRUCT:
case UNION:
if (incompl(tp)) {
- /* cannot take size of incomplete type */
+ /* cannot take size/alignment of incomplete type */
error(143);
elsz = 1;
} else {
@@ -3080,17 +3080,17 @@ tsize(type_t *tp)
break;
case ENUM:
if (incompl(tp)) {
- /* cannot take size of incomplete type */
+ /* cannot take size/alignment of incomplete type */
warning(143);
}
/* FALLTHROUGH */
default:
if (tp->t_isfield) {
- /* cannot take size of bit-field */
+ /* cannot take size/alignment of bit-field */
error(145);
}
if (tp->t_tspec == VOID) {
- /* cannot take size of void */
+ /* cannot take size/alignment of void */
error(146);
elsz = 1;
} else {
@@ -3116,14 +3116,14 @@ build_alignof(type_t *tp)
break;
case FUNC:
- /* cannot take align of function */
+ /* cannot take size/alignment of function */
error(144);
return 0;
case STRUCT:
case UNION:
if (incompl(tp)) {
- /* cannot take align of incomplete type */
+ /* cannot take size/alignment of incomplete type */
error(143);
return 0;
}
@@ -3132,12 +3132,12 @@ build_alignof(type_t *tp)
break;
default:
if (tp->t_isfield) {
- /* cannot take align of bit-field */
+ /* cannot take size/alignment of bit-field */
error(145);
return 0;
}
if (tp->t_tspec == VOID) {
- /* cannot take alignsize of void */
+ /* cannot take size/alignment of void */
error(146);
return 0;
}
@@ -3284,7 +3284,7 @@ funccall(tnode_t *func, tnode_t *args)
if (func->tn_type->t_tspec != PTR ||
func->tn_type->t_subt->t_tspec != FUNC) {
char buf[256];
- /* illegal function */
+ /* illegal function (type %s) */
error(149, tyname(buf, sizeof(buf), func->tn_type));
return NULL;
}