Skip to content

Commit

Permalink
pango: add printf attribute
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
emersion committed Apr 14, 2023
1 parent aab4c9d commit bd58df6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/pango.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdint.h>
#include <cairo.h>
#include <pango/pangocairo.h>
#include "stringop.h"

/**
* Utility function which escape characters a & < > ' ".
Expand All @@ -16,9 +17,9 @@ size_t escape_markup_text(const char *src, char *dest);
PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
const char *text, double scale, bool markup);
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 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
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_project_arguments(
'-Wno-unused-parameter',
'-Wno-unused-result',
'-Wno-missing-braces',
'-Wno-format-zero-length',
'-Wundef',
'-Wvla',
],
Expand Down

0 comments on commit bd58df6

Please sign in to comment.