use compiler extension instead of C11 noreturn

C11 noreturn isn't available in C++.
This commit is contained in:
Daniel Micay 2021-11-23 15:59:52 -05:00
parent 7106bff27f
commit d8817417cc
2 changed files with 3 additions and 3 deletions

2
new.cc
View File

@ -1,8 +1,6 @@
#include <bits/functexcept.h> #include <bits/functexcept.h>
#include <new> #include <new>
#define noreturn
#include "h_malloc.h" #include "h_malloc.h"
#include "util.h" #include "util.h"

4
util.h
View File

@ -2,7 +2,9 @@
#define UTIL_H #define UTIL_H
#include <stdint.h> #include <stdint.h>
#include <stdnoreturn.h>
// C11 noreturn doesn't work in C++
#define noreturn __attribute__((noreturn))
#define likely(x) __builtin_expect(!!(x), 1) #define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0) #define unlikely(x) __builtin_expect(!!(x), 0)