Fix bugs in cosmocc toolchain

This change integrates e58abc1110b335a3341e8ad5821ad8e3880d9bb2 from
https://github.com/ahgamut/musl-cross-make/ which fixes the issues we
were having with our C language extension for symbolic constants. This
change also performs some code cleanup and bug fixes to getaddrinfo().
It's now possible to compile projects like ncurses, readline and python
without needing to patch anything upstream, except maybe a line or two.
Pretty soon it should be possible to build a Linux distro on Cosmo.
This commit is contained in:
Justine Tunney 2023-06-08 23:44:03 -07:00
parent 22f81a8d50
commit 23e235b7a5
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
272 changed files with 3491 additions and 4350 deletions

View file

@ -12,7 +12,7 @@
// [jart] use undefined behaavior to make code tinier
// use ubsan build mode to troubleshoot errors
#define DOUBLE_CONVERSION_ASSERT(x) _unassert(x)
#define DOUBLE_CONVERSION_UNREACHABLE() unreachable
#define DOUBLE_CONVERSION_UNREACHABLE() __builtin_unreachable()
#define DOUBLE_CONVERSION_UNIMPLEMENTED() notpossible
// Use DOUBLE_CONVERSION_NON_PREFIXED_MACROS to get unprefixed macros as was

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-addr2line.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-ar.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-as.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-c++filt.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-cpp.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-elfedit.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-g++.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-gcc-ar.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-gcc-nm.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-gcc-ranlib.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-gcc.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-gcov-dump.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-gcov-tool.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-gcov.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-gprof.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-nm.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-objcopy.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-objdump.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-ranlib.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-readelf.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-size.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-strings.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/bin/x86_64-linux-musl-strip.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/libexec/gcc/x86_64-linux-musl/11.2.0/cc1.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/libexec/gcc/x86_64-linux-musl/11.2.0/cc1plus.gz vendored Normal file → Executable file

Binary file not shown.

BIN
third_party/gcc/libexec/gcc/x86_64-linux-musl/11.2.0/collect2.gz vendored Normal file → Executable file

Binary file not shown.

View file

@ -2,14 +2,16 @@
ARCH=${1:-aarch64}
IMPORT=${2:-/opt/cross11portcosmo}
PREFIX=third_party/gcc/
OLDVERSION=9.2.0
PREFIX=third_party/gcc
OLDVERSION=11.2.0
NEWVERSION=11.2.0
rm -rf o/third_party/gcc
mv $PREFIX/libexec/gcc/$ARCH-linux-musl/$OLDVERSION $PREFIX/libexec/gcc/$ARCH-linux-musl/$NEWVERSION
mv $PREFIX/lib/gcc/$ARCH-linux-musl/$OLDVERSION $PREFIX/lib/gcc/$ARCH-linux-musl/$NEWVERSION
sed -i -e "s/$OLDVERSION/$NEWVERSION/g" $(find $PREFIX -name \*.sym | grep $ARCH)
if [ $OLDVERSION != $NEWVERSION ]; then
mv $PREFIX/libexec/gcc/$ARCH-linux-musl/$OLDVERSION $PREFIX/libexec/gcc/$ARCH-linux-musl/$NEWVERSION
mv $PREFIX/lib/gcc/$ARCH-linux-musl/$OLDVERSION $PREFIX/lib/gcc/$ARCH-linux-musl/$NEWVERSION
sed -i -e "s/$OLDVERSION/$NEWVERSION/g" $(find $PREFIX -name \*.sym | grep $ARCH)
fi
FILES="
$ARCH-linux-musl/bin/ld.bfd
@ -42,5 +44,6 @@ bin/$ARCH-linux-musl-gcc-ar
"
for f in $FILES; do
gzip -9 <$IMPORT/$f >$PREFIX/$f.gz || exit
cp -f $IMPORT/$f $PREFIX/$f || exit
gzip -f9 $PREFIX/$f || exit
done

BIN
third_party/gcc/x86_64-linux-musl/bin/ld.bfd.gz vendored Normal file → Executable file

Binary file not shown.

View file

@ -591,7 +591,7 @@ static size_t GetMonospaceWidth(const char *p, size_t n, char *out_haswides) {
}
break;
default:
unreachable;
__builtin_unreachable();
}
}
if (out_haswides) {
@ -2262,7 +2262,7 @@ ssize_t linenoiseEdit(struct linenoiseState *l, const char *prompt, char **obuf,
}
}
default:
unreachable;
__builtin_unreachable();
}
}

View file

@ -1524,7 +1524,7 @@ LUA_API int lua_error (lua_State *L) {
else
luaG_errormsg(L); /* raise a regular error */
/* code unreachable; will unlock when control actually leaves the kernel */
unreachable;
__builtin_unreachable();
}

View file

@ -274,6 +274,6 @@ int LuaEncodeJsonData(lua_State *L, char **buf, int idx,
return rc;
} else {
luaL_error(L, "can't set stack depth");
unreachable;
__builtin_unreachable();
}
}

View file

@ -437,6 +437,6 @@ int LuaEncodeLuaData(lua_State *L, char **buf, int idx,
return rc;
} else {
luaL_error(L, "can't set stack depth");
unreachable;
__builtin_unreachable();
}
}

View file

@ -146,7 +146,7 @@ static void *LuaAllocOrDie(lua_State *L, size_t n) {
return p;
} else {
luaL_error(L, "out of memory");
unreachable;
__builtin_unreachable();
}
}
@ -253,7 +253,7 @@ static int MakeSockaddr(lua_State *L, int i, struct sockaddr_storage *ss,
if (!memccpy(((struct sockaddr_un *)ss)->sun_path, luaL_checkstring(L, i),
0, sizeof(((struct sockaddr_un *)ss)->sun_path))) {
luaL_error(L, "unix path too long");
unreachable;
__builtin_unreachable();
}
*salen = sizeof(struct sockaddr_un);
return i + 1;
@ -278,7 +278,7 @@ static int PushSockaddr(lua_State *L, const struct sockaddr_storage *ss) {
return 1;
} else {
luaL_error(L, "bad family");
unreachable;
__builtin_unreachable();
}
}
@ -1738,7 +1738,7 @@ static int LuaUnixSigaction(lua_State *L) {
sig = luaL_checkinteger(L, 1);
if (!(1 <= sig && sig <= NSIG)) {
luaL_argerror(L, 1, "signal number invalid");
unreachable;
__builtin_unreachable();
}
if (lua_isnoneornil(L, 2)) {
// if handler/flags/mask aren't passed,
@ -1766,7 +1766,7 @@ static int LuaUnixSigaction(lua_State *L) {
lua_pop(L, 1);
} else {
luaL_argerror(L, 2, "sigaction handler not integer or function");
unreachable;
__builtin_unreachable();
}
if (!lua_isnoneornil(L, 4)) {
mask = luaL_checkudata(L, 4, "unix.Sigset");
@ -2685,7 +2685,7 @@ static int LuaUnixMemoryRead(lua_State *L) {
// extracts nul-terminated string
if (i > m->size) {
luaL_error(L, "out of range");
unreachable;
__builtin_unreachable();
}
n = strnlen(m->u.bytes + i, m->size - i);
} else {
@ -2694,7 +2694,7 @@ static int LuaUnixMemoryRead(lua_State *L) {
n = luaL_checkinteger(L, 3);
if (i > m->size || n >= m->size || i + n > m->size) {
luaL_error(L, "out of range");
unreachable;
__builtin_unreachable();
}
}
pthread_mutex_lock(m->lock);
@ -2723,7 +2723,7 @@ static int LuaUnixMemoryWrite(lua_State *L) {
}
if (i > m->size) {
luaL_error(L, "out of range");
unreachable;
__builtin_unreachable();
}
if (lua_isnoneornil(L, b)) {
// unix.Memory:write(data:str[, offset:int])
@ -2743,13 +2743,13 @@ static int LuaUnixMemoryWrite(lua_State *L) {
j = luaL_checkinteger(L, b);
if (j > n) {
luaL_argerror(L, b, "bytes is more than what's in data");
unreachable;
__builtin_unreachable();
}
n = j;
}
if (i + n > m->size) {
luaL_error(L, "out of range");
unreachable;
__builtin_unreachable();
}
pthread_mutex_lock(m->lock);
memcpy(m->u.bytes + i, s, n);
@ -2764,7 +2764,7 @@ static atomic_long *GetWord(lua_State *L) {
i = luaL_checkinteger(L, 2);
if (i >= m->size / sizeof(*m->u.words)) {
luaL_error(L, "out of range");
unreachable;
__builtin_unreachable();
}
return m->u.words + i;
}
@ -2840,7 +2840,7 @@ static int LuaUnixMemoryWait(lua_State *L) {
expect = luaL_checkinteger(L, 3);
if (!(INT32_MIN <= expect && expect <= INT32_MAX)) {
luaL_argerror(L, 3, "must be an int32_t");
unreachable;
__builtin_unreachable();
}
if (lua_isnoneornil(L, 4)) {
deadline = 0; // wait forever
@ -2927,15 +2927,15 @@ static int LuaUnixMapshared(lua_State *L) {
n = luaL_checkinteger(L, 1);
if (!n) {
luaL_error(L, "can't map empty region");
unreachable;
__builtin_unreachable();
}
if (n % sizeof(long)) {
luaL_error(L, "size must be multiple of word size");
unreachable;
__builtin_unreachable();
}
if (!IsLegalSize(n)) {
luaL_error(L, "map size too big");
unreachable;
__builtin_unreachable();
}
c = n;
c += sizeof(*m->lock);
@ -2943,7 +2943,7 @@ static int LuaUnixMapshared(lua_State *L) {
c = ROUNDUP(c, g);
if (!(p = _mapshared(c))) {
luaL_error(L, "out of memory");
unreachable;
__builtin_unreachable();
}
m = lua_newuserdatauv(L, sizeof(*m), 1);
luaL_setmetatable(L, "unix.Memory");
@ -3094,7 +3094,7 @@ static DIR *GetDirOrDie(lua_State *L) {
dirp = GetUnixDirSelf(L);
if (*dirp) return *dirp;
luaL_argerror(L, 1, "unix.UnixDir is closed");
unreachable;
__builtin_unreachable();
}
// unix.Dir:close()

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "third_party/maxmind/maxminddb.h"
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
@ -35,7 +36,6 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"
#include "libc/sysv/consts/sock.h"
#include "third_party/maxmind/maxminddb.h"
#include "tool/build/lib/case.h"
asm(".ident\t\"\\n\\n\
@ -45,7 +45,7 @@ asm(".include \"libc/disclaimer.inc\"");
#define METADATA_MARKER "\xab\xcd\xefMaxMind.com"
#define METADATA_BLOCK_MAX_SIZE 131072 /* This is 128kb */
#define MMDB_POOL_INIT_SIZE 64 /* 64 means 4kb on 64bit */
#define MMDB_POOL_INIT_SIZE 64 /* 64 means 4kb on 64bit */
#define MMDB_DATA_SECTION_SEPARATOR 16
#define MAXIMUM_DATA_STRUCTURE_DEPTH 512
@ -269,7 +269,7 @@ static inline uint32_t get_ptr_from(uint8_t ctrl, uint8_t const *const ptr,
case 4:
return READ32BE(ptr);
default:
unreachable;
__builtin_unreachable();
}
}
@ -686,7 +686,7 @@ static record_info_s record_info_for_database(const MMDB_s *const mmdb) {
record_info.right_record_getter = &get_uint32;
record_info.right_record_offset = 4;
} else {
unreachable;
__builtin_unreachable();
}
return record_info;
}

View file

@ -155,7 +155,7 @@ void Karatsuba(uint64_t *C, uint64_t *A, uint64_t *B, size_t n, uint64_t *K) {
c += Add(C + n / 2, C + n / 2, K + n, n);
break;
default:
unreachable;
__builtin_unreachable();
}
for (i = n / 2 + n; c && i < n + n; i++) {
t = C[i];

View file

@ -28,7 +28,7 @@ COSMOPOLITAN_C_START_
#define MBEDTLS_PARAM_FAILED(cond) \
mbedtls_param_failed(#cond, __FILE__, __LINE__)
#else
#define MBEDTLS_PARAM_FAILED(cond) unreachable
#define MBEDTLS_PARAM_FAILED(cond) __builtin_unreachable()
#endif
#define MBEDTLS_INTERNAL_VALIDATE_RET(cond, ret) \

View file

@ -27,13 +27,13 @@
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "third_party/python/Modules/_decimal/libmpdec/mpdecimal.h"
#include "libc/math.h"
#include "third_party/python/Modules/_decimal/libmpdec/basearith.h"
#include "third_party/python/Modules/_decimal/libmpdec/bits.h"
#include "third_party/python/Modules/_decimal/libmpdec/convolute.h"
#include "third_party/python/Modules/_decimal/libmpdec/crt.h"
#include "third_party/python/Modules/_decimal/libmpdec/mpalloc.h"
#include "third_party/python/Modules/_decimal/libmpdec/mpdecimal.h"
#include "third_party/python/Modules/_decimal/libmpdec/typearith.h"
#include "third_party/python/Modules/_decimal/libmpdec/umodarith.h"
/* clang-format off */
@ -3450,7 +3450,7 @@ mpd_qdivint(mpd_t *q, const mpd_t *a, const mpd_t *b,
_settriple(q, sign, 0, 0);
return;
}
unreachable;
__builtin_unreachable();
}
if (mpd_iszerocoeff(b)) {
if (mpd_iszerocoeff(a)) {

View file

@ -27,12 +27,12 @@
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libc/mem/mem.h"
#include "third_party/python/Modules/_decimal/libmpdec/transpose.h"
#include "libc/mem/gc.internal.h"
#include "libc/mem/mem.h"
#include "third_party/python/Modules/_decimal/libmpdec/bits.h"
#include "third_party/python/Modules/_decimal/libmpdec/constants.h"
#include "third_party/python/Modules/_decimal/libmpdec/mpdecimal.h"
#include "third_party/python/Modules/_decimal/libmpdec/transpose.h"
#include "third_party/python/Modules/_decimal/libmpdec/typearith.h"
/* clang-format off */
@ -237,7 +237,7 @@ transpose_pow2(mpd_uint_t *matrix, mpd_size_t rows, mpd_size_t cols)
}
}
else {
unreachable;
__builtin_unreachable();
}
return 1;
}

View file

@ -194,7 +194,7 @@ _mpd_divmod_pow10(mpd_uint_t *q, mpd_uint_t *r, mpd_uint_t v, mpd_uint_t exp)
case 17: DIVMOD(q, r, v, 100000000000000000ULL); break;
case 18: DIVMOD(q, r, v, 1000000000000000000ULL); break;
case 19: DIVMOD(q, r, v, 10000000000000000000ULL); break;
default: unreachable;
default: __builtin_unreachable();
}
}
}

View file

@ -48,6 +48,11 @@ PYTHON_PROVIDE("gc.isenabled");
PYTHON_PROVIDE("gc.set_debug");
PYTHON_PROVIDE("gc.set_threshold");
#ifdef unreachable
#define __unreachable unreachable
#undef unreachable
#endif
/*
Reference Cycle Garbage Collection
@ -73,11 +78,6 @@ PYTHON_PROVIDE("gc.set_threshold");
*/
#ifdef unreachable
#define __unreachable unreachable
#undef unreachable
#endif
/* Get an object's GC head */
#define AS_GC(o) ((PyGC_Head *)(o)-1)

View file

@ -4,8 +4,8 @@
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/intrin/likely.h"
#include "libc/calls/calls.h"
#include "libc/intrin/likely.h"
#include "libc/log/countbranch.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/o.h"
@ -720,7 +720,7 @@ lookdict_index(PyDictKeysObject *k, Py_hash_t hash, Py_ssize_t index)
return DKIX_EMPTY;
}
}
unreachable;
__builtin_unreachable();
}
/*
@ -858,7 +858,7 @@ top:
}
}
}
unreachable;
__builtin_unreachable();
}
/* Specialized version for string-only keys */
@ -931,7 +931,7 @@ lookdict_unicode(PyDictObject *mp, PyObject *key,
return ix;
}
}
unreachable;
__builtin_unreachable();
}
/* Faster version of lookdict_unicode when it is known that no <dummy> keys
@ -995,7 +995,7 @@ lookdict_unicode_nodummy(PyDictObject *restrict mp, PyObject *restrict key,
return ix;
}
}
unreachable;
__builtin_unreachable();
}
/* Version of lookdict for split tables.
@ -1061,7 +1061,7 @@ lookdict_split(PyDictObject *mp, PyObject *key,
return ix;
}
}
unreachable;
__builtin_unreachable();
}
int

View file

@ -4,12 +4,12 @@
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/ast.h"
#include "libc/assert.h"
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "third_party/python/Include/Python-ast.h"
#include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/ast.h"
#include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/compile.h"
#include "third_party/python/Include/complexobject.h"
@ -741,7 +741,7 @@ num_stmts(const node *n)
Py_FatalError(buf);
}
}
unreachable;
__builtin_unreachable();
}
/* Transform the CST rooted at node * to the appropriate AST

View file

@ -5,6 +5,7 @@
https://docs.python.org/3/license.html │
*/
#define PY_LOCAL_AGGRESSIVE
#include "third_party/python/Include/ceval.h"
#include "libc/errno.h"
#include "libc/intrin/likely.h"
#include "libc/runtime/stack.h"
@ -12,7 +13,6 @@
#include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/bytesobject.h"
#include "third_party/python/Include/cellobject.h"
#include "third_party/python/Include/ceval.h"
#include "third_party/python/Include/classobject.h"
#include "third_party/python/Include/code.h"
#include "third_party/python/Include/descrobject.h"
@ -3623,7 +3623,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
/* This should never be reached. Every opcode should end with DISPATCH()
or goto error. */
unreachable;
__builtin_unreachable();
error:
COLD_LABEL;

View file

@ -4,8 +4,8 @@
Python 3
https://docs.python.org/3/license.html │
*/
#include "ape/sections.internal.h"
#include "libc/intrin/cmpxchg.h"
#include "libc/intrin/weaken.h"
#include "libc/stdio/append.h"
#include "libc/str/str.h"
#include "third_party/python/Include/pylifecycle.h"
@ -22,19 +22,18 @@ All Rights Reserved.\\n\
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\\n\
All Rights Reserved.\"");
extern const char kLegalNotices[];
const char *
Py_GetCopyright(void)
{
const char *p;
static bool once;
static char *res;
if (_cmpxchg(&once, 0, 1)) {
appends(&res, "");
for (p = *_weaken(kLegalNotices); *p; p += strlen(p) + 1) {
appends(&res, p);
if (!res) {
char *r = 0;
const char *p;
appends(&r, "");
for (p = __comment_start; *p; p += strlen(p) + 1) {
appends(&r, p);
}
res = r;
}
return res;
}

View file

@ -86,7 +86,7 @@ void dzd(const char *s, void *p, size_t n, size_t z) {
} else if (z == 4) {
x = ((const uint32_t *)p)[i];
} else {
unreachable;
__builtin_unreachable();
}
appendd(&r, t, zleb64(t, x - y) - t);
y = x;

View file

@ -48,6 +48,8 @@ main(int argc, char *argv[])
PyObject *code = NULL, *marshalled = NULL;
int is_bootstrap = 1;
ShowCrashReports();
if (argc == 2 && !strcmp(argv[1], "-n")) return 0;
if (argc != 3) {

View file

@ -714,6 +714,7 @@ int
main(int argc, char *argv[])
{
int ec;
ShowCrashReports();
timestamp.tv_sec = 1647414000; /* determinism */
/* clock_gettime(CLOCK_REALTIME, &timestamp); */
GetOpts(argc, argv);

View file

@ -4048,6 +4048,7 @@ THIRD_PARTY_PYTHON_FREEZE_DIRECTDEPS = \
LIBC_STDIO \
LIBC_MEM \
LIBC_STR \
LIBC_LOG \
LIBC_STUBS \
LIBC_SYSV \
LIBC_X \
@ -4086,7 +4087,6 @@ o/$(MODE)/third_party/python/chibicc.inc: \
libc/mem/mem.h \
libc/nexgen32e/kcpuids.h \
libc/runtime/runtime.h \
libc/runtime/symbolic.h \
libc/stdio/stdio.h \
libc/str/str.h \
libc/str/unicode.h \

View file

@ -1498,7 +1498,7 @@ static reg_errcode_t tre_add_tags(tre_mem_t mem, tre_stack_t *stack,
}
default:
unreachable;
__builtin_unreachable();
} /* end switch(symbol) */
} /* end while(tre_stack_num_objects(stack) > bottom) */
@ -1649,7 +1649,7 @@ static reg_errcode_t tre_copy_ast(tre_mem_t mem, tre_stack_t *stack,
break;
}
default:
unreachable;
__builtin_unreachable();
}
break;
}
@ -1724,7 +1724,7 @@ static reg_errcode_t tre_expand_ast(tre_mem_t mem, tre_stack_t *stack,
break;
}
default:
unreachable;
__builtin_unreachable();
}
break;
case EXPAND_AFTER_ITER: {
@ -1798,7 +1798,7 @@ static reg_errcode_t tre_expand_ast(tre_mem_t mem, tre_stack_t *stack,
break;
}
default:
unreachable;
__builtin_unreachable();
}
}
@ -1960,7 +1960,7 @@ static reg_errcode_t tre_match_empty(tre_stack_t *stack, tre_ast_node_t *node,
case EMPTY:
break;
default:
unreachable;
__builtin_unreachable();
}
break;
@ -1974,7 +1974,7 @@ static reg_errcode_t tre_match_empty(tre_stack_t *stack, tre_ast_node_t *node,
else if (uni->right->nullable)
STACK_PUSHX(stack, voidptr, uni->right)
else
unreachable;
__builtin_unreachable();
break;
case CATENATION:
@ -1994,7 +1994,7 @@ static reg_errcode_t tre_match_empty(tre_stack_t *stack, tre_ast_node_t *node,
break;
default:
unreachable;
__builtin_unreachable();
}
}
@ -2182,7 +2182,7 @@ static reg_errcode_t tre_compute_nfl(tre_mem_t mem, tre_stack_t *stack,
}
default:
unreachable;
__builtin_unreachable();
}
}

View file

@ -118,6 +118,7 @@
*
* Public Domain (www.unlicense.org)
*/
#include "third_party/stb/stb_image_write.h"
#include "dsp/core/core.h"
#include "libc/assert.h"
#include "libc/fmt/conv.h"
@ -129,7 +130,6 @@
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/stb/stb_image_write.h"
#include "third_party/zlib/zlib.h"
#define STBIW_UCHAR(x) (unsigned char)((x)&0xff)
@ -201,7 +201,7 @@ static void stbiw__writefv(stbi__write_context *s, const char *fmt, va_list v) {
break;
}
default:
unreachable;
__builtin_unreachable();
}
}
}

View file

@ -25,10 +25,10 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "libc/mem/alg.h"
#include "third_party/stb/stb_rect_pack.h"
#include "libc/assert.h"
#include "libc/dce.h"
#include "third_party/stb/stb_rect_pack.h"
#include "libc/mem/alg.h"
asm(".ident\t\"\\n\\n\
stb_rect_pack (MIT License)\\n\
@ -108,7 +108,7 @@ void stbrp_setup_heuristic(stbrp_context *context, int heuristic)
context->heuristic = heuristic;
break;
default:
unreachable;
__builtin_unreachable();
}
}

View file

@ -896,7 +896,7 @@ privileged static uint64_t xed_read_number(uint8_t *p, size_t n, bool s) {
case 0b111:
return READ64LE(p);
default:
unreachable;
__builtin_unreachable();
}
}