pango: add printf attribute

This allows the compiler to catch mismatches between the format
string and the arguments passed in.

Need to add -Wno-format-zero-length because we pass an empty string
on purpose in swaybar/render.c.
master
Simon Ser 2 years ago
parent aab4c9da5f
commit bd58df61ef

@ -5,6 +5,7 @@
#include <stdint.h> #include <stdint.h>
#include <cairo.h> #include <cairo.h>
#include <pango/pangocairo.h> #include <pango/pangocairo.h>
#include "stringop.h"
/** /**
* Utility function which escape characters a & < > ' ". * Utility function which escape characters a & < > ' ".
@ -16,9 +17,9 @@ size_t escape_markup_text(const char *src, char *dest);
PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc, PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
const char *text, double scale, bool markup); const char *text, double scale, bool markup);
void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height, void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...); int *baseline, double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(8, 9);
void get_text_metrics(const PangoFontDescription *desc, int *height, int *baseline); void get_text_metrics(const PangoFontDescription *desc, int *height, int *baseline);
void render_text(cairo_t *cairo, PangoFontDescription *desc, void render_text(cairo_t *cairo, PangoFontDescription *desc,
double scale, bool markup, const char *fmt, ...); double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(5, 6);
#endif #endif

@ -18,6 +18,7 @@ add_project_arguments(
'-Wno-unused-parameter', '-Wno-unused-parameter',
'-Wno-unused-result', '-Wno-unused-result',
'-Wno-missing-braces', '-Wno-missing-braces',
'-Wno-format-zero-length',
'-Wundef', '-Wundef',
'-Wvla', '-Wvla',
], ],

Loading…
Cancel
Save