From 5a6aa5c252a70554a6987bfbb721ef7d722e1e20 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Sat, 24 Nov 2018 12:49:33 -0800 Subject: [PATCH] Fix C++ compilation warnings/errors under g++ 8.2. In metadata.cc: warning: In the GNU C Library, "major" is defined by . For historical compatibility, it is currently defined by as well, but we plan to remove this soon. To use "major", include directly. If you did not intend to use a system-defined macro "major", you should undefine it after including . In third_party/sha1.cc: error: types may not be defined within __builtin_offsetof Alter the code to always assume that buffers are unaligned, which should be correct at the cost of performance. This shouldn't matter much in practice since SHA-1 is mostly not being used by Cumulus any longer. In third_party/sha256.cc: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" --- metadata.cc | 1 + third_party/sha1.cc | 2 +- third_party/sha256.cc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/metadata.cc b/metadata.cc index 63fdadc..96d21ea 100644 --- a/metadata.cc +++ b/metadata.cc @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/third_party/sha1.cc b/third_party/sha1.cc index 9e9e74b..a7390b3 100644 --- a/third_party/sha1.cc +++ b/third_party/sha1.cc @@ -154,7 +154,7 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) { #if !_STRING_ARCH_unaligned # define alignof(type) offsetof (struct { char c; type x; }, x) -# define UNALIGNED_P(p) (((size_t) p) % alignof (md5_uint32) != 0) +# define UNALIGNED_P(p) (1) if (UNALIGNED_P (buffer)) while (len > 64) { diff --git a/third_party/sha256.cc b/third_party/sha256.cc index 9e249be..6180f7b 100644 --- a/third_party/sha256.cc +++ b/third_party/sha256.cc @@ -27,7 +27,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _BSD_SOURCE +#define _DEFAULT_SOURCE #include #include #include -- 2.20.1