From 1d5dffa7a604dda1f799a55a669849d45ddbc070 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 26 Jan 2023 07:28:43 +0100 Subject: [PATCH] printf annotation compatible with MSVC --- src/runtime/c/pgf/printer.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/runtime/c/pgf/printer.h b/src/runtime/c/pgf/printer.h index 678720dde..f32c80d7b 100644 --- a/src/runtime/c/pgf/printer.h +++ b/src/runtime/c/pgf/printer.h @@ -48,7 +48,20 @@ public: // buf_size is the expected buffer size. If larger is needed, // it will be allocated automatically. +#if defined(_MSC_VER) +#if _MSC_VER >= 1400 +# include +# if _MSC_VER > 1400 + void nprintf(size_t buf_size, _Printf_format_string_ const char *format, ...); +# else + void nprintf(size_t buf_size, __format_string const char *format, ...); +# endif /* FORMAT_STRING */ +#else + void nprintf(size_t buf_size, const char *format, ...); +#endif /* _MSC_VER */ +#else void nprintf(size_t buf_size, const char *format, ...) __attribute__ ((format (printf, 3, 4))); +#endif PgfText *get_text();