blob: ce55b602fc83cc7d9bbee0e8cb82c4d98ffd6c6a [file] [log] [blame]
Austin Schuh68156cb2024-06-25 21:24:29 -07001diff -r -u a/bazel/ceres.bzl b/bazel/ceres.bzl
2--- a/bazel/ceres.bzl 2024-06-25 18:35:28.266797366 -0700
3+++ b/bazel/ceres.bzl 2024-06-25 18:25:10.919515348 -0700
4@@ -189,6 +189,9 @@
5 "-I" + internal,
6 "-Wunused-parameter",
7 "-Wno-sign-compare",
8+ "-Wno-format-nonliteral",
9+ "-Wno-unused-parameter",
10+ "-Wno-unused-but-set-variable",
11 ] + schur_eliminator_copts,
12
13 # These include directories and defines are propagated to other targets
14@@ -214,7 +217,7 @@
15 ],
16 visibility = ["//visibility:public"],
17 deps = [
18- "@com_gitlab_libeigen_eigen//:eigen",
19 "@com_github_google_glog//:glog",
20+ "@org_tuxfamily_eigen//:eigen",
21 ],
22 )
23diff -r -u a/BUILD b/BUILD
24--- a/BUILD 2024-06-25 18:35:28.266797366 -0700
25+++ b/BUILD 2024-06-25 18:25:10.919515348 -0700
26@@ -32,6 +32,7 @@
27 # not support parameterization around threading choice or sparse backends.
28
29 load("//:bazel/ceres.bzl", "ceres_library")
30+load("@org_frc971//tools/build_rules:select.bzl", "compiler_select")
31
32 ceres_library(
33 name = "ceres",
34@@ -57,6 +58,7 @@
35 ],
36 copts = [
37 "-Wno-sign-compare",
38+ "-Wno-unused-but-set-variable",
39 "-DCERES_TEST_SRCDIR_SUFFIX=\\\"data/\\\"",
40 ],
41 includes = [
42@@ -165,12 +167,16 @@
43 # but in the future disable these warnings only for rotation_test.
44 # TODO(keir): When the tests are macro-ified, apply these selectively.
45 "-Wno-address",
46-]
47+ "-Wno-unused-parameter",
48+] + compiler_select({
49+ "gcc": ["-Wno-use-after-free"],
50+ "clang": [],
51+})
52
53 TEST_DEPS = [
54 "//:ceres",
55 "//:test_util",
56- "@com_gitlab_libeigen_eigen//:eigen",
57+ "@org_tuxfamily_eigen//:eigen",
58 "@com_github_gflags_gflags//:gflags",
59 ]
60
61diff -r -u a/examples/BUILD b/examples/BUILD
62--- a/examples/BUILD 2024-06-25 18:35:28.270797439 -0700
63+++ b/examples/BUILD 2024-06-25 18:25:32.355906091 -0700
64@@ -31,13 +31,14 @@
65 EXAMPLE_COPTS = [
66 # Needed to silence GFlags complaints.
67 "-Wno-sign-compare",
68+ "-Wno-unused-parameter",
69 # Needed to put fscanf in a function.
70 "-Wno-format-nonliteral",
71 ]
72
73 EXAMPLE_DEPS = [
74 "//:ceres",
75- "@com_gitlab_libeigen_eigen//:eigen",
76+ "@org_tuxfamily_eigen//:eigen",
77 "@com_github_gflags_gflags//:gflags",
78 ]
79
80diff -r -u a/internal/ceres/autodiff_test.cc b/internal/ceres/autodiff_test.cc
81--- a/internal/ceres/autodiff_test.cc 2024-06-25 18:35:28.278797586 -0700
82+++ b/internal/ceres/autodiff_test.cc 2024-06-25 18:25:10.935515640 -0700
83@@ -647,6 +647,10 @@
84 }
85 }
86
87+#ifdef __clang__
88+#pragma clang diagnostic push
89+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
90+#endif
91 // This is fragile test that triggers the alignment bug on
92 // i686-apple-darwin10-llvm-g++-4.2 (GCC) 4.2.1. It is quite possible,
93 // that other combinations of operating system + compiler will
94@@ -671,5 +675,8 @@
95 // Need this to makes sure that x does not get optimized out.
96 x[0] = x[0] + JetT(1.0);
97 }
98+#ifdef __clang__
99+#pragma clang diagnostic pop
100+#endif
101
102 } // namespace ceres::internal
103diff -r -u a/internal/ceres/bundle_adjustment_test_util.h b/internal/ceres/bundle_adjustment_test_util.h
104--- a/internal/ceres/bundle_adjustment_test_util.h 2024-06-25 18:35:28.278797586 -0700
105+++ b/internal/ceres/bundle_adjustment_test_util.h 2024-06-25 18:32:23.019406091 -0700
106@@ -97,7 +97,8 @@
107
108 private:
109 void ReadData(const std::string& filename) {
110- FILE* fptr = fopen(filename.c_str(), "r");
111+ FILE* fptr = fopen(
112+ (std::string("../com_google_ceres_solver/") + filename).c_str(), "r");
113
114 if (!fptr) {
115 LOG(FATAL) << "File Error: unable to open file " << filename;
116diff -r -u a/internal/ceres/triplet_sparse_matrix_test.cc b/internal/ceres/triplet_sparse_matrix_test.cc
117--- a/internal/ceres/triplet_sparse_matrix_test.cc 2024-06-25 18:35:28.298797952 -0700
118+++ b/internal/ceres/triplet_sparse_matrix_test.cc 2024-06-25 18:25:10.963516152 -0700
119@@ -184,8 +184,15 @@
120 orig.mutable_values()[1] = 5.2;
121 orig.set_num_nonzeros(2);
122
123+#ifdef __clang__
124+#pragma clang diagnostic push
125+#pragma clang diagnostic ignored "-Wself-assign-overloaded"
126+#endif
127 // Who's on earth gonna do this?
128 orig = orig;
129+#ifdef __clang__
130+#pragma clang diagnostic pop
131+#endif
132
133 EXPECT_EQ(orig.num_rows(), 2);
134 EXPECT_EQ(orig.num_cols(), 5);