From 3982e065c8bed3e040ceeff200a54426105a7faa Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Mon, 19 Jul 2021 09:04:18 +0100 Subject: [PATCH] Fix #1315, fix #1317 - use #ifndef instead of #pragma once for compilers that do not support #pragma once --- Makefile | 2 +- mongoose.h | 5 ++++- src/version.h | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 081dfa49..ea1f0a11 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/mongoose.h b/mongoose.h index 108ff2cb..7db835c5 100644 --- a/mongoose.h +++ b/mongoose.h @@ -14,7 +14,9 @@ // // Alternatively, you can license this software under a commercial // license, as set out in . -#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 diff --git a/src/version.h b/src/version.h index 15d4aac9..d4d960ba 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,6 @@ -#pragma once +#ifndef MONGOOSE_H +#define MONGOOSE_H + #define MG_VERSION "7.3" #ifdef __cplusplus