aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-07-05 16:23:58 +0200
committerPierre Ossman <ossman@cendio.se>2023-07-05 16:23:58 +0200
commit4d7a261e7bd7412d7accaae4ec1c133e0b8d4bed (patch)
tree11db3742aa08570e1deeecf1bda270e80c75a987
parentfad215db386d5aa0d40bd99625f99e6bd64f2904 (diff)
downloadtigervnc-4d7a261e7bd7412d7accaae4ec1c133e0b8d4bed.tar.gz
tigervnc-4d7a261e7bd7412d7accaae4ec1c133e0b8d4bed.zip
Unbreak -Wformat warnings when gettext is used
gettext replaces all *printf() functions on platforms that don't fully conform to the POSIX behaviour. Unfortunately, gettext fails to tag these replacement functions properly so that -Wformat can still do its thing. Resolve this by adding a redudant declaration of the relevant functions, with the attribute tagging in place.
-rw-r--r--vncviewer/i18n.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/vncviewer/i18n.h b/vncviewer/i18n.h
index 4a50b17c..0806d319 100644
--- a/vncviewer/i18n.h
+++ b/vncviewer/i18n.h
@@ -1,5 +1,5 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB
+ * Copyright 2011-2023 Pierre Ossman <ossman@cendio.se> for Cendio AB
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,6 +30,28 @@ pgettext_aux (const char *domain,
#include "gettext.h"
+/* gettext breaks -Wformat (upstream bug 64384) */
+#if defined(__GNUC__) && defined(printf)
+extern int fprintf (FILE *, const char *, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
+extern int printf (const char *, ...)
+ __attribute__((__format__ (__printf__, 1, 2)));
+extern int sprintf (char *, const char *, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
+extern int snprintf (char *, size_t, const char *, ...)
+ __attribute__((__format__ (__printf__, 3, 4)));
+extern int asprintf (char **, const char *, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
+#endif
+#if defined(__GNUC__) && defined(wprintf)
+extern int fwprintf (FILE *, const wchar_t *, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
+extern int wprintf (const wchar_t *, ...)
+ __attribute__((__format__ (__printf__, 1, 2)));
+extern int swprintf (wchar_t *, size_t, const wchar_t *, ...)
+ __attribute__((__format__ (__printf__, 3, 4)));
+#endif
+
#define _(String) gettext (String)
#define p_(Context, String) pgettext (Context, String)
#define N_(String) gettext_noop (String)