From fe8ab0045eba1d4673388bd45f6553b2e524daa0 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Mon, 27 Jul 2009 17:17:24 +0000 Subject: [PATCH] local synctex change: _synctex_error has a printf-like format, so use the proper gcc extensions to check its arguments (doing nothing for other compilers) add the change as local patch 04-gcc-specify-printf-format.diff svn path=/trunk/KDE/kdegraphics/okular/; revision=1003104 --- .../patches/04-gcc-specify-printf-format.diff | 26 +++++++++++++++++++ generators/poppler/synctex/patches/series | 1 + .../poppler/synctex/synctex_parser_utils.h | 8 +++++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 generators/poppler/synctex/patches/04-gcc-specify-printf-format.diff diff --git a/generators/poppler/synctex/patches/04-gcc-specify-printf-format.diff b/generators/poppler/synctex/patches/04-gcc-specify-printf-format.diff new file mode 100644 index 000000000..d50f5691d --- /dev/null +++ b/generators/poppler/synctex/patches/04-gcc-specify-printf-format.diff @@ -0,0 +1,26 @@ +Index: synctex/synctex_parser_utils.h +=================================================================== +--- synctex.orig/synctex_parser_utils.h 2009-07-27 19:10:23.000000000 +0200 ++++ synctex/synctex_parser_utils.h 2009-07-27 19:13:43.000000000 +0200 +@@ -58,6 +58,12 @@ + # define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c) + # endif + ++# ifdef __GNUC__ ++# define SYNCTEX_PRINTF_FORMAT(si, ftc) __attribute__ ((format (printf, si, ftc))) ++# else ++# define SYNCTEX_PRINTF_FORMAT(si, ftc) ++# endif ++ + /* This custom malloc functions initializes to 0 the newly allocated memory. + * There is no bzero function on windows. */ + void *_synctex_malloc(size_t size); +@@ -65,7 +71,7 @@ + /* This is used to log some informational message to the standard error stream. + * On Windows, the stderr stream is not exposed and another method is used. + * The return value is the number of characters printed. */ +-int _synctex_error(const char * reason,...); ++int _synctex_error(const char * reason,...) SYNCTEX_PRINTF_FORMAT(1, 2); + + /* strip the last extension of the given string, this string is modified! + * This function depends on the OS because the path separator may differ. diff --git a/generators/poppler/synctex/patches/series b/generators/poppler/synctex/patches/series index 6ed0b5e96..9ac0a9874 100644 --- a/generators/poppler/synctex/patches/series +++ b/generators/poppler/synctex/patches/series @@ -1,3 +1,4 @@ 01-fix-win32-define.diff 02-fix-_synctex_error.diff 03-fix-_synctex_scan_named.diff +04-gcc-specify-printf-format.diff diff --git a/generators/poppler/synctex/synctex_parser_utils.h b/generators/poppler/synctex/synctex_parser_utils.h index a22de2808..f4a453258 100644 --- a/generators/poppler/synctex/synctex_parser_utils.h +++ b/generators/poppler/synctex/synctex_parser_utils.h @@ -58,6 +58,12 @@ extern "C" { # define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c) # endif +# ifdef __GNUC__ +# define SYNCTEX_PRINTF_FORMAT(si, ftc) __attribute__ ((format (printf, si, ftc))) +# else +# define SYNCTEX_PRINTF_FORMAT(si, ftc) +# endif + /* This custom malloc functions initializes to 0 the newly allocated memory. * There is no bzero function on windows. */ void *_synctex_malloc(size_t size); @@ -65,7 +71,7 @@ void *_synctex_malloc(size_t size); /* This is used to log some informational message to the standard error stream. * On Windows, the stderr stream is not exposed and another method is used. * The return value is the number of characters printed. */ -int _synctex_error(const char * reason,...); +int _synctex_error(const char * reason,...) SYNCTEX_PRINTF_FORMAT(1, 2); /* strip the last extension of the given string, this string is modified! * This function depends on the OS because the path separator may differ.