work around even more format string warning stuff

This commit is contained in:
tg 2008-11-10 19:33:08 +00:00
parent 65b1923b61
commit 2a0e181a70
3 changed files with 10 additions and 20 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.241 2008/11/09 20:32:16 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.242 2008/11/10 19:33:07 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -7,7 +7,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh # http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R36 2008/11/09 @(#)MIRBSD KSH R36 2008/11/10
description: description:
Check version of shell. Check version of shell.
stdin: stdin:

6
main.c
View File

@ -13,7 +13,7 @@
#include <locale.h> #include <locale.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.105 2008/10/28 14:32:41 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/main.c,v 1.106 2008/11/10 19:33:07 tg Exp $");
extern char **environ; extern char **environ;
@ -792,7 +792,7 @@ errorf(const char *fmt, ...)
shl_stdout_ok = 0; /* debugging: note that stdout not valid */ shl_stdout_ok = 0; /* debugging: note that stdout not valid */
exstat = 1; exstat = 1;
if (*fmt) { if (*fmt != 1) {
error_prefix(true); error_prefix(true);
va_start(va, fmt); va_start(va, fmt);
shf_vfprintf(shl_out, fmt, va); shf_vfprintf(shl_out, fmt, va);
@ -827,7 +827,7 @@ bi_errorf(const char *fmt, ...)
shl_stdout_ok = 0; /* debugging: note that stdout not valid */ shl_stdout_ok = 0; /* debugging: note that stdout not valid */
exstat = 1; exstat = 1;
if (*fmt) { if (*fmt != 1) {
error_prefix(true); error_prefix(true);
/* not set when main() calls parse_args() */ /* not set when main() calls parse_args() */
if (builtin_argv0) if (builtin_argv0)

20
sh.h
View File

@ -103,9 +103,9 @@
#define __SCCSID(x) __IDSTRING(sccsid,x) #define __SCCSID(x) __IDSTRING(sccsid,x)
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.251 2008/11/09 20:32:18 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.252 2008/11/10 19:33:08 tg Exp $");
#endif #endif
#define MKSH_VERSION "R36 2008/11/09" #define MKSH_VERSION "R36 2008/11/10"
#ifndef MKSH_INCLUDES_ONLY #ifndef MKSH_INCLUDES_ONLY
@ -516,7 +516,7 @@ EXTERN char shell_flags[FNFLAGS];
/* null value for variable; comparision pointer for unset */ /* null value for variable; comparision pointer for unset */
EXTERN char null[] I__(""); EXTERN char null[] I__("");
/* helpers for string pooling */ /* helpers for string pooling */
EXTERN const char T_synerr[] I__("syntax error"); #define T_synerr "syntax error"
enum temp_type { enum temp_type {
TT_HEREDOC_EXP, /* expanded heredoc */ TT_HEREDOC_EXP, /* expanded heredoc */
@ -1411,18 +1411,8 @@ void warningf(bool, const char *, ...)
__attribute__((format (printf, 2, 3))); __attribute__((format (printf, 2, 3)));
void bi_errorf(const char *, ...) void bi_errorf(const char *, ...)
__attribute__((format (printf, 1, 2))); __attribute__((format (printf, 1, 2)));
/* #define errorfz() errorf("\1")
* circumvent compiler format string nonnull checking #define bi_errorfz() bi_errorf("\1")
* we teach xlC to not bitch about zero-lengths, want
* gcc to do it, and so gain double-checking benefits
*/
#if defined(__xlC__)
#define errorfz() errorf("")
#define bi_errorfz() bi_errorf("")
#else
#define errorfz() errorf(null)
#define bi_errorfz() bi_errorf(null)
#endif
void internal_errorf(const char *, ...) void internal_errorf(const char *, ...)
__attribute__((noreturn)) __attribute__((noreturn))
__attribute__((format (printf, 1, 2))); __attribute__((format (printf, 1, 2)));