Browse code

Add printf-format-string warnings to wi_add, wi_config and wi_pack prototypes when compiling with gcc

Dario Rodriguez authored on 27/03/2022 13:04:10
Showing 1 changed files
... ...
@@ -24,6 +24,14 @@
24 24
 #define WI_FRAME "frame"
25 25
 #define WI_IMAGE "image"
26 26
 
27
+/* debug info */
28
+#ifndef _F
29
+#define _F __FILE__
30
+#endif
31
+#ifndef _L
32
+#define _L __LINE__
33
+#endif
34
+
27 35
 /* structs */
28 36
 typedef struct xywh_t {
29 37
         int x;
... ...
@@ -195,9 +203,15 @@ int wi_class_unregister(wi_t *wi, char *classname);
195 203
 int wi_toplevel_set(wi_t *wi, char *name);
196 204
 int wi_toplevel_destroy(wi_t *wi, char *name);
197 205
 
206
+#ifndef __GNUC__
198 207
 char *wi_add(wi_t *wi, char *debugfile, int debugline, char *class, char *path, char *format,...);
199 208
 char *wi_config(wi_t *wi, char *debugfile, int debugline, char *path, char *format,...);
200 209
 int wi_pack(wi_t *wi, char *debugfile, int debugline, char *path, char *format,...);
210
+#else
211
+  char *wi_add(wi_t *wi, char *debugfile, int debugline, char *class, char *path, char *format,...) __attribute__ ((format (printf,6,7));
212
+  char *wi_config(wi_t *wi, char *debugfile, int debugline, char *path, char *format,...) __attribute__ ((format (printf,5,6));
213
+  int wi_pack(wi_t *wi, char *debugfile, int debugline, char *path, char *format,...) __attribute__ ((format (printf,5,6));
214
+#endif
201 215
 int wi_destroy(wi_t *wi, char *path);
202 216
 
203 217
 int wi_alias_set(wi_t *wi, char *alias, char *path);