Skip to content

Commit ff3f727

Browse files
authored
Fix some additional CRAN issues (#275)
* allow forcing a bundled build * fix compact array * maybe fix region covererr * NEWS
1 parent 342bbc2 commit ff3f727

File tree

6 files changed

+31
-12
lines changed

6 files changed

+31
-12
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: s2
22
Title: Spherical Geometry Operators Using the S2 Geometry Library
3-
Version: 1.1.8
3+
Version: 1.1.8.9000
44
Authors@R: c(
55
person(given = "Dewey",
66
family = "Dunnington",

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# s2 (development version)
22

3+
* Fix code to help gcc-ubsan understand the region coverer (#275)
4+
* Inspect `S2_FORCE_BUNDLED_ABSEIL` in `conifigure`: if non-empty, any system
5+
install of Abseil is ignored (e.g., if using a non-standard compiler on a
6+
system where system Abseil is available via pkg-config) (#275)
7+
* Disable optimization in compact_array.h that confused compilers when compiling
8+
with `-Wpedantic` (#275).
9+
* Add `cmake` to SystemReqirements. Even though this is technically optional
10+
(system Abseil can be used), adding to requirements helps some installers
11+
automatically install the dependency (#277).
12+
13+
# s2 1.1.8
14+
315
* `s2_buffer_cells()` recycles `max_dist` and `min_level` arguments, allowing
416
to specify these by feature (#264 and
517
https://github.com/r-spatial/sf/issues/2488).

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:`pwd`/tools/pkgconfig"
6969

7070
echo "** Using PKG_CONFIG_PATH=${PKG_CONFIG_PATH}"
7171

72-
if pkg-config absl_s2 --libs >/dev/null 2>/dev/null; then
72+
if [ -z "$S2_FORCE_BUNDLED_ABSEIL" ] && pkg-config absl_s2 --libs >/dev/null 2>/dev/null; then
7373
echo "** Using abseil-cpp from pkg-config"
7474

7575
PKGCONFIG_CFLAGS=`pkg-config --cflags-only-I absl_s2`

src/s2/s2region_coverer.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,15 @@ class S2RegionCoverer {
252252
private:
253253
struct Candidate {
254254
void* operator new(std::size_t size, std::size_t max_children) {
255-
return ::operator new (size + max_children * sizeof(Candidate *));
255+
// CRAN edit: the sanitizer doesn't understand [0], so we just fix the
256+
// size at the
257+
// widest possible size.
258+
// https://github.com/r-spatial/s2/pull/238
259+
// https://github.com/r-spatial/s2/pull/275
260+
return ::operator new(size);
256261
}
257262

258-
void operator delete(void* p) {
259-
::operator delete (p);
260-
}
263+
void operator delete(void* p) { ::operator delete(p); }
261264

262265
Candidate(const S2Cell& cell, const std::size_t max_children)
263266
: cell(cell), is_terminal(max_children == 0) {
@@ -270,9 +273,12 @@ class S2RegionCoverer {
270273
~Candidate() = default;
271274

272275
S2Cell cell;
273-
bool is_terminal; // Cell should not be expanded further.
274-
int num_children = 0; // Number of children that intersect the region.
275-
__extension__ Candidate* children[0]; // Actual size may be 0, 4, 16, or 64 elements.
276+
bool is_terminal; // Cell should not be expanded further.
277+
int num_children = 0; // Number of children that intersect the region.
278+
// CRAN edit: the sanitizer doesn't understand [0], so we just fix the size
279+
// at the widest possible size. https://github.com/r-spatial/s2/pull/238
280+
// https://github.com/r-spatial/s2/pull/275
281+
Candidate* children[64]; // Actual size may be 0, 4, 16, or 64 elements.
276282
};
277283

278284
// If the cell intersects the given region, return a new candidate with no
@@ -347,7 +353,8 @@ class S2RegionCoverer {
347353
}
348354
};
349355
typedef std::priority_queue<QueueEntry, std::vector<QueueEntry>,
350-
CompareQueueEntries> CandidateQueue;
356+
CompareQueueEntries>
357+
CandidateQueue;
351358
CandidateQueue pq_;
352359

353360
// True if we're computing an interior covering.

src/s2/util/gtl/compact_array.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ class compact_array_base {
8989
#endif
9090

9191
// Opportunistically consider allowing inlined elements.
92-
#if defined(_LP64) && defined(__GNUC__)
92+
// Edit for CRAN: This is not supported by -Wpedantic
93+
#if false && defined(_LP64) && defined(__GNUC__)
9394
// With 64-bit pointers, our approach is to form a 16-byte struct:
9495
// [5 bytes for size, capacity, is_exponent and is_inlined]
9596
// [3 bytes of padding or inlined elements]

tools/vendor/abseil-cpp/absl/copts/GENERATED_AbseilCopts.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,4 @@ list(APPEND ABSL_RANDOM_HWAES_MSVC_X64_FLAGS
225225

226226
list(APPEND ABSL_RANDOM_HWAES_X64_FLAGS
227227
"-maes"
228-
"-msse4.1"
229228
)

0 commit comments

Comments
 (0)