From 8ce13b8b9f1411a90e84ef6aee8c8409cb845acf Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 24 Feb 2023 10:25:33 -0500 Subject: Add function attributes --- (limited to 'src') diff --git a/src/init.h b/src/init.h index b30c27f..105970e 100644 --- a/src/init.h +++ b/src/init.h @@ -22,6 +22,6 @@ #include void init(void); -void quit(int status); +void quit(int status) __attribute__((__noreturn__)); #endif diff --git a/src/logging.h b/src/logging.h index 12c9b00..4ad66bc 100644 --- a/src/logging.h +++ b/src/logging.h @@ -19,8 +19,9 @@ #ifndef LOGGING_H #define LOGGING_H -void debug(const char *fmt, ...); -void warn(const char *fmt, ...); -void err(int status, const char *fmt, ...); +void debug(const char *fmt, ...) __attribute__((__format__(printf, 1, 2))); +void warn(const char *fmt, ...) __attribute__((__format__(printf, 1, 2))); +void err(int status, const char *fmt, ...) + __attribute__((__format__(printf, 2, 3))) __attribute__((__noreturn__)); #endif diff --git a/src/resources/map.h b/src/resources/map.h index 73f004e..0d6b21e 100644 --- a/src/resources/map.h +++ b/src/resources/map.h @@ -112,8 +112,10 @@ struct map { struct map *map_get(const char *path); void map_free(struct map *map); void map_add_tileset(struct map *m, struct tileset *t, Uint32 firstgid); -struct map_palette *map_get_palette(struct map *m, const char *name); -struct layer *map_get_layer(struct map *m, const char *name); +struct map_palette *map_get_palette(struct map *m, const char *name) + __attribute__((__pure__)); +struct layer *map_get_layer(struct map *m, const char *name) + __attribute__((__pure__)); void map_add_exit(struct map *m, struct map_exit *e); #endif diff --git a/src/xml.h b/src/xml.h index 55207a3..62a2f46 100644 --- a/src/xml.h +++ b/src/xml.h @@ -22,7 +22,8 @@ #include #include -int xml_check_tag(const char *found, const char *expected); +int xml_check_tag(const char *found, const char *expected) + __attribute__((__pure__)); void xml_unexpected_start_tag(XML_Parser p, const char *found, const char *expected); void xml_unexpected_end_tag(XML_Parser p, const char *found, @@ -37,6 +38,6 @@ void xml_node_push(XML_Parser p, void *data, XML_StartElementHandler start, XML_EndElementHandler end, XML_CharacterDataHandler charhndl); void *xml_node_pop(XML_Parser p); -void *xml_node_peek(XML_Parser p); +void *xml_node_peek(XML_Parser p) __attribute__((__pure__)); #endif -- cgit v0.9.1