From 1f2b9646267228ae79ec816b657f7ba213c33671 Mon Sep 17 00:00:00 2001 From: Otto Sievert <1238259+osievert@users.noreply.github.com> Date: Thu, 27 Jan 2022 06:34:45 -0800 Subject: [PATCH] build: fix builder compilation on macOS - assert() is already defined, so rename this assert() to assert_() - std::tie is a c++11 feature; on macOS, g++ maps to clang and clang defaults to c++old, so explicitly declare the c++ version - these changes should be benign on other platforms (e.g., Linux) --- database/builder/builder.cpp | 8 ++++---- database/builder/makedb.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/database/builder/builder.cpp b/database/builder/builder.cpp index f05a655..a876885 100644 --- a/database/builder/builder.cpp +++ b/database/builder/builder.cpp @@ -49,7 +49,7 @@ void errorFatal(std::string what) exit(1); } -void assert(bool mustBeTrue, std::string what){ +void assert_(bool mustBeTrue, std::string what){ if(!mustBeTrue){ errorFatal(what); } @@ -87,13 +87,13 @@ int encodeVariableLength(std::vector& output, int64_t valueIn, bool han } uint64_t encodePointTo64(int64_t lat, int64_t lon){ - assert(lat || lon, "Tried to encode 0,0. This is not allowed"); + assert_(lat || lon, "Tried to encode 0,0. This is not allowed"); uint64_t latu=encodeSignedToUnsigned(lat); uint64_t lonu=encodeSignedToUnsigned(lon); - assert(latu < (uint64_t)1<<32, "Unsigned lat overflow"); - assert(lonu < (uint64_t)1<<32, "Unsigned lat overflow"); + assert_(latu < (uint64_t)1<<32, "Unsigned lat overflow"); + assert_(lonu < (uint64_t)1<<32, "Unsigned lat overflow"); uint64_t point = 0; for(uint8_t i=31; i<=31; i--){ diff --git a/database/builder/makedb.sh b/database/builder/makedb.sh index 40c9f95..f75d3f0 100755 --- a/database/builder/makedb.sh +++ b/database/builder/makedb.sh @@ -2,7 +2,7 @@ set -e -g++ builder.cpp -o builder -lshp +g++ builder.cpp --std=c++11 -o builder -lshp rm -rf out naturalearth timezone db.zip mkdir -p out