summaryrefslogtreecommitdiff
path: root/usr.bin/xlint
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2005-01-24 00:25:16 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2005-01-24 00:25:16 +0000
commit19288e82a02b76b531182b284568d9730b03a2ff (patch)
tree95ece5ab9f7216972454ca765927035deedaf69c /usr.bin/xlint
parentef792a512406a663c5d8ef1c749e87084c2f0b90 (diff)
Deal with format strings that are "const char *", not just "char *".
Based on a patch from Claus Assmann. Someone who understands lint internals better may be able to make a better fix... Closes PR 4072.
Diffstat (limited to 'usr.bin/xlint')
-rw-r--r--usr.bin/xlint/lint1/emit1.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/usr.bin/xlint/lint1/emit1.c b/usr.bin/xlint/lint1/emit1.c
index d51333e40d5..9f8f865bb8d 100644
--- a/usr.bin/xlint/lint1/emit1.c
+++ b/usr.bin/xlint/lint1/emit1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: emit1.c,v 1.3 2002/02/16 21:27:59 millert Exp $ */
+/* $OpenBSD: emit1.c,v 1.4 2005/01/24 00:25:15 millert Exp $ */
/* $NetBSD: emit1.c,v 1.4 1995/10/02 17:21:28 jpo Exp $ */
/*
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: emit1.c,v 1.3 2002/02/16 21:27:59 millert Exp $";
+static char rcsid[] = "$OpenBSD: emit1.c,v 1.4 2005/01/24 00:25:15 millert Exp $";
#endif
#include <ctype.h>
@@ -431,13 +431,17 @@ outcall(tn, rvused, rvdisc)
}
outint(n);
}
- } else if (arg->tn_op == AMPER &&
- arg->tn_left->tn_op == STRING &&
- arg->tn_left->tn_strg->st_tspec == CHAR) {
- /* constant string, write all format specifiers */
- outchar('s');
- outint(n);
- outfstrg(arg->tn_left->tn_strg);
+ } else {
+ if (arg->tn_op == CVT && !arg->tn_cast)
+ arg = arg->tn_left;
+ if (arg->tn_op == AMPER &&
+ arg->tn_left->tn_op == STRING &&
+ arg->tn_left->tn_strg->st_tspec == CHAR) {
+ /* constant string, write format specifiers */
+ outchar('s');
+ outint(n);
+ outfstrg(arg->tn_left->tn_strg);
+ }
}
}