diff options
author | Khem Raj <raj.khem@gmail.com> | 2019-11-15 12:45:13 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-11-17 12:34:21 -0800 |
commit | 599304fb377187eb900261d4eda66de39abaf664 (patch) | |
tree | 1f9c8cf81cae3bdba4dd077f26ff133288cf0804 | |
parent | 5ad8fb181e4f113901ebaa045b6a903afa367e78 (diff) | |
download | meta-openembedded-599304fb377187eb900261d4eda66de39abaf664.tar.gz |
evince: Fix build with clang
Enhance the patch for printf format checking to make clang work as well
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Andreas Müller <schnitzeltony@gmail.com>
-rw-r--r-- | meta-gnome/recipes-gnome/evince/evince/0002-add-a-formatting-attribute-check.patch | 96 |
1 files changed, 92 insertions, 4 deletions
diff --git a/meta-gnome/recipes-gnome/evince/evince/0002-add-a-formatting-attribute-check.patch b/meta-gnome/recipes-gnome/evince/evince/0002-add-a-formatting-attribute-check.patch index e87da90bce..c374fc9430 100644 --- a/meta-gnome/recipes-gnome/evince/evince/0002-add-a-formatting-attribute-check.patch +++ b/meta-gnome/recipes-gnome/evince/evince/0002-add-a-formatting-attribute-check.patch | |||
@@ -19,16 +19,104 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
19 | cut-n-paste/unarr/common/unarr.c | 2 +- | 19 | cut-n-paste/unarr/common/unarr.c | 2 +- |
20 | 1 file changed, 1 insertion(+), 1 deletion(-) | 20 | 1 file changed, 1 insertion(+), 1 deletion(-) |
21 | 21 | ||
22 | diff --git a/cut-n-paste/unarr/common/unarr.c b/cut-n-paste/unarr/common/unarr.c | ||
23 | index 97ec92a..9e6e3ad 100644 | ||
24 | --- a/cut-n-paste/unarr/common/unarr.c | 22 | --- a/cut-n-paste/unarr/common/unarr.c |
25 | +++ b/cut-n-paste/unarr/common/unarr.c | 23 | +++ b/cut-n-paste/unarr/common/unarr.c |
26 | @@ -92,7 +92,7 @@ size_t ar_get_global_comment(ar_archive *ar, void *buffer, size_t count) | 24 | @@ -92,7 +92,7 @@ size_t ar_get_global_comment(ar_archive |
27 | return ar->get_comment(ar, buffer, count); | 25 | return ar->get_comment(ar, buffer, count); |
28 | } | 26 | } |
29 | 27 | ||
30 | -void ar_log(const char *prefix, const char *file, int line, const char *msg, ...) | 28 | -void ar_log(const char *prefix, const char *file, int line, const char *msg, ...) |
31 | +void __attribute__((__format__ (__printf__, 4, 0))) ar_log(const char *prefix, const char *file, int line, const char *msg, ...) | 29 | +void __attribute__((__format__ (__printf__, 4, 5))) ar_log(const char *prefix, const char *file, int line, const char *msg, ...) |
32 | { | 30 | { |
33 | va_list args; | 31 | va_list args; |
34 | va_start(args, msg); | 32 | va_start(args, msg); |
33 | --- a/cut-n-paste/synctex/synctex_parser_utils.c | ||
34 | +++ b/cut-n-paste/synctex/synctex_parser_utils.c | ||
35 | @@ -87,11 +87,11 @@ void _synctex_free(void * ptr) { | ||
36 | # include <syslog.h> | ||
37 | #endif | ||
38 | |||
39 | -int _synctex_error(const char * reason, ...) __attribute__((__format__ (__printf__, 1, 2))); | ||
40 | -int _synctex_log(int level, const char * prompt, const char * reason, va_list arg) __attribute__((__format__ (__printf__, 3, 0))); | ||
41 | - | ||
42 | -int _synctex_log(int level, const char * prompt, const char * reason,va_list arg) { | ||
43 | +static int _synctex_log(int level, const char * prompt, const char * reason, ...) SYNCTEX_PRINTF_FORMAT(3, 0); | ||
44 | +static int _synctex_log(int level, const char * prompt, const char * reason, ...) { | ||
45 | + va_list arg; | ||
46 | int result; | ||
47 | + va_start(arg, reason); | ||
48 | # ifdef SYNCTEX_RECENT_WINDOWS | ||
49 | {/* This code is contributed by William Blum. | ||
50 | As it does not work on some older computers, | ||
51 | @@ -133,10 +133,10 @@ int _synctex_log(int level, const char * | ||
52 | result += vfprintf(where, reason, arg); | ||
53 | result += fprintf(where,"\n"); | ||
54 | # endif | ||
55 | + va_end(arg); | ||
56 | return result; | ||
57 | } | ||
58 | |||
59 | -__attribute__((__format__ (__printf__, 1, 0))) | ||
60 | int _synctex_error(const char * reason,...) { | ||
61 | va_list arg; | ||
62 | int result; | ||
63 | @@ -355,6 +355,7 @@ char * _synctex_merge_strings(const char | ||
64 | size_t len = strlen(temp); | ||
65 | if(UINT_MAX-len<size) { | ||
66 | _synctex_error("! _synctex_merge_strings: Capacity exceeded."); | ||
67 | + va_end(arg); | ||
68 | return NULL; | ||
69 | } | ||
70 | size+=len; | ||
71 | @@ -374,6 +375,7 @@ char * _synctex_merge_strings(const char | ||
72 | if(dest != strncpy(dest,temp,size)) { | ||
73 | _synctex_error("! _synctex_merge_strings: Copy problem"); | ||
74 | free(result); | ||
75 | + va_end(arg); | ||
76 | result = NULL; | ||
77 | return NULL; | ||
78 | } | ||
79 | --- a/cut-n-paste/synctex/synctex_parser.c | ||
80 | +++ b/cut-n-paste/synctex/synctex_parser.c | ||
81 | @@ -8411,6 +8411,7 @@ struct synctex_updater_t { | ||
82 | int length; /* the number of chars appended */ | ||
83 | }; | ||
84 | |||
85 | +static int _synctex_updater_print(synctex_updater_p updater, const char * format, ...) SYNCTEX_PRINTF_FORMAT(2, 3); | ||
86 | static int _synctex_updater_print(synctex_updater_p updater, const char * format, ...) { | ||
87 | int result = 0; | ||
88 | if (updater) { | ||
89 | @@ -8447,6 +8448,7 @@ static int vasprintf(char **ret, | ||
90 | /** | ||
91 | * gzvprintf is not available until OSX 10.10 | ||
92 | */ | ||
93 | +static int _synctex_updater_print_gz(synctex_updater_p updater, const char * format, ...) SYNCTEX_PRINTF_FORMAT(2, 3); | ||
94 | static int _synctex_updater_print_gz(synctex_updater_p updater, const char * format, ...) { | ||
95 | int result = 0; | ||
96 | if (updater) { | ||
97 | --- a/cut-n-paste/synctex/synctex_parser_utils.h | ||
98 | +++ b/cut-n-paste/synctex/synctex_parser_utils.h | ||
99 | @@ -85,7 +85,11 @@ extern "C" { | ||
100 | # else | ||
101 | # define SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(left,right) (toupper(left) != toupper(right)) | ||
102 | # endif | ||
103 | - | ||
104 | +# ifdef __GNUC__ | ||
105 | +# define SYNCTEX_PRINTF_FORMAT(si, ftc) __attribute__ ((format (printf, si, ftc))) | ||
106 | +# else | ||
107 | +# define SYNCTEX_PRINTF_FORMAT(si, ftc) | ||
108 | +# endif | ||
109 | /* This custom malloc functions initializes to 0 the newly allocated memory. | ||
110 | * There is no bzero function on windows. */ | ||
111 | void *_synctex_malloc(size_t size); | ||
112 | @@ -97,8 +101,8 @@ void _synctex_free(void * ptr); | ||
113 | /* This is used to log some informational message to the standard error stream. | ||
114 | * On Windows, the stderr stream is not exposed and another method is used. | ||
115 | * The return value is the number of characters printed. */ | ||
116 | - int _synctex_error(const char * reason,...); | ||
117 | - int _synctex_debug(const char * reason,...); | ||
118 | + int _synctex_error(const char * reason,...) SYNCTEX_PRINTF_FORMAT(1, 2); | ||
119 | + int _synctex_debug(const char * reason,...) SYNCTEX_PRINTF_FORMAT(1, 2); | ||
120 | |||
121 | /* strip the last extension of the given string, this string is modified! | ||
122 | * This function depends on the OS because the path separator may differ. | ||