Skip to content

Commit 55c9313

Browse files
committed
Silence unused-variable warnings incorrectly emitted by clang.
1 parent c4867c4 commit 55c9313

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/_mplcairo.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ void GraphicsContextRenderer::draw_gouraud_triangles(
854854
if (&gc != this) {
855855
throw std::invalid_argument{"non-matching GraphicsContext"};
856856
}
857-
auto const& ac = _additional_context();
857+
[[maybe_unused]] auto const& ac = _additional_context();
858858
auto mtx = matrix_from_transform(transform, get_additional_state().height);
859859
auto const& tri_raw = triangles.unchecked<3>();
860860
auto const& col_raw = colors.unchecked<3>();
@@ -892,7 +892,7 @@ void GraphicsContextRenderer::draw_image(
892892
if (&gc != this) {
893893
throw std::invalid_argument{"non-matching GraphicsContext"};
894894
}
895-
auto const& ac = _additional_context();
895+
[[maybe_unused]] auto const& ac = _additional_context();
896896
auto const& im_raw = im.unchecked<3>();
897897
auto const& height = im_raw.shape(0), width = im_raw.shape(1);
898898
if (im_raw.shape(2) != 4) {
@@ -974,7 +974,7 @@ void GraphicsContextRenderer::draw_path(
974974
if (&gc != this) {
975975
throw std::invalid_argument{"non-matching GraphicsContext"};
976976
}
977-
auto const& ac = _additional_context();
977+
[[maybe_unused]] auto const& ac = _additional_context();
978978
auto path_loaded = false;
979979
auto mtx = matrix_from_transform(transform, get_additional_state().height);
980980
auto const& load_path = [&] {
@@ -1064,7 +1064,7 @@ void maybe_multithread(cairo_t* cr, int n, T /* lambda */ worker) {
10641064
worker, ctx, chunk_size * i, std::min<int>(chunk_size * (i + 1), n));
10651065
}
10661066
{
1067-
auto const& nogil = py::gil_scoped_release{};
1067+
[[maybe_unused]] auto const& nogil = py::gil_scoped_release{};
10681068
for (auto& thread: threads) {
10691069
thread.join();
10701070
}
@@ -1094,7 +1094,7 @@ void GraphicsContextRenderer::draw_markers(
10941094
if (&gc != this) {
10951095
throw std::invalid_argument{"non-matching GraphicsContext"};
10961096
}
1097-
auto const& ac = _additional_context();
1097+
[[maybe_unused]] auto const& ac = _additional_context();
10981098

10991099
// As paths store their vertices in an array, the .cast<>() will not make a
11001100
// copy and we don't need to explicitly keep the intermediate result alive.
@@ -1303,7 +1303,7 @@ void GraphicsContextRenderer::draw_path_collection(
13031303
if (&gc != this) {
13041304
throw std::invalid_argument{"non-matching GraphicsContext"};
13051305
}
1306-
auto const& ac = _additional_context();
1306+
[[maybe_unused]] auto const& ac = _additional_context();
13071307
auto const& old_snap = get_additional_state().snap;
13081308
get_additional_state().snap = false;
13091309

@@ -1433,7 +1433,7 @@ void GraphicsContextRenderer::draw_quad_mesh(
14331433
if (&gc != this) {
14341434
throw std::invalid_argument{"non-matching GraphicsContext"};
14351435
}
1436-
auto const& ac = _additional_context();
1436+
[[maybe_unused]] auto const& ac = _additional_context();
14371437
auto mtx =
14381438
matrix_from_transform(master_transform, get_additional_state().height);
14391439
auto const& fcs_raw = fcs.unchecked<2>(),
@@ -1535,7 +1535,7 @@ void GraphicsContextRenderer::draw_text(
15351535
if (&gc != this) {
15361536
throw std::invalid_argument{"non-matching GraphicsContext"};
15371537
}
1538-
auto const& ac = _additional_context();
1538+
[[maybe_unused]] auto const& ac = _additional_context();
15391539
if (ismath) {
15401540
// NOTE: This uses unhinted metrics for parsing/positioning but normal
15411541
// hinting for rendering, not sure whether this is a problem...
@@ -1780,7 +1780,7 @@ void MathtextBackend::draw(
17801780
// state. even though nothing is written.
17811781
return;
17821782
}
1783-
auto const& ac = gcr._additional_context();
1783+
[[maybe_unused]] auto const& ac = gcr._additional_context();
17841784
auto const& cr = gcr.cr_;
17851785
auto const& dpi = get_additional_state(cr).dpi;
17861786
cairo_translate(cr, x, y);

src/_util.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ struct LoadPathContext {
276276
void load_path_exact(
277277
cairo_t* cr, py::handle path, cairo_matrix_t const* matrix)
278278
{
279-
auto const& gil = py::gil_scoped_acquire{};
279+
[[maybe_unused]] auto const& gil = py::gil_scoped_acquire{};
280280

281281
auto const& min = double(-(1 << 22)), max = double(1 << 22);
282282
auto const& lpc = LoadPathContext{cr};
@@ -441,7 +441,7 @@ void load_path_exact(
441441
cairo_t* cr, py::array_t<double> vertices_keepref,
442442
ssize_t start, ssize_t stop, cairo_matrix_t const* matrix)
443443
{
444-
auto const& gil = py::gil_scoped_acquire{};
444+
[[maybe_unused]] auto const& gil = py::gil_scoped_acquire{};
445445

446446
auto const min = double(-(1 << 22)), max = double(1 << 22);
447447
auto const& lpc = LoadPathContext{cr};
@@ -815,13 +815,13 @@ GlyphsAndClusters text_to_glyphs_and_clusters(cairo_t* cr, std::string s)
815815
auto gac = GlyphsAndClusters{};
816816
if (has_raqm()) {
817817
auto const& ft_face = cairo_ft_scaled_font_lock_face(scaled_font);
818-
auto const& scaled_font_unlock_cleanup =
818+
[[maybe_unused]] auto const& scaled_font_unlock_cleanup =
819819
std::unique_ptr<
820820
std::remove_pointer_t<cairo_scaled_font_t>,
821821
decltype(&cairo_ft_scaled_font_unlock_face)>{
822822
scaled_font, cairo_ft_scaled_font_unlock_face};
823823
auto const& rq = raqm::create();
824-
auto const& rq_cleanup =
824+
[[maybe_unused]] auto const& rq_cleanup =
825825
std::unique_ptr<std::remove_pointer_t<raqm_t>, decltype(raqm::destroy)>{
826826
rq, raqm::destroy};
827827
if (!rq) {

0 commit comments

Comments
 (0)