Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2020-01-26 17:49:31 +0300
committerSimon Tatham <anakin@pobox.com>2020-01-26 19:35:04 +0300
commitcbfba7a0e954fe0f2c3602594fa609be21a35833 (patch)
treeeb5a7f109382c3f33e2218361b75f18e09d8f2f6 /cmdgen.c
parent0a4e068adaa6162d2d42a33a23e7687e19525a81 (diff)
Greatly improve printf format-string checking.
I've added the gcc-style attribute("printf") to a lot of printf-shaped functions in this code base that didn't have it. To make that easier, I moved the wrapping macro into defs.h, and also enabled it if we detect the __clang__ macro as well as __GNU__ (hence, it will be used when building for Windows using clang-cl). The result is that a great many format strings in the code are now checked by the compiler, where they were previously not. This causes build failures, which I'll fix in the next commit.
Diffstat (limited to 'cmdgen.c')
-rw-r--r--cmdgen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmdgen.c b/cmdgen.c
index 286c12e9..dbac992c 100644
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -1205,7 +1205,7 @@ void test(int retval, ...)
sfree(argv);
}
-void filecmp(char *file1, char *file2, char *fmt, ...)
+PRINTF_LIKE(3, 4) void filecmp(char *file1, char *file2, char *fmt, ...)
{
/*
* Ideally I should do file comparison myself, to maximise the
@@ -1303,7 +1303,7 @@ char *get_fp(char *filename, unsigned flags)
return toret;
}
-void check_fp(char *filename, char *fp, char *fmt, ...)
+PRINTF_LIKE(3, 4) void check_fp(char *filename, char *fp, char *fmt, ...)
{
char *newfp;