Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ambrop72/badvpn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmbroz Bizjak <abizjak.pro@gmail.com>2018-12-30 15:50:02 +0300
committerAmbroz Bizjak <abizjak.pro@gmail.com>2018-12-30 17:51:55 +0300
commit27382229dca94f8368a1956738de77b4f14601a2 (patch)
tree93359aeb2979d8bdea18518fe8a0b8c5e805bcf1
parentdbf0d4aa9c96dce1d467ba7e28385eeff85fa75f (diff)
Fixes for Visual Studio 2017.
-rw-r--r--CMakeLists.txt3
-rw-r--r--base/BLog.c6
-rw-r--r--base/DebugObject.h2
-rw-r--r--misc/debugcounter.h6
-rw-r--r--misc/debugerror.h2
-rw-r--r--misc/print_macros.h56
-rw-r--r--system/BTime.c6
7 files changed, 12 insertions, 69 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7413cf7..02c6ddc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,7 +130,8 @@ if (NOT (SIZE_SIZE GREATER INT_SIZE OR SIZE_SIZE EQUAL INT_SIZE))
endif ()
if (MSVC)
- add_definitions(-D_CRT_SECURE_NO_WARNINGS /wd4065 /wd4018 /wd4533 /wd4244 /wd4102)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS /wd4065 /wd4018 /wd4533 /wd4244 /wd4102 /wd4098 /wd4267 /wd4116)
+ add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
add_definitions(-std=gnu99 -Wall -Wno-unused-value -Wno-parentheses -Wno-switch -Wredundant-decls -Wshadow)
diff --git a/base/BLog.c b/base/BLog.c
index e3f7406..805b34f 100644
--- a/base/BLog.c
+++ b/base/BLog.c
@@ -38,11 +38,7 @@ struct _BLog_channel blog_channel_list[] = {
#include <generated/blog_channels_list.h>
};
-struct _BLog_global blog_global = {
- #ifndef NDEBUG
- 0
- #endif
-};
+struct _BLog_global blog_global = {0};
#endif
diff --git a/base/DebugObject.h b/base/DebugObject.h
index b8db287..dd9d4ba 100644
--- a/base/DebugObject.h
+++ b/base/DebugObject.h
@@ -55,6 +55,8 @@
typedef struct {
#ifndef NDEBUG
uint32_t c;
+ #else
+ int dummy_field; // struct must have at least one field
#endif
} DebugObject;
diff --git a/misc/debugcounter.h b/misc/debugcounter.h
index a8a54a1..6427968 100644
--- a/misc/debugcounter.h
+++ b/misc/debugcounter.h
@@ -44,14 +44,12 @@
typedef struct {
#ifndef NDEBUG
int32_t c;
+#else
+ int dummy_field; // struct must have at least one field
#endif
} DebugCounter;
-#ifndef NDEBUG
#define DEBUGCOUNTER_STATIC { 0 }
-#else
-#define DEBUGCOUNTER_STATIC {}
-#endif
/**
* Initializes the object.
diff --git a/misc/debugerror.h b/misc/debugerror.h
index 182afd7..a25f0aa 100644
--- a/misc/debugerror.h
+++ b/misc/debugerror.h
@@ -52,6 +52,8 @@
typedef struct {
#ifndef NDEBUG
BPending job;
+ #else
+ int dummy_field; // struct must have at least one field
#endif
} DebugError;
diff --git a/misc/print_macros.h b/misc/print_macros.h
index a07fdbe..33ea593 100644
--- a/misc/print_macros.h
+++ b/misc/print_macros.h
@@ -34,65 +34,13 @@
#ifndef BADVPN_PRINT_MACROS
#define BADVPN_PRINT_MACROS
-#ifdef _MSC_VER
+#include <inttypes.h>
// size_t
+#ifdef _MSC_VER
#define PRIsz "Iu"
-
-// signed exact width (intN_t)
-#define PRId8 "d"
-#define PRIi8 "i"
-#define PRId16 "d"
-#define PRIi16 "i"
-#define PRId32 "I32d"
-#define PRIi32 "I32i"
-#define PRId64 "I64d"
-#define PRIi64 "I64i"
-
-// unsigned exact width (uintN_t)
-#define PRIo8 "o"
-#define PRIu8 "u"
-#define PRIx8 "x"
-#define PRIX8 "X"
-#define PRIo16 "o"
-#define PRIu16 "u"
-#define PRIx16 "x"
-#define PRIX16 "X"
-#define PRIo32 "I32o"
-#define PRIu32 "I32u"
-#define PRIx32 "I32x"
-#define PRIX32 "I32X"
-#define PRIo64 "I64o"
-#define PRIu64 "I64u"
-#define PRIx64 "I64x"
-#define PRIX64 "I64X"
-
-// signed maximum width (intmax_t)
-#define PRIdMAX "I64d"
-#define PRIiMAX "I64i"
-
-// unsigned maximum width (uintmax_t)
-#define PRIoMAX "I64o"
-#define PRIuMAX "I64u"
-#define PRIxMAX "I64x"
-#define PRIXMAX "I64X"
-
-// signed pointer (intptr_t)
-#define PRIdPTR "Id"
-#define PRIiPTR "Ii"
-
-// unsigned pointer (uintptr_t)
-#define PRIoPTR "Io"
-#define PRIuPTR "Iu"
-#define PRIxPTR "Ix"
-#define PRIXPTR "IX"
-
#else
-
-#include <inttypes.h>
-
#define PRIsz "zu"
-
#endif
#endif
diff --git a/system/BTime.c b/system/BTime.c
index a1fa9e7..6216fcd 100644
--- a/system/BTime.c
+++ b/system/BTime.c
@@ -30,9 +30,5 @@
#include <system/BTime.h>
#ifndef BADVPN_PLUGIN
-struct _BTime_global btime_global = {
- #ifndef NDEBUG
- 0
- #endif
-};
+struct _BTime_global btime_global = {0};
#endif