aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlarrybr <larrybr@noemail.net>2024-02-16 18:34:21 +0000
committerlarrybr <larrybr@noemail.net>2024-02-16 18:34:21 +0000
commitfd2500f98b3c385953a3de83545aa6ddcfcadce0 (patch)
tree98d9e0f8011982ef6d7939fdc3192f93d403c00c /src
parent816f677c1c2ec9d3331c9c329a6176bedca4178e (diff)
downloadsqlite-fd2500f98b3c385953a3de83545aa6ddcfcadce0.tar.gz
sqlite-fd2500f98b3c385953a3de83545aa6ddcfcadce0.zip
Retweak last check-in to retain compile-time checking of xprintf() arguments.
FossilOrigin-Name: 670174916c660b24ba70e96a42984eb65ee52da50e9828bdeca4c9ff4bf92e20
Diffstat (limited to 'src')
-rw-r--r--src/shell.c.in19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/shell.c.in b/src/shell.c.in
index 780cdb925..da377982e 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -268,6 +268,9 @@ INCLUDE ../ext/consio/console_io.c
* setOutputStream(FILE *pf)
* This is normally the stream that CLI normal output goes to.
* For the stand-alone CLI, it is stdout with no .output redirect.
+ *
+ * The ?putz(z) forms are required for the Fiddle builds for string literal
+ * output, in aid of enforcing format string to argument correspondence.
*/
# define sputz(s,z) fPutsUtf8(z,s)
# define sputf fPrintfUtf8
@@ -279,12 +282,18 @@ INCLUDE ../ext/consio/console_io.c
#else
/* For Fiddle, all console handling and emit redirection is omitted. */
-# define sputz(fp,z) fputs(z,fp)
-# define sputf fprintf
+/* These next 3 macros are for emitting formatted output. When complaints
+ * from the WASM build are issued for non-formatted output, (when a mere
+ * string literal is to be emitted, the ?putz(z) forms should be used.
+ * (This permits compile-time checking of format string / argument mismatch.)
+ */
+# define oputf(fmt, ...) printf(fmt,__VA_ARGS__)
+# define eputf(fmt, ...) fprintf(stderr,fmt,__VA_ARGS__)
+# define sputf(fp,fmt, ...) fprintf(fp,fmt,__VA_ARGS__)
+/* These next 3 macros are for emitting simple string literals. */
# define oputz(z) fputs(z,stdout)
-# define oputf printf
# define eputz(z) fputs(z,stderr)
-# define eputf(fmt, ...) fprintf(stderr,fmt,__VA_ARGS__)
+# define sputz(fp,z) fputs(z,fp)
# define oputb(buf,na) fwrite(buf,1,na,stdout)
#endif
@@ -11079,7 +11088,7 @@ static int do_meta_command(char *zLine, ShellState *p){
}
}
if( bShowHelp ){
- oputf(
+ oputz(
"Usage: .testctrl fault_install ARGS\n"
"Possible arguments:\n"
" off Disable faultsim\n"