mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 18:28:30 +00:00
Fix warnings
This change fixes Cosmopolitan so it has fewer opinions about compiler warnings. The whole repository had to be cleaned up to be buildable in -Werror -Wall mode. This lets us benefit from things like strict const checking. Some actual bugs might have been caught too.
This commit is contained in:
parent
e2b3c3618e
commit
0d748ad58e
571 changed files with 1306 additions and 1888 deletions
|
@ -63,7 +63,6 @@ void EnableCruiseControlForCool(void) {
|
|||
* @see BENCH()
|
||||
*/
|
||||
void testlib_runallbenchmarks(void) {
|
||||
int e;
|
||||
__log_level = kLogWarn;
|
||||
EnableCruiseControlForCool();
|
||||
testlib_runtestcases(__bench_start, __bench_end, testlib_benchwarmup);
|
||||
|
|
|
@ -68,7 +68,8 @@ static void testlib_describecombo(struct ComboProduct *product,
|
|||
|
||||
static void testlib_callcombos(struct ComboProduct *product,
|
||||
const struct TestFixture *combos,
|
||||
testfn_t *test_start, testfn_t *test_end) {
|
||||
const testfn_t *test_start,
|
||||
const testfn_t *test_end) {
|
||||
for (;;) {
|
||||
testlib_describecombo(product, combos);
|
||||
for (unsigned i = 0; i < product->n; ++i) {
|
||||
|
@ -88,7 +89,7 @@ static void testlib_callcombos(struct ComboProduct *product,
|
|||
* @see ape/ape.lds
|
||||
* @see libc/testlib/testlib.h
|
||||
*/
|
||||
void testlib_runcombos(testfn_t *test_start, testfn_t *test_end,
|
||||
void testlib_runcombos(const testfn_t *test_start, const testfn_t *test_end,
|
||||
const struct TestFixture *combo_start,
|
||||
const struct TestFixture *combo_end) {
|
||||
struct ComboProduct *product;
|
||||
|
|
|
@ -151,6 +151,9 @@ COSMOPOLITAN_C_START_
|
|||
__testlib_yield(); \
|
||||
Core = __testlib_getcore(); \
|
||||
Interrupts = __testlib_getinterrupts(); \
|
||||
(void)Toto; \
|
||||
(void)Core; \
|
||||
(void)Interrupts; \
|
||||
EXPR; \
|
||||
Speculative = BENCHLOOPER(__startbench, __endbench, 32, (EXPR)); \
|
||||
} while (++Tries < EZBENCH_TRIES && !Speculative); \
|
||||
|
|
|
@ -31,7 +31,7 @@ int testlib_countfixtures(const struct TestFixture *start,
|
|||
* @see ape/ape.lds
|
||||
* @see libc/testlib/testlib.h
|
||||
*/
|
||||
void testlib_runfixtures(testfn_t *test_start, testfn_t *test_end,
|
||||
void testlib_runfixtures(const testfn_t *test_start, const testfn_t *test_end,
|
||||
const struct TestFixture *fixture_start,
|
||||
const struct TestFixture *fixture_end) {
|
||||
unsigned i, count;
|
||||
|
|
|
@ -46,7 +46,6 @@ static dontasan dontubsan relegated uint64_t CountMappedBytes(void) {
|
|||
}
|
||||
|
||||
static relegated void DieBecauseOfQuota(int rc, const char *message) {
|
||||
int e = errno;
|
||||
char hostname[32];
|
||||
stpcpy(hostname, "unknown");
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
|
|
|
@ -40,7 +40,6 @@ const char *testlib_showerror_symbol;
|
|||
void testlib_showerror(const char *file, int line, const char *func,
|
||||
const char *method, const char *symbol, const char *code,
|
||||
char *v1, char *v2) {
|
||||
char *p;
|
||||
char hostname[128];
|
||||
__stpcpy(hostname, "unknown");
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
|
|
|
@ -388,10 +388,11 @@ void testlib_runalltests(void);
|
|||
const char *testlib_strerror(void);
|
||||
void testlib_runallbenchmarks(void);
|
||||
bool testlib_memoryexists(const void *);
|
||||
void testlib_runtestcases(testfn_t *, testfn_t *, testfn_t);
|
||||
void testlib_runcombos(testfn_t *, testfn_t *, const struct TestFixture *,
|
||||
const struct TestFixture *);
|
||||
void testlib_runfixtures(testfn_t *, testfn_t *, const struct TestFixture *,
|
||||
void testlib_runtestcases(const testfn_t *, const testfn_t *, testfn_t);
|
||||
void testlib_runcombos(const testfn_t *, const testfn_t *,
|
||||
const struct TestFixture *, const struct TestFixture *);
|
||||
void testlib_runfixtures(const testfn_t *, const testfn_t *,
|
||||
const struct TestFixture *,
|
||||
const struct TestFixture *);
|
||||
int testlib_countfixtures(const struct TestFixture *,
|
||||
const struct TestFixture *);
|
||||
|
|
|
@ -166,8 +166,6 @@ static void SetLimit(int resource, uint64_t soft, uint64_t hard) {
|
|||
* Generic test program main function.
|
||||
*/
|
||||
dontasan int main(int argc, char *argv[]) {
|
||||
unsigned cpus;
|
||||
const char *comdbg;
|
||||
__log_level = kLogInfo;
|
||||
GetOpts(argc, argv);
|
||||
setenv("GDB", "", true);
|
||||
|
|
|
@ -101,7 +101,8 @@ static void TearDownTmpDir(void) {
|
|||
/**
|
||||
* Runs all test case functions in sorted order.
|
||||
*/
|
||||
void testlib_runtestcases(testfn_t *start, testfn_t *end, testfn_t warmup) {
|
||||
void testlib_runtestcases(const testfn_t *start, const testfn_t *end,
|
||||
testfn_t warmup) {
|
||||
// getpid() calls are inserted to help visually see tests in traces
|
||||
// which can be performed on Linux, FreeBSD, OpenBSD, and XNU:
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue