Add test++ linx++

This commit is contained in:
cpq
2020-12-07 03:47:37 +00:00
parent cb220837b9
commit d7a02d13e4
7 changed files with 18 additions and 12 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ os:
compiler:
- clang
- gcc
script: make mg_prefix cpp test ex
script: make mg_prefix test test++ ex
matrix:
include:
- os: linux
+9 -5
View File
@@ -25,7 +25,7 @@ CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSLDIR)/include
LDFLAGS ?= -L$(OPENSSLDIR)/lib -lssl -lcrypto
endif
all: mg_prefix cpp test ex vc98 vc2017 linux infer fuzz
all: mg_prefix test test++ ex vc98 vc2017 linux linux++ infer fuzz
ex:
@for X in $(EXAMPLES); do $(MAKE) -C $$X $(EXAMPLE_TARGET); done
@@ -35,8 +35,8 @@ mg_prefix: mongoose.c mongoose.h
$(CLANG) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T' | grep -v 'mg_' ; test $$? = 1
# C++ build
cpp: CLANG = g++ -Wno-deprecated
cpp: unamalgamated
test++: CLANG = g++ -Wno-deprecated
test++: unamalgamated
# Make sure we can build from an unamalgamated sources
unamalgamated: $(SRCS) $(HDRS) Makefile
@@ -70,9 +70,13 @@ vc2017: clean Makefile mongoose.c mongoose.h test/unit_test.c
linux: CFLAGS += -DMG_ENABLE_IPV6=1 -fsanitize=address,undefined
linux: clean Makefile mongoose.c mongoose.h test/unit_test.c
$(GCC) gcc mongoose.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -o unit_test_gcc
$(GCC) $(CC) mongoose.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -o unit_test_gcc
$(GCC) ./unit_test_gcc
linux++: CC=g++
linux++: CFLAGS += -Wno-missing-field-initializers
linux++: linux
mongoose.c: $(SRCS) Makefile
(cat src/license.h; echo; echo '#include "mongoose.h"' ; (for F in src/private.h src/*.c ; do echo; echo '#ifdef MG_ENABLE_LINES'; echo "#line 1 \"$$F\""; echo '#endif'; cat $$F | sed -e 's,#include ".*,,'; done))> $@
@@ -80,6 +84,6 @@ mongoose.h: $(HDRS) Makefile
(cat src/license.h src/version.h ; cat src/arch.h src/arch_*.h src/config.h src/str.h src/log.h src/timer.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/event.h src/net.h src/http.h src/tls.h src/ws.h src/sntp.h src/mqtt.h src/dns.h | sed -e 's,#include ".*,,' -e 's,^#pragma once,,')> $@
clean: EXAMPLE_TARGET = clean
clean: $(EXAMPLES)
clean: ex
rm -rf $(PROG) *.o *.dSYM unit_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out
+3 -2
View File
@@ -1648,7 +1648,8 @@ struct mqtt_message {
static void mqtt_send_header(struct mg_connection *c, uint8_t cmd,
uint8_t flags, uint32_t len) {
uint8_t buf[1 + sizeof(len)] = {(cmd << 4) | flags}, *vlen = &buf[1];
uint8_t buf[1 + sizeof(len)], *vlen = &buf[1];
buf[0] = (cmd << 4) | flags;
do {
*vlen = len % 0x80;
len /= 0x80;
@@ -2781,7 +2782,7 @@ struct mg_str mg_str(const char *s) {
return str;
}
struct mg_str mg_str_n(const char *s, int n) {
struct mg_str mg_str_n(const char *s, size_t n) {
struct mg_str str = {s, n};
return str;
}
+1 -1
View File
@@ -360,7 +360,7 @@ struct mg_str {
{ NULL, 0 }
struct mg_str mg_str(const char *s);
struct mg_str mg_str_n(const char *s, int n);
struct mg_str mg_str_n(const char *s, size_t n);
int mg_lower(const char *s);
int mg_ncasecmp(const char *s1, const char *s2, size_t len);
int mg_casecmp(const char *s1, const char *s2);
+2 -1
View File
@@ -43,7 +43,8 @@ struct mqtt_message {
static void mqtt_send_header(struct mg_connection *c, uint8_t cmd,
uint8_t flags, uint32_t len) {
uint8_t buf[1 + sizeof(len)] = {(cmd << 4) | flags}, *vlen = &buf[1];
uint8_t buf[1 + sizeof(len)], *vlen = &buf[1];
buf[0] = (cmd << 4) | flags;
do {
*vlen = len % 0x80;
len /= 0x80;
+1 -1
View File
@@ -6,7 +6,7 @@ struct mg_str mg_str(const char *s) {
return str;
}
struct mg_str mg_str_n(const char *s, int n) {
struct mg_str mg_str_n(const char *s, size_t n) {
struct mg_str str = {s, n};
return str;
}
+1 -1
View File
@@ -12,7 +12,7 @@ struct mg_str {
{ NULL, 0 }
struct mg_str mg_str(const char *s);
struct mg_str mg_str_n(const char *s, int n);
struct mg_str mg_str_n(const char *s, size_t n);
int mg_lower(const char *s);
int mg_ncasecmp(const char *s1, const char *s2, size_t len);
int mg_casecmp(const char *s1, const char *s2);