Skip to content

Commit 05a39ae

Browse files
committed
Merge branch 'master' into remove-openssl
2 parents f434e10 + a538e02 commit 05a39ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+843
-539
lines changed

.github/workflows/bazel.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Bazel CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
release:
7+
types:
8+
- released
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions: read-all
16+
17+
jobs:
18+
build-and-test:
19+
runs-on: ubuntu-latest
20+
21+
# We would like to test on the oldest and newest supported.
22+
# https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md
23+
# https://bazel.build/release#support-matrix
24+
# It's not clear how to do that since bazelisk has some magic to pick a
25+
# bazel version.
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30+
31+
- name: Setup Bazel ${{ matrix.bazel }}
32+
uses: bazel-contrib/setup-bazel@4fd964a13a440a8aeb0be47350db2fc640f19ca8 # v0.15.0
33+
with:
34+
# Avoid downloading Bazel every time.
35+
bazelisk-cache: true
36+
# Store build cache per workflow.
37+
disk-cache: ${{ github.workflow }}
38+
# Share repository cache between workflows.
39+
repository-cache: true
40+
41+
- name: Build and Test
42+
run: |
43+
bazel test \
44+
--jobs=45 --keep_going \
45+
--test_verbose_timeout_warnings --test_output=errors \
46+
//...
47+
working-directory: src

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: ${{ matrix.runs-on }}
3333
timeout-minutes: 30
3434
steps:
35-
- uses: zacharyburnett/setup-abseil-cpp@713a4383f10b05948a6d9d4906056063c8da1168 # Not a release, but has #423 fix.
35+
- uses: zacharyburnett/setup-abseil-cpp@4189ecb9fcc7441ed7536774fb0a3f04d3cb779a # Not a release, but has #423 fix.
3636
with:
3737
cmake-build-args: "-DCMAKE_CXX_STANDARD=17 -DABSL_PROPAGATE_CXX_STD=ON -DABSL_ENABLE_INSTALL=ON -DBUILD_TESTING=off -DCMAKE_POSITION_INDEPENDENT_CODE=ON"
3838
abseil-version: "20250814.1"

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
runs-on: ${{ matrix.runs-on }}
3434
timeout-minutes: 30
3535
steps:
36-
- uses: zacharyburnett/setup-abseil-cpp@713a4383f10b05948a6d9d4906056063c8da1168 # Not a release, but has #423 fix.
36+
- uses: zacharyburnett/setup-abseil-cpp@4189ecb9fcc7441ed7536774fb0a3f04d3cb779a # Not a release, but has #423 fix.
3737
with:
3838
cmake-build-args: "-DCMAKE_CXX_STANDARD=17 -DABSL_PROPAGATE_CXX_STD=ON -DABSL_ENABLE_INSTALL=ON -DBUILD_TESTING=off -DCMAKE_POSITION_INDEPENDENT_CODE=ON"
3939
abseil-version: "20250814.1"

CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ else()
9090
# match [-Wattributes]
9191
add_definitions(-Wno-attributes)
9292
add_definitions(-Wno-deprecated-declarations)
93-
# `base/port.h` uses sized deallocation, which should be enabled by
93+
# Some files use sized deallocation, which should be enabled by
9494
# default for C++14 and later. There appears to be a bug with clang
9595
# < 19 causing this not to be enabled.
9696
# https://github.com/google/s2geometry/issues/411#issuecomment-2726949607
@@ -428,11 +428,8 @@ if(S2_ENABLE_INSTALL)
428428
src/s2/internal/s2meta.h
429429
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/s2/internal")
430430
install(FILES src/s2/base/casts.h
431-
src/s2/base/commandlineflags.h
432-
src/s2/base/commandlineflags_declare.h
433431
src/s2/base/log_severity.h
434432
src/s2/base/malloc_extension.h
435-
src/s2/base/port.h
436433
src/s2/base/spinlock.h
437434
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/s2/base")
438435
install(FILES src/s2/testing/gtest_prod.h
@@ -618,9 +615,10 @@ if (BUILD_TESTS)
618615
src/s2/s2winding_operation_test.cc
619616
src/s2/s2wrapped_shape_test.cc
620617
src/s2/sequence_lexicon_test.cc
618+
src/s2/value_lexicon_test.cc
621619
src/s2/util/math/exactfloat/bignum_test.cc
622620
src/s2/util/math/exactfloat/exactfloat_test.cc
623-
src/s2/value_lexicon_test.cc)
621+
src/s2/util/math/exactfloat/exactfloat_underflow_test.cc)
624622

625623
enable_testing()
626624

doc/examples/point_index.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
#include <random>
1010
#include <vector>
1111

12-
#include "s2/base/commandlineflags.h"
13-
#include "s2/s2earth.h"
1412
#include "absl/flags/flag.h"
1513
#include "absl/strings/str_format.h"
14+
1615
#include "s2/s1angle.h"
1716
#include "s2/s2closest_point_query.h"
17+
#include "s2/s2earth.h"
1818
#include "s2/s2point_index.h"
1919
#include "s2/s2random.h"
2020

21-
S2_DEFINE_int32(num_index_points, 10000, "Number of points to index");
22-
S2_DEFINE_int32(num_queries, 10000, "Number of queries");
23-
S2_DEFINE_double(query_radius_km, 100, "Query radius in kilometers");
21+
ABSL_FLAG(int32_t, num_index_points, 10000, "Number of points to index");
22+
ABSL_FLAG(int32_t, num_queries, 10000, "Number of queries");
23+
ABSL_FLAG(double, query_radius_km, 100, "Query radius in kilometers");
2424

2525
int main(int argc, char **argv) {
2626
std::mt19937_64 bitgen;

doc/examples/term_index.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,20 @@
1616
#include <string>
1717
#include <vector>
1818

19-
#include "s2/base/commandlineflags.h"
20-
#include "s2/s2earth.h"
2119
#include "absl/container/btree_set.h"
2220
#include "absl/container/flat_hash_map.h"
2321
#include "absl/flags/flag.h"
2422
#include "absl/strings/str_format.h"
2523
#include "s2/s1angle.h"
2624
#include "s2/s2cap.h"
25+
#include "s2/s2earth.h"
2726
#include "s2/s2point.h"
2827
#include "s2/s2random.h"
2928
#include "s2/s2region_term_indexer.h"
3029

31-
using std::string;
32-
33-
S2_DEFINE_int32(num_documents, 10000, "Number of documents");
34-
S2_DEFINE_int32(num_queries, 10000, "Number of queries");
35-
S2_DEFINE_double(query_radius_km, 100, "Query radius in kilometers");
30+
ABSL_FLAG(int32_t, num_documents, 10000, "Number of documents");
31+
ABSL_FLAG(int32_t, num_queries, 10000, "Number of queries");
32+
ABSL_FLAG(double, query_radius_km, 100, "Query radius in kilometers");
3633

3734
// A prefix added to spatial terms to distinguish them from other index terms
3835
// (e.g. representing words or phrases).

src/BUILD.bazel

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@ cc_library(
236236
"//s2:value_lexicon.h",
237237
],
238238
deps = [
239-
"//s2/base:commandlineflags",
240239
"//s2/base:logging",
241-
"//s2/base:port",
242240
"//s2/base:spinlock",
243241
"//s2/testing",
244242
"//s2/util/bitmap",
@@ -387,7 +385,6 @@ cc_library(
387385
includes = ["src"],
388386
deps = [
389387
":s2",
390-
"//s2/base:commandlineflags",
391388
"//s2/base:timer",
392389
"@abseil-cpp//absl/base",
393390
"@abseil-cpp//absl/flags:flag",

src/s2/_fp_contract_off.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@
4141
// appears before the first non-inline function definition. It is
4242
// named with an underscore so that it is included first among the S2 headers.
4343

44-
// Assume all compilers support or ignore the standard pragma.
45-
#pragma STDC FP_CONTRACT OFF
46-
4744
#if defined(__GNUC__) && !defined(__clang__)
4845
// GCC defines its own pragma that operates at the function level rather than
4946
// the statement level.
5047
#pragma GCC optimize("fp-contract=off")
48+
#else
49+
// Assume all other compilers support or ignore the standard pragma.
50+
// Avoid gcc `-Wunknown-pragmas` warnings by not using this for gcc.
51+
#pragma STDC FP_CONTRACT OFF
5152
#endif
5253

5354
#endif // S2__FP_CONTRACT_OFF_H_

src/s2/base/BUILD

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,6 @@ cc_library(
2929
],
3030
)
3131

32-
cc_library(
33-
name = "port",
34-
hdrs = ["port.h"],
35-
)
36-
37-
cc_library(
38-
name = "commandlineflags",
39-
hdrs = [
40-
"commandlineflags.h",
41-
"commandlineflags_declare.h",
42-
],
43-
deps = [
44-
"@abseil-cpp//absl/flags:flag",
45-
],
46-
)
47-
4832
cc_library(
4933
name = "timer",
5034
hdrs = [

src/s2/base/commandlineflags.h

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)