add more C89-like targets; fix related stuff

This commit is contained in:
Sergio R. Caprile committed 2026-07-09 16:26:30 -03:00
1 parent 6709c028aa
commit f391c4eea0
9 files changed
+59 -16

No files matched your search

+20
View File
@@ -248,6 +248,26 @@ mip_port_s390: CC = $(DOCKER) mdashnet/s390 cc
mip_port_s390: RUN = $(DOCKER) --init mdashnet/s390
mip_port_s390: mip_port_test
diabish: CC = gcc
diabish: CFLAGS += -std=gnu89 -Werror=declaration-after-statement -Werror=vla -Wno-pedantic
diabish: test
mip_diabish: CC = gcc
mip_diabish: CFLAGS += -std=gnu89 -Werror=declaration-after-statement -Werror=vla -Wno-pedantic
mip_diabish: mip_test
ppc_diabish: ASAN=
ppc_diabish: CFLAGS += -std=gnu89 -Werror=declaration-after-statement -Werror=vla -Wno-pedantic
ppc_diabish: CC = $(DOCKER) dockcross/linux-ppc powerpc-unknown-linux-gnu-gcc -static
ppc_diabish: RUN = qemu-ppc-static
ppc_diabish: test
mip_ppc_diabish: ASAN=
mip_ppc_diabish: CFLAGS += -std=gnu89 -Werror=declaration-after-statement -Werror=vla -Wno-pedantic
mip_ppc_diabish: CC = $(DOCKER) dockcross/linux-ppc powerpc-unknown-linux-gnu-gcc -static
mip_ppc_diabish: RUN = qemu-ppc-static
mip_ppc_diabish: mip_test
arm: DEFS += -DMG_ENABLE_POSIX_FS=0 -DMG_ENABLE_TCPIP=1 -DMG_ENABLE_TCPIP_DRIVER_INIT=0 -DMG_ARCH=MG_ARCH_ARMGCC -DNO_SLEEP_ABORT
arm: mongoose.h $(SRCS) mip_test.c
$(DOCKER) mdashnet/armgcc arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test -nostartfiles --specs nosys.specs -e 0
+5 -4
View File
@@ -339,7 +339,7 @@ static void sntp_cb(struct mg_connection *c, int ev, void *ev_data) {
int64_t received = *(int64_t *) ev_data;
*(int64_t *) c->fn_data = received;
MG_DEBUG(("got time: %lld", received));
#if MG_ARCH == MG_ARCH_UNIX
#if MG_ARCH == MG_ARCH_UNIX && defined(__STDC__) && defined(__STDC_VERSION__)
struct timeval tv = {0, 0};
gettimeofday(&tv, 0);
int64_t ms = (int64_t) tv.tv_sec * 1000 + tv.tv_usec / 1000;
@@ -1462,7 +1462,7 @@ static void test_tls(void) {
const char *url = "https://localhost:12347";
char buf[FETCH_BUF_SIZE];
struct mg_tls_opts opts;
struct mg_str data = mg_unpacked("/Makefile");
struct mg_str data = mg_unpacked("/fuzz.c");
char bigdata[FETCH_BUF_SIZE - 256]; // leave extra room
struct mg_str bd;
ASSERT(data.buf != NULL && data.len > 0);
@@ -1505,6 +1505,7 @@ static void test_tls(void) {
// otherwise it will end with 200 and shorter file contents
ASSERT(fetch(&mgr, buf, "https://localhost:8443",
"GET /thefile HTTP/1.0\n\n") == 200);
data = mg_unpacked("/Makefile");
ASSERT(cmpbody(buf, data.buf) == 0); // "thefile" links to Makefile
ASSERT(system("killall tls_multirec/server") == 0);
} else {
@@ -3014,7 +3015,7 @@ static void test_util(void) {
static void test_crc32(void) {
// echo -n aaa | cksum -o3
ASSERT(mg_crc32(0, 0, 0) == 0);
ASSERT(mg_crc32(0, "a", 1) == 3904355907);
ASSERT(mg_crc32(0, "a", 1) == 3904355907U);
ASSERT(mg_crc32(0, "abc", 3) == 891568578);
ASSERT(mg_crc32(mg_crc32(0, "ab", 2), "c", 1) == 891568578);
}
@@ -4501,7 +4502,7 @@ static bool test_upload_dir(const struct mg_dash_user *u, char *buf, size_t len)
struct test_file_entry {
char name[64];
size_t size;
uint64_t size;
};
static struct test_file_entry s_test_file;
static int s_test_file_index;