summaryrefslogtreecommitdiff
path: root/upb/port_def.inc
diff options
context:
space:
mode:
authorEsun Kim <veblush@google.com>2019-07-30 15:43:50 -0700
committerEsun Kim <veblush@google.com>2019-07-30 15:43:50 -0700
commit7a1e6aa84ba857d2e3cdc6e5fd50e3bda210c164 (patch)
treeb4bc5af6bb92804bae676dd32c3b21cdd78972aa /upb/port_def.inc
parentf179e23e5b9f502cce9a2b9fa6a918d1a689758b (diff)
Support MSVC prior to 2015
Diffstat (limited to 'upb/port_def.inc')
-rw-r--r--upb/port_def.inc15
1 files changed, 13 insertions, 2 deletions
diff --git a/upb/port_def.inc b/upb/port_def.inc
index 05c4ebc..0650920 100644
--- a/upb/port_def.inc
+++ b/upb/port_def.inc
@@ -76,8 +76,11 @@
#include <stdarg.h>
#include <stdio.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
-#define _upb_snprintf _snprintf
-#define _upb_vsnprintf _vsnprintf
+int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg);
+int msvc_snprintf(char* s, size_t n, const char* format, ...);
+#define UPB_MSVC_VSNPRINTF
+#define _upb_snprintf msvc_snprintf
+#define _upb_vsnprintf msvc_vsnprintf
#else
#define _upb_snprintf snprintf
#define _upb_vsnprintf vsnprintf
@@ -135,3 +138,11 @@
#else
#define UPB_UNREACHABLE() do { assert(0); } while(0)
#endif
+
+/* UPB_INFINITY representing floating-point positive infinity. */
+#include <math.h>
+#ifdef INFINITY
+#define UPB_INFINITY INFINITY
+#else
+#define UPB_INFINITY (1.0 / 0.0)
+#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback