diff --git a/Makefile b/Makefile index c26e2a2d5..f653b1aa0 100644 --- a/Makefile +++ b/Makefile @@ -61,13 +61,19 @@ SHELL = build/bootstrap/cocmd.com HOSTS ?= freebsd openbsd netbsd rhel7 rhel5 win10 xnu -MAKEFLAGS += --no-builtin-rules +MAKEFLAGS += -j --no-builtin-rules .SUFFIXES: .DELETE_ON_ERROR: .FEATURES: output-sync .PHONY: all o bins check test depend tags +ifneq ($(m),) +ifeq ($(MODE),) +MODE := $(m) +endif +endif + all: o o: o/$(MODE) diff --git a/README.md b/README.md index 0e514a34c..0bbb27c34 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ wget https://justine.lol/cosmopolitan/cosmopolitan-amalgamation-2.0.1.zip unzip cosmopolitan-amalgamation-2.0.1.zip printf 'main() { printf("hello world\\n"); }\n' >hello.c gcc -g -Os -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone \ - -fno-omit-frame-pointer -pg -mnop-mcount -mno-tls-direct-seg-refs \ + -fno-omit-frame-pointer -pg -mnop-mcount -mno-tls-direct-seg-refs -gdwarf-4 \ -o hello.com.dbg hello.c -fuse-ld=bfd -Wl,-T,ape.lds -Wl,--gc-sections \ -include cosmopolitan.h crt.o ape-no-modify-self.o cosmopolitan.a objcopy -S -O binary hello.com.dbg hello.com @@ -100,7 +100,7 @@ heavyweight features like tracing to your binaries by default. In that case, you may want to consider using our build system: ```sh -make -j8 MODE=tiny +make m=tiny ``` Which will cause programs such as `hello.com` and `life.com` to shrink @@ -155,7 +155,7 @@ cd cosmopolitan This will build the entire repository and run all the tests: ```sh -build/bootstrap/make.com -j16 +build/bootstrap/make.com o//examples/hello.com find o -name \*.com | xargs ls -rShal | less ``` @@ -174,7 +174,7 @@ having minimal deterministic builds. For example, if you wanted to build only hello.com then you could do that as follows: ```sh -build/bootstrap/make.com -j16 o//examples/hello.com +build/bootstrap/make.com o//examples/hello.com ``` Sometimes it's desirable to build a subset of targets, without having to @@ -183,7 +183,7 @@ directory name. For example, if you wanted to build only the targets and subtargets of the chibicc package including its tests, you would say: ```sh -build/bootstrap/make.com -j16 o//third_party/chibicc +build/bootstrap/make.com o//third_party/chibicc o//third_party/chibicc/chibicc.com --help ``` @@ -191,18 +191,19 @@ Cosmopolitan provides a variety of build modes. For example, if you want really tiny binaries (as small as 12kb in size) then you'd say: ```sh -build/bootstrap/make.com -j16 MODE=tiny +build/bootstrap/make.com m=tiny ``` Here's some other build modes you can try: ```sh -build/bootstrap/make.com -j16 MODE=dbg # asan + ubsan + debug -build/bootstrap/make.com -j16 MODE=asan # production memory safety -build/bootstrap/make.com -j16 MODE=opt # -march=native optimizations -build/bootstrap/make.com -j16 MODE=rel # traditional release binaries -build/bootstrap/make.com -j16 MODE=optlinux # optimal linux-only performance -build/bootstrap/make.com -j16 MODE=tinylinux # tiniest linux-only 4kb binaries +build/bootstrap/make.com m=dbg # asan + ubsan + debug +build/bootstrap/make.com m=asan # production memory safety +build/bootstrap/make.com m=opt # -march=native optimizations +build/bootstrap/make.com m=rel # traditional release binaries +build/bootstrap/make.com m=optlinux # optimal linux-only performance +build/bootstrap/make.com m=fastbuild # build 28% faster w/o debugging +build/bootstrap/make.com m=tinylinux # tiniest linux-only 4kb binaries ``` For further details, see [//build/config.mk](build/config.mk). diff --git a/build/config.mk b/build/config.mk index bf8c73e2d..753ebb0ae 100644 --- a/build/config.mk +++ b/build/config.mk @@ -282,6 +282,28 @@ TARGET_ARCH ?= \ -msse3 endif +# GCC11 Mode +# https://justine.lol/compilers/x86_64-linux-musl__x86_64-linux-musl__g++-11.2.0.tar.xz +ifeq ($(MODE), gcc11) +.UNVEIL += rx:/opt/gcc11 +CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -DSYSDEBUG -O2 +AS = /opt/gcc11/bin/x86_64-linux-musl-as +CC = /opt/gcc11/bin/x86_64-linux-musl-gcc +CXX = /opt/gcc11/bin/x86_64-linux-musl-g++ +CXXFILT = /opt/gcc11/bin/x86_64-linux-musl-c++filt +LD = /opt/gcc11/bin/x86_64-linux-musl-ld.bfd +NM = /opt/gcc11/bin/x86_64-linux-musl-nm +GCC = /opt/gcc11/bin/x86_64-linux-musl-gcc +STRIP = /opt/gcc11/bin/x86_64-linux-musl-strip +OBJCOPY = /opt/gcc11/bin/x86_64-linux-musl-objcopy +OBJDUMP = /opt/gcc11/bin/x86_64-linux-musl-objdump +ADDR2LINE = /opt/gcc11/bin/x86_64-linux-musl-addr2line +CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -O2 -Wno-stringop-overread +CONFIG_CFLAGS += -Wno-old-style-definition +CONFIG_CPPFLAGS += -DNDEBUG -DSYSDEBUG +TARGET_ARCH ?= -msse3 +endif + # LLVM Mode ifeq ($(MODE), llvm) TARGET_ARCH ?= -msse3 diff --git a/build/definitions.mk b/build/definitions.mk index 4b4f1cd22..413e85e3d 100644 --- a/build/definitions.mk +++ b/build/definitions.mk @@ -148,6 +148,7 @@ DEFAULT_CCFLAGS = \ DEFAULT_OFLAGS = \ -g \ + -gdwarf-4 \ -gdescribe-dies DEFAULT_COPTS = \ diff --git a/dsp/tty/config.c b/dsp/tty/config.c index df6eceae0..48a52cc0b 100644 --- a/dsp/tty/config.c +++ b/dsp/tty/config.c @@ -30,7 +30,7 @@ * @see ttyconfig(), ttyrestore() */ int ttyconfig(int ttyfd, ttyconf_f fn, int64_t arg, - const struct termios *opt_out_oldconf) { + struct termios *opt_out_oldconf) { struct termios conf[2]; if (tcgetattr(ttyfd, &conf[0]) != -1 && fn(memcpy(&conf[1], &conf[0], sizeof(conf[0])), arg) != -1 && diff --git a/dsp/tty/tty.h b/dsp/tty/tty.h index 73e110af8..07d4fd537 100644 --- a/dsp/tty/tty.h +++ b/dsp/tty/tty.h @@ -44,7 +44,7 @@ int ttysendtitle(int, const char *, const struct TtyIdent *); int ttyident(struct TtyIdent *, int, int); void ttyidentclear(struct TtyIdent *); char *ttydescribe(char *, size_t, const struct TtyIdent *); -int ttyconfig(int, ttyconf_f, int64_t, const struct termios *); +int ttyconfig(int, ttyconf_f, int64_t, struct termios *); int ttyrestore(int, const struct termios *); int ttysetrawdeadline(struct termios *, int64_t); int ttysetrawmode(struct termios *, int64_t); diff --git a/libc/calls/pipe.c b/libc/calls/pipe.c index 22e65853b..aaaa2fb4a 100644 --- a/libc/calls/pipe.c +++ b/libc/calls/pipe.c @@ -17,11 +17,11 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/intrin/strace.internal.h" #include "libc/calls/syscall-nt.internal.h" #include "libc/calls/syscall-sysv.internal.h" #include "libc/dce.h" #include "libc/intrin/asan.internal.h" +#include "libc/intrin/strace.internal.h" #include "libc/sysv/errfuns.h" /** diff --git a/libc/calls/struct/timespec.internal.h b/libc/calls/struct/timespec.internal.h index c21a285b6..b5eb5d3b5 100644 --- a/libc/calls/struct/timespec.internal.h +++ b/libc/calls/struct/timespec.internal.h @@ -5,18 +5,18 @@ #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ -int __sys_utimensat(int, const char *, const struct timespec *, int) hidden; +int __sys_utimensat(int, const char *, const struct timespec[2], int) hidden; int sys_clock_getres(int, struct timespec *) hidden; int sys_clock_gettime(int, struct timespec *) hidden; int sys_clock_gettime_nt(int, struct timespec *) hidden; int sys_clock_gettime_xnu(int, struct timespec *) hidden; -int sys_futimens(int, const struct timespec *) hidden; +int sys_futimens(int, const struct timespec[2]) hidden; int sys_nanosleep(const struct timespec *, struct timespec *) hidden; int sys_nanosleep_nt(const struct timespec *, struct timespec *) hidden; int sys_nanosleep_xnu(const struct timespec *, struct timespec *) hidden; -int sys_utimensat(int, const char *, const struct timespec *, int) hidden; -int sys_utimensat_nt(int, const char *, const struct timespec *, int) hidden; -int sys_utimensat_xnu(int, const char *, const struct timespec *, int) hidden; +int sys_utimensat(int, const char *, const struct timespec[2], int) hidden; +int sys_utimensat_nt(int, const char *, const struct timespec[2], int) hidden; +int sys_utimensat_xnu(int, const char *, const struct timespec[2], int) hidden; const char *DescribeTimespec(char[45], int, const struct timespec *); #define DescribeTimespec(rc, ts) DescribeTimespec(alloca(45), rc, ts) diff --git a/libc/testlib/strcaseequals.c b/libc/testlib/strcaseequals.c index e6c43b0ba..15f9aa022 100644 --- a/libc/testlib/strcaseequals.c +++ b/libc/testlib/strcaseequals.c @@ -21,7 +21,7 @@ #include "libc/testlib/testlib.h" bool testlib_strcaseequals(size_t cw, const void *s1, const void *s2) { - return testlib_strncaseequals(cw, s1, s2, SIZE_MAX); + return testlib_strncaseequals(cw, s1, s2, LONG_MAX); } bool testlib_strncaseequals(size_t cw, const void *s1, const void *s2, diff --git a/libc/testlib/strequals.c b/libc/testlib/strequals.c index 68acd5ed8..d7dfa7f3a 100644 --- a/libc/testlib/strequals.c +++ b/libc/testlib/strequals.c @@ -21,7 +21,7 @@ #include "libc/testlib/testlib.h" bool testlib_strequals(size_t cw, const void *s1, const void *s2) { - return testlib_strnequals(cw, s1, s2, SIZE_MAX); + return testlib_strnequals(cw, s1, s2, LONG_MAX); } bool testlib_strnequals(size_t cw, const void *s1, const void *s2, size_t n) { diff --git a/libc/time/asctime.c b/libc/time/asctime.c index ae720cbcb..a5350228b 100644 --- a/libc/time/asctime.c +++ b/libc/time/asctime.c @@ -69,7 +69,7 @@ static char buf_asctime[MAX_ASCTIME_BUF_SIZE]; char * -asctime_r(register const struct tm *timeptr, char *buf) +asctime_r(register const struct tm *timeptr, char buf[hasatleast 26]) { register const char * wn; register const char * mn; diff --git a/libc/time/ctime_r.c b/libc/time/ctime_r.c index c830a081c..77ebb0713 100644 --- a/libc/time/ctime_r.c +++ b/libc/time/ctime_r.c @@ -2,7 +2,7 @@ #include "libc/time/struct/tm.h" #include "libc/time/time.h" -char *ctime_r(const time_t *timep, char *buf) { +char *ctime_r(const time_t *timep, char buf[hasatleast 26]) { struct tm mytm; struct tm *tmp = localtime_r(timep, &mytm); return tmp ? asctime_r(tmp, buf) : NULL; diff --git a/libc/time/struct/tm.h b/libc/time/struct/tm.h index 420cf51a4..b8e411132 100644 --- a/libc/time/struct/tm.h +++ b/libc/time/struct/tm.h @@ -18,7 +18,7 @@ struct tm { }; char *asctime(const struct tm *); -char *asctime_r(const struct tm *, char[hasatleast 64]); +char *asctime_r(const struct tm *, char[hasatleast 26]); char *iso8601(char[hasatleast 20], struct tm *); char *strptime(const char *, const char *, struct tm *); int64_t mktime(struct tm *); diff --git a/libc/time/time.h b/libc/time/time.h index d44b08b31..9a33624f3 100644 --- a/libc/time/time.h +++ b/libc/time/time.h @@ -18,7 +18,7 @@ extern long timezone; extern int daylight; char *ctime(const int64_t *); -char *ctime_r(const int64_t *, char[hasatleast 64]); +char *ctime_r(const int64_t *, char[hasatleast 26]); double difftime(int64_t, int64_t) dontthrow pureconst; extern long double (*nowl)(void); int64_t clock(void); diff --git a/test/libc/calls/pipe_test.c b/test/libc/calls/pipe_test.c index 7b6b9a9cb..379735055 100644 --- a/test/libc/calls/pipe_test.c +++ b/test/libc/calls/pipe_test.c @@ -29,7 +29,7 @@ char buf[6] = {0}; struct rlimit rlim = {0, 10}; TEST(pipe, efault) { - EXPECT_SYS(EFAULT, -1, pipe(0)); + EXPECT_SYS(EFAULT, -1, pipe(VEIL("r", (void *)0))); } TEST(pipe, einval) { diff --git a/third_party/libcxx/__config b/third_party/libcxx/__config index a2b4ebdd9..28d231648 100644 --- a/third_party/libcxx/__config +++ b/third_party/libcxx/__config @@ -16,6 +16,7 @@ #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION +#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE #if defined(_MSC_VER) && !defined(__clang__) # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/third_party/libcxx/algorithm.cc b/third_party/libcxx/algorithm.cc index 42010055b..bf0112a8f 100644 --- a/third_party/libcxx/algorithm.cc +++ b/third_party/libcxx/algorithm.cc @@ -55,8 +55,10 @@ template unsigned __sort5<__less&, long double*>(long double*, long #ifndef _LIBCPP_HAS_NO_THREADS _LIBCPP_SAFE_STATIC static __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; #endif -unsigned __rs_default::__c_ = 0; +#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \ + || defined(_LIBCPP_BUILDING_LIBRARY) +unsigned __rs_default::__c_ = 0; __rs_default::__rs_default() { #ifndef _LIBCPP_HAS_NO_THREADS @@ -64,12 +66,10 @@ __rs_default::__rs_default() #endif __c_ = 1; } - __rs_default::__rs_default(const __rs_default&) { ++__c_; } - __rs_default::~__rs_default() { #ifndef _LIBCPP_HAS_NO_THREADS @@ -79,13 +79,13 @@ __rs_default::~__rs_default() --__c_; #endif } - __rs_default::result_type __rs_default::operator()() { static mt19937 __rs_g; return __rs_g(); } +#endif __rs_default __rs_get() diff --git a/third_party/libcxx/exception_fallback.hh b/third_party/libcxx/exception_fallback.hh index 770f27b39..27afa53ee 100644 --- a/third_party/libcxx/exception_fallback.hh +++ b/third_party/libcxx/exception_fallback.hh @@ -14,23 +14,25 @@ namespace std { _LIBCPP_SAFE_STATIC static std::terminate_handler __terminate_handler; -_LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler; +#if _LIBCPP_STD_VER <= 14 || \ + defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \ + defined(_LIBCPP_BUILDING_LIBRARY) +_LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler; // libcxxrt provides implementations of these functions itself. unexpected_handler set_unexpected(unexpected_handler func) _NOEXCEPT { return __libcpp_atomic_exchange(&__unexpected_handler, func); } - unexpected_handler get_unexpected() _NOEXCEPT { return __libcpp_atomic_load(&__unexpected_handler); } - _LIBCPP_NORETURN void unexpected() { (*get_unexpected())(); // unexpected handler should not return terminate(); } +#endif terminate_handler set_terminate(terminate_handler func) _NOEXCEPT { return __libcpp_atomic_exchange(&__terminate_handler, func); diff --git a/third_party/make/read.c b/third_party/make/read.c index 696d60a97..ddf8da149 100644 --- a/third_party/make/read.c +++ b/third_party/make/read.c @@ -427,7 +427,9 @@ eval_makefile (const char *filename, unsigned short flags) fclose (ebuf.fp); free (ebuf.bufstart); - alloca (0); + + /* [jart] breaks gcc11 (also wat) */ + void *volatile wat = alloca (0); errno = 0; return deps; @@ -469,7 +471,8 @@ eval_buffer (char *buffer, const floc *flocp) reading_file = curfile; - alloca (0); + /* [jart] breaks gcc11 (also wat) */ + void *volatile wat = alloca (0); } /* Check LINE to see if it's a variable assignment or undefine. @@ -2495,7 +2498,8 @@ find_percent_cached (const char **string) if (! new) { slen = strlen (*string); - new = alloca (slen + 1); + /* [jart] can't prove alloca() isn't returned; let's just leak */ + new = malloc (slen + 1); memcpy (new, *string, slen + 1); p = new + (p - *string); *string = new; diff --git a/third_party/make/remake.c b/third_party/make/remake.c index 2c50d2b81..c7de482ec 100644 --- a/third_party/make/remake.c +++ b/third_party/make/remake.c @@ -322,7 +322,7 @@ update_file (struct file *file, unsigned int depth) check_renamed (f); /* Clean up any alloca() used during the update. */ - alloca (0); + void *volatile wat = alloca (0); /* If we got an error, don't bother with double_colon etc. */ if (new && !keep_going_flag) diff --git a/third_party/mbedtls/bigmul4.c b/third_party/mbedtls/bigmul4.c index 67d1a3ca4..d012a4cca 100644 --- a/third_party/mbedtls/bigmul4.c +++ b/third_party/mbedtls/bigmul4.c @@ -29,7 +29,7 @@ * @note words are host endian while array is little endian * @mayalias */ -void (*Mul4x4)(uint64_t C[8], const uint64_t A[4], const uint64_t B[4]); +void (*Mul4x4)(uint64_t C[16], const uint64_t A[8], const uint64_t B[8]); static textstartup void Mul4x4Init() { @@ -38,7 +38,7 @@ static textstartup void Mul4x4Init() const void *const Mul4x4Ctor[] initarray = {Mul4x4Init}; -void Mul4x4Pure(uint64_t C[8], const uint64_t A[4], const uint64_t B[4]) +void Mul4x4Pure(uint64_t C[16], const uint64_t A[8], const uint64_t B[8]) { uint128_t t; uint64_t h, c1, c2, c3; diff --git a/third_party/mbedtls/test/test_suite_ssl.c b/third_party/mbedtls/test/test_suite_ssl.c index ef4ccb956..3d6f5e721 100644 --- a/third_party/mbedtls/test/test_suite_ssl.c +++ b/third_party/mbedtls/test/test_suite_ssl.c @@ -2699,7 +2699,7 @@ void test_ssl_message_queue_insufficient_buffer_wrapper( void ** params ) void test_ssl_message_mock_uninitialized( ) { enum { MSGLEN = 10 }; - unsigned char message[MSGLEN], received[MSGLEN]; + unsigned char message[MSGLEN] = {0}, received[MSGLEN]; mbedtls_mock_socket client, server; mbedtls_test_message_queue server_queue, client_queue; mbedtls_test_message_socket_context server_context, client_context; diff --git a/third_party/python/Modules/_decimal/libmpdec/io.c b/third_party/python/Modules/_decimal/libmpdec/io.c index 5a7818157..7672c85eb 100644 --- a/third_party/python/Modules/_decimal/libmpdec/io.c +++ b/third_party/python/Modules/_decimal/libmpdec/io.c @@ -38,6 +38,10 @@ #include "third_party/python/Modules/_decimal/libmpdec/typearith.h" /* clang-format off */ +#if __GNUC__ >= 11 +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + asm(".ident\t\"\\n\\n\ libmpdec (BSD-2)\\n\ Copyright 2008-2016 Stefan Krah\""); diff --git a/third_party/python/Modules/expat/xmltok_ns.inc b/third_party/python/Modules/expat/xmltok_ns.inc index 6475a4e38..c17e47f1e 100644 --- a/third_party/python/Modules/expat/xmltok_ns.inc +++ b/third_party/python/Modules/expat/xmltok_ns.inc @@ -90,7 +90,7 @@ NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, static const ENCODING * NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) { # define ENCODING_MAX 128 - char buf[ENCODING_MAX]; + char buf[ENCODING_MAX] = {0}; /* [jart] wut */ char *p = buf; int i; XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); diff --git a/third_party/sqlite3/build.c b/third_party/sqlite3/build.c index 288864ab5..9a2b344b5 100644 --- a/third_party/sqlite3/build.c +++ b/third_party/sqlite3/build.c @@ -24,6 +24,10 @@ */ #include "third_party/sqlite3/sqliteInt.inc" +#if __GNUC__ >= 11 +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + /* clang-format off */ #ifndef SQLITE_OMIT_SHARED_CACHE @@ -4230,7 +4234,7 @@ void sqlite3DefaultRowEst(Index *pIdx){ if( x<99 ){ pIdx->pTable->nRowLogEst = x = 99; } - if( pIdx->pPartIdxWhere!=0 ) x -= 10; assert( 10==sqlite3LogEst(2) ); + if( pIdx->pPartIdxWhere!=0 ) x -= 10; /*assert( 10==sqlite3LogEst(2) );*/ a[0] = x; /* Estimate that a[1] is 10, a[2] is 9, a[3] is 8, a[4] is 7, a[5] is diff --git a/third_party/sqlite3/fts5.c b/third_party/sqlite3/fts5.c index 1e1af18cd..453efcd48 100644 --- a/third_party/sqlite3/fts5.c +++ b/third_party/sqlite3/fts5.c @@ -14170,10 +14170,13 @@ static int sqlite3Fts5IndexQuery( /* If the QUERY_SCAN flag is set, all other flags must be clear. */ assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN ); + /* [jart] what is with these gcc11 warnings */ + void *MemCpy(void *, const void *, size_t) asm("memcpy"); + if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){ int iIdx = 0; /* Index to search */ int iPrefixIdx = 0; /* +1 prefix index */ - if( nToken ) memcpy(&buf.p[1], pToken, nToken); + if( nToken ) MemCpy(&buf.p[1], pToken, nToken); /* Figure out which index to search and set iIdx accordingly. If this ** is a prefix query for which there is no prefix index, set iIdx to diff --git a/third_party/sqlite3/where.c b/third_party/sqlite3/where.c index f7ba564b1..5270f4132 100644 --- a/third_party/sqlite3/where.c +++ b/third_party/sqlite3/where.c @@ -20,6 +20,10 @@ #include "third_party/sqlite3/whereInt.inc" /* clang-format off */ +#if __GNUC__ >= 11 +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + /* ** Extra information appended to the end of sqlite3_index_info but not ** visible to the xBestIndex function, at least not directly. The diff --git a/third_party/tidy/access.c b/third_party/tidy/access.c index 2d5c704e0..878697146 100644 --- a/third_party/tidy/access.c +++ b/third_party/tidy/access.c @@ -891,7 +891,7 @@ static Bool CompareColors( const int rgbBG[3], const int rgbFG[3] ) * blue = 5. *********************************************************************/ -static Bool GetRgb( ctmbstr color, int rgb[] ) +static Bool GetRgb( ctmbstr color, int rgb[3] ) { uint x; diff --git a/third_party/tidy/attrs.c b/third_party/tidy/attrs.c index 004256e13..c6d90ea9b 100644 --- a/third_party/tidy/attrs.c +++ b/third_party/tidy/attrs.c @@ -14,6 +14,10 @@ #include "libc/fmt/fmt.h" #include "third_party/tidy/utf8.h" +#if __GNUC__ >= 11 /* [jart] this one looks legit */ +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + /* Bind attribute types to procedures to check values. You can add new procedures for better validation diff --git a/third_party/unzip/unzip.c b/third_party/unzip/unzip.c index 6d4f61cd6..4808976d0 100644 --- a/third_party/unzip/unzip.c +++ b/third_party/unzip/unzip.c @@ -75,6 +75,10 @@ #include "third_party/unzip/unzvers.h" #include "third_party/unzip/globals.h" +#if __GNUC__ >= 11 /* [jart] worth looking into */ +#pragma GCC diagnostic ignored "-Wrestrict" +#endif + #ifndef WINDLL /* The WINDLL port uses windll/windll.c instead... */ /***************************/ diff --git a/third_party/unzip/unzip.mk b/third_party/unzip/unzip.mk index 2d86ceb74..e97511990 100644 --- a/third_party/unzip/unzip.mk +++ b/third_party/unzip/unzip.mk @@ -59,6 +59,10 @@ $(THIRD_PARTY_UNZIP_A_OBJS): private \ -DHAVE_TERMIOS_H \ -DNO_LCHMOD +$(THIRD_PARTY_UNZIP_A_OBJS): private \ + OVERRIDE_CFLAGS += \ + $(OLD_CODE) + THIRD_PARTY_UNZIP_COMS = o/$(MODE)/third_party/unzip/unzip.com THIRD_PARTY_UNZIP_BINS = $(THIRD_PARTY_UNZIP_COMS) $(THIRD_PARTY_UNZIP_COMS:%=%.dbg) THIRD_PARTY_UNZIP_LIBS = $(foreach x,$(THIRD_PARTY_UNZIP_ARTIFACTS),$($(x))) diff --git a/tool/build/lib/xlat.h b/tool/build/lib/xlat.h index 747a4e83c..b69e826d1 100644 --- a/tool/build/lib/xlat.h +++ b/tool/build/lib/xlat.h @@ -46,7 +46,7 @@ void XlatLinuxToTermios(struct termios *, const struct termios_bits *); void XlatTermiosToLinux(struct termios_bits *, const struct termios *); void XlatWinsizeToLinux(struct winsize_bits *, const struct winsize *); void XlatSigsetToLinux(uint8_t[8], const sigset_t *); -void XlatLinuxToSigset(sigset_t *, const uint8_t[]); +void XlatLinuxToSigset(sigset_t *, const uint8_t[8]); COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ diff --git a/tool/emacs/cosmo-stuff.el b/tool/emacs/cosmo-stuff.el index a10d4b269..4bd6a1b2d 100644 --- a/tool/emacs/cosmo-stuff.el +++ b/tool/emacs/cosmo-stuff.el @@ -169,7 +169,7 @@ ((eq arg 8) "llvm") (default default) ((cosmo-intest) "dbg") - (t ""))) + (t "fastbuild"))) (defun cosmo--make-suffix (arg) (cond ((eq arg 9) ".chibicc") diff --git a/tool/viz/lib/ycbcr.h b/tool/viz/lib/ycbcr.h index da8891008..57d3b2c76 100644 --- a/tool/viz/lib/ycbcr.h +++ b/tool/viz/lib/ycbcr.h @@ -12,13 +12,13 @@ extern long magikarp_latency_; extern long ycbcr2rgb_latency_; void Y2Rgb(long yn, long xn, unsigned char[restrict 3][yn][xn], long yys, - long yxs, const unsigned char[restrict yys][yxs], const int[4][4], + long yxs, const unsigned char[restrict yys][yxs], const int[8][4], const unsigned char[256]); void YCbCr2Rgb(long yn, long xn, unsigned char[restrict 3][yn][xn], long yys, long yxs, const unsigned char[restrict yys][yxs], long cys, long cxs, const unsigned char[restrict cys][cxs], - const unsigned char[restrict cys][cxs], const int[4][4], - const int[3][4], const unsigned char[256]); + const unsigned char[restrict cys][cxs], const int[8][4], + const int[6][4], const unsigned char[256]); void YCbCrFree(struct YCbCr **); void YCbCrInit(struct YCbCr **, bool, int, double, const double[3],