compiler: bring the unreachable macro in line with C23

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2023-12-17 08:50:47 +00:00
parent 47bb825b2c
commit 1b97f18e5f
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
4 changed files with 9 additions and 7 deletions

View File

@ -1336,7 +1336,7 @@ static xcb_atom_t c2_get_atom_type(const c2_l_t *pleaf) {
case C2_L_TDRAWABLE: return XCB_ATOM_DRAWABLE;
default: assert(0); break;
}
unreachable;
unreachable();
}
/**

View File

@ -101,10 +101,12 @@
# endif
#endif
#if defined(__GNUC__) || defined(__clang__)
# define unreachable __builtin_unreachable()
#else
# define unreachable do {} while(0)
#ifndef unreachable
# if defined(__GNUC__) || defined(__clang__)
# define unreachable() __builtin_unreachable()
# else
# define unreachable() do {} while(0)
# endif
#endif
#ifndef __has_include

View File

@ -30,7 +30,7 @@ void report_allocation_failure(const char *func, const char *file, unsigned int
ssize_t _ attr_unused = writev(STDERR_FILENO, v, ARR_SIZE(v));
abort();
unreachable;
unreachable();
}
///

View File

@ -2433,7 +2433,7 @@ bool win_check_fade_finished(session_t *ps, struct managed_win *w) {
case WSTATE_DESTROYING: destroy_win_finish(ps, &w->base); return true;
case WSTATE_MAPPING: map_win_finish(w); return false;
case WSTATE_FADING: w->state = WSTATE_MAPPED; break;
default: unreachable;
default: unreachable();
}
}