diff options
| author | Benjamin Linskey | 2026-06-11 14:16:00 -0400 |
|---|---|---|
| committer | Benjamin Linskey | 2026-06-11 14:30:24 -0400 |
| commit | a9d7e18a04ed71226529106697ddb43ba6b7c2b8 (patch) | |
| tree | ba01084077b79d9b279fd46e4118dd26f48d4da4 | |
| parent | e2528bc96c637bdb93a2aa6ac82195df54631ebc (diff) | |
| download | rogue-port.tar.gz | |
Switch to C23 and use [[noreturn]] attribute
portThe __dead attribute is not standard on FreeBSD (which uses __dead2 instead) or Linux. C23 provides the [[noreturn]] attribute, which accomplishes the same thing in a portable manner. (C11 provides _Noreturn/noreturn, but this is deprecated in C23. C23 also provides us with memccpy(), which we can use to replace strlcpy() and strlcat(), so we might as well make the jump.)
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | rogue.h | 12 | ||||
| -rw-r--r-- | score.c | 2 |
3 files changed, 8 insertions, 8 deletions
@@ -10,7 +10,7 @@ MAN_DIR = $(PREFIX)/share/man/man6 MAN = rogue.6 CC = cc -CFLAGS = -std=c99 -O2 -Wall -Wextra -Wpedantic +CFLAGS = -std=c23 -O2 -Wall -Wextra -Wpedantic CPPFLAGS = -DUNIX -DUNIX_SYSV -Dlint LDLIBS = -lcurses @@ -471,7 +471,7 @@ void check_gold_seeker(object *); boolean check_imitator(object *); void check_message(void); int check_up(void); -void clean_up(const char *) __dead; +[[noreturn]] void clean_up(const char *); void clear_level(void); void cnfs(void); int coin_toss(void); @@ -488,7 +488,7 @@ void drop(void); int drop_check(void); void eat(void); void edit_opts(void); -void error_save(int) __dead; +[[noreturn]] void error_save(int); void fight(boolean); boolean flame_broil(object *); void free_object(object *); @@ -531,7 +531,7 @@ boolean is_direction(short, short *); boolean is_passable(int, int); boolean is_vowel(short); void kick_into_pack(void); -void killed_by(const object *, short) __dead; +[[noreturn]] void killed_by(const object *, short); long lget_number(const char *); void light_passage(int, int); void light_up_room(int); @@ -539,7 +539,7 @@ boolean m_confuse(object *); void make_level(void); void make_scroll_titles(void); boolean md_df(const char *); -void md_exit(int) __dead; +[[noreturn]] void md_exit(int); void md_gct(struct rogue_time *); int md_get_file_id(const char *); void md_gfmt(const char *, struct rogue_time *); @@ -580,7 +580,7 @@ void put_mons(void); void put_objects(void); void put_on_ring(void); void put_player(short); -void put_scores(const object *, short) __dead; +[[noreturn]] void put_scores(const object *, short); void put_stairs(void); void quaff(void); void quit(boolean); @@ -636,7 +636,7 @@ void wake_up(object *); void wanderer(void); void wear(void); void wield(void); -void win(void) __dead; +[[noreturn]] void win(void); void wizardize(void); long xxx(boolean); void xxxx(char *, short); @@ -63,7 +63,7 @@ static void center(short, const char *); static int get_value(const object *); static void id_all(void); static void sell_pack(void); -static void sf_error(void) __dead; +[[noreturn]] static void sf_error(void); void killed_by(const object *monster, short other) |