From: Michael Vrable Date: Sat, 24 Nov 2018 20:49:33 +0000 (-0800) Subject: Fix C++ compilation warnings/errors under g++ 8.2. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=5a6aa5c252a70554a6987bfbb721ef7d722e1e20;p=cumulus.git 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" --- 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