summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2019-05-10 11:44:38 -0700
committerSam Roberts <vieuxtech@gmail.com>2019-05-13 13:43:07 -0700
commitc9bdc49e01a67d16caf48763c42823046b37a786 (patch)
tree7424df19c65d305465022cbee8bebdf74f6c2f03 /src
parent1df3080af393a338df4cfbb56b442fe4b8345495 (diff)
downloadandroid-node-v8-c9bdc49e01a67d16caf48763c42823046b37a786.tar.gz
android-node-v8-c9bdc49e01a67d16caf48763c42823046b37a786.tar.bz2
android-node-v8-c9bdc49e01a67d16caf48763c42823046b37a786.zip
src: fix warnings about redefined BSWAP macros
PR-URL: https://github.com/nodejs/node/pull/27631 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/util-inl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util-inl.h b/src/util-inl.h
index 99d470205e..1abebf6e13 100644
--- a/src/util-inl.h
+++ b/src/util-inl.h
@@ -27,6 +27,18 @@
#include <cstring>
#include "util.h"
+// These are defined by <sys/byteorder.h> or <netinet/in.h> on some systems.
+// To avoid warnings, undefine them before redefining them.
+#ifdef BSWAP_2
+# undef BSWAP_2
+#endif
+#ifdef BSWAP_4
+# undef BSWAP_4
+#endif
+#ifdef BSWAP_8
+# undef BSWAP_8
+#endif
+
#if defined(_MSC_VER)
#include <intrin.h>
#define BSWAP_2(x) _byteswap_ushort(x)