mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-15 19:13:18 +00:00
Add test++ linx++
This commit is contained in:
1 parent
cb220837b9
commit
d7a02d13e4
7 files changed
+18
-12
No files matched your search
+1
-1
@@ -10,7 +10,7 @@ os:
|
|||||||
compiler:
|
compiler:
|
||||||
- clang
|
- clang
|
||||||
- gcc
|
- gcc
|
||||||
script: make mg_prefix cpp test ex
|
script: make mg_prefix test test++ ex
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSLDIR)/include
|
|||||||
LDFLAGS ?= -L$(OPENSSLDIR)/lib -lssl -lcrypto
|
LDFLAGS ?= -L$(OPENSSLDIR)/lib -lssl -lcrypto
|
||||||
endif
|
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:
|
ex:
|
||||||
@for X in $(EXAMPLES); do $(MAKE) -C $$X $(EXAMPLE_TARGET); done
|
@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
|
$(CLANG) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T' | grep -v 'mg_' ; test $$? = 1
|
||||||
|
|
||||||
# C++ build
|
# C++ build
|
||||||
cpp: CLANG = g++ -Wno-deprecated
|
test++: CLANG = g++ -Wno-deprecated
|
||||||
cpp: unamalgamated
|
test++: unamalgamated
|
||||||
|
|
||||||
# Make sure we can build from an unamalgamated sources
|
# Make sure we can build from an unamalgamated sources
|
||||||
unamalgamated: $(SRCS) $(HDRS) Makefile
|
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: CFLAGS += -DMG_ENABLE_IPV6=1 -fsanitize=address,undefined
|
||||||
linux: clean Makefile mongoose.c mongoose.h test/unit_test.c
|
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
|
$(GCC) ./unit_test_gcc
|
||||||
|
|
||||||
|
linux++: CC=g++
|
||||||
|
linux++: CFLAGS += -Wno-missing-field-initializers
|
||||||
|
linux++: linux
|
||||||
|
|
||||||
mongoose.c: $(SRCS) Makefile
|
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))> $@
|
(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,,')> $@
|
(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: 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
|
rm -rf $(PROG) *.o *.dSYM unit_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out
|
||||||
|
|
||||||
+3
-2
@@ -1648,7 +1648,8 @@ struct mqtt_message {
|
|||||||
|
|
||||||
static void mqtt_send_header(struct mg_connection *c, uint8_t cmd,
|
static void mqtt_send_header(struct mg_connection *c, uint8_t cmd,
|
||||||
uint8_t flags, uint32_t len) {
|
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 {
|
do {
|
||||||
*vlen = len % 0x80;
|
*vlen = len % 0x80;
|
||||||
len /= 0x80;
|
len /= 0x80;
|
||||||
@@ -2781,7 +2782,7 @@ struct mg_str mg_str(const char *s) {
|
|||||||
return str;
|
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};
|
struct mg_str str = {s, n};
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -360,7 +360,7 @@ struct mg_str {
|
|||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
|
|
||||||
struct mg_str mg_str(const char *s);
|
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_lower(const char *s);
|
||||||
int mg_ncasecmp(const char *s1, const char *s2, size_t len);
|
int mg_ncasecmp(const char *s1, const char *s2, size_t len);
|
||||||
int mg_casecmp(const char *s1, const char *s2);
|
int mg_casecmp(const char *s1, const char *s2);
|
||||||
|
|||||||
+2
-1
@@ -43,7 +43,8 @@ struct mqtt_message {
|
|||||||
|
|
||||||
static void mqtt_send_header(struct mg_connection *c, uint8_t cmd,
|
static void mqtt_send_header(struct mg_connection *c, uint8_t cmd,
|
||||||
uint8_t flags, uint32_t len) {
|
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 {
|
do {
|
||||||
*vlen = len % 0x80;
|
*vlen = len % 0x80;
|
||||||
len /= 0x80;
|
len /= 0x80;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ struct mg_str mg_str(const char *s) {
|
|||||||
return str;
|
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};
|
struct mg_str str = {s, n};
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ struct mg_str {
|
|||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
|
|
||||||
struct mg_str mg_str(const char *s);
|
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_lower(const char *s);
|
||||||
int mg_ncasecmp(const char *s1, const char *s2, size_t len);
|
int mg_ncasecmp(const char *s1, const char *s2, size_t len);
|
||||||
int mg_casecmp(const char *s1, const char *s2);
|
int mg_casecmp(const char *s1, const char *s2);
|
||||||
|
|||||||
Reference in new issue
Block a user