summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2023-02-24 10:25:33 (EST)
committer P. J. McDermott <pj@pehjota.net>2023-02-24 10:25:33 (EST)
commit8ce13b8b9f1411a90e84ef6aee8c8409cb845acf (patch)
tree3ef77d1b2dabd8eee175cfa919d9f239e3a72ee5 /src
parent7df50e1dafa5dbd8c061e1eb4e2f5729b66f0ef4 (diff)
downloadoverworld-rpg-8ce13b8b9f1411a90e84ef6aee8c8409cb845acf.zip
overworld-rpg-8ce13b8b9f1411a90e84ef6aee8c8409cb845acf.tar.gz
overworld-rpg-8ce13b8b9f1411a90e84ef6aee8c8409cb845acf.tar.bz2
Add function attributes
Diffstat (limited to 'src')
-rw-r--r--src/init.h2
-rw-r--r--src/logging.h7
-rw-r--r--src/resources/map.h6
-rw-r--r--src/xml.h5
4 files changed, 12 insertions, 8 deletions
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 <SDL.h>
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 <expat.h>
#include <SDL_stdinc.h>
-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