Fix #1315, fix #1317 - use #ifndef instead of #pragma once for compilers that do not support #pragma once

This commit is contained in:
Sergey Lyubka 2021-07-19 09:04:18 +01:00
parent 497b8027f5
commit 3982e065c8
3 changed files with 8 additions and 3 deletions

View File

@ -118,7 +118,7 @@ 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))> $@
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/ssi.h src/tls.h src/ws.h src/sntp.h src/mqtt.h src/dns.h | sed -e 's,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif')> $@
(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/ssi.h src/tls.h src/ws.h src/sntp.h src/mqtt.h src/dns.h | sed -e 's,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@
clean: EXAMPLE_TARGET = clean
clean: ex

View File

@ -14,7 +14,9 @@
//
// Alternatively, you can license this software under a commercial
// license, as set out in <https://www.cesanta.com/license>.
#pragma once
#ifndef MONGOOSE_H
#define MONGOOSE_H
#define MG_VERSION "7.3"
#ifdef __cplusplus
@ -978,3 +980,4 @@ size_t mg_dns_decode_name(const uint8_t *, size_t, size_t, char *, size_t);
#ifdef __cplusplus
}
#endif
#endif // MONGOOSE_H

View File

@ -1,4 +1,6 @@
#pragma once
#ifndef MONGOOSE_H
#define MONGOOSE_H
#define MG_VERSION "7.3"
#ifdef __cplusplus