Skip to content

Commit c49635c

Browse files
committed
fix(examples): ignore unused structured bindings
GCC7 is the only compiler that has a warning for unused returned values of structured bindings
1 parent 1cb600f commit c49635c

File tree

14 files changed

+54
-8
lines changed

14 files changed

+54
-8
lines changed

examples/annotations/textarrow/textarrow_1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ int main() {
55
using namespace matplot;
66

77
plot(iota(1, 10));
8-
auto [t, a] = textarrow(2.5, 6.5, 5, 5, "y=x");
8+
textarrow(2.5, 6.5, 5, 5, "y=x");
99

1010
show();
1111
return 0;

examples/appearance/multiplot/subplot/subplot_13.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ int main() {
55

66
auto ax1 = subplot(2, 1, 0);
77
auto [x, y, z] = peaks();
8+
(void) x;
9+
(void) y;
810
z = transpose(z);
911
plot(ax1, z);
1012
xlim(ax1, {0, 20});

examples/data_distribution/parallelplot/parallelplot_3.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ int main() {
77
X[0] = randn(100, 50, 200);
88
X[1] = transform(X[0], [](double x) { return x + rand(-30, +30); });
99
X[2] = transform(X[0], [](double x) { return x > 50 ? +1. : -1.; });
10+
X[3].resize(X[0].size());
1011
std::generate(X[3].begin(), X[3].end(),
1112
[]() { return cos(rand(-30, +30)); });
1213

examples/data_distribution/plotmatrix/plotmatrix_4.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ int main() {
99
randn(100, 0, 1)};
1010

1111
auto [S, H, axs] = plotmatrix(X);
12+
(void) H;
1213
S[2][0]->color("g");
1314
S[2][0]->marker("*");
14-
H[2]->edge_color("k");
15-
H[2]->face_color("g");
1615
axs[0][1]->title("A Comparison of Data Sets");
1716

1817
show();

examples/data_distribution/wordcloud/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ add_matplot_example(example_wordcloud_1 wordcloud_1.cpp)
22
add_matplot_example(example_wordcloud_2 wordcloud_2.cpp)
33
add_matplot_example(example_wordcloud_3 wordcloud_3.cpp)
44
add_matplot_example(example_wordcloud_4 wordcloud_4.cpp)
5+
6+
configure_file(shakespeare_sonnets.txt shakespeare_sonnets.txt COPYONLY)
7+
configure_file(en_blacklist.txt en_blacklist.txt COPYONLY)

examples/exporting/save/save_3.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ int main() {
1212

1313
const auto &m = backend::gnuplot::extension_terminal();
1414
for (const auto &[extension, format] : m) {
15+
(void) extension;
1516
save(std::string("formats/barchart ") + std::string(format),
1617
std::string(format));
1718
}

examples/geography/geoplot/geoplot_6.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ void eurotrip_solver::setup_starting_point(size_t iteration) {
5454
if (iteration < names_.size()) {
5555
auto [lon_ignore, lat_ignore, tour] =
5656
greedy_tsp_with_idx(lon_, lat_, iteration);
57+
(void) lon_ignore;
58+
(void) lat_ignore;
5759
curr_tour_ = tour;
5860
curr_dist_ = tour_distance(curr_tour_);
5961
} else {

examples/geography/geoplot/geoplot_7.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ void americas_trip_solver::setup_starting_point(size_t iteration) {
5959
if (iteration < names_.size()) {
6060
auto [lon_ignore, lat_ignore, tour] =
6161
greedy_tsp_with_idx(lon_, lat_, iteration);
62+
(void) lon_ignore;
63+
(void) lat_ignore;
6264
curr_tour_ = tour;
6365
curr_dist_ = tour_distance(curr_tour_);
6466
} else {

examples/images/imshow/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@ add_matplot_example(example_imshow_7 imshow_7.cpp)
88
add_matplot_example(example_imshow_8 imshow_8.cpp)
99
add_matplot_example(example_imshow_9 imshow_9.cpp)
1010
add_matplot_example(example_imshow_10 imshow_10.cpp)
11-
add_matplot_example(example_imshow_11 imshow_11.cpp)
11+
add_matplot_example(example_imshow_11 imshow_11.cpp)
12+
13+
file(GLOB ALL_EXAMPLE_IMGS lena_*)
14+
foreach (EXAMPLE_IMG ${ALL_EXAMPLE_IMGS})
15+
get_filename_component(EXAMPLE_IMG_NAME ${EXAMPLE_IMG} NAME)
16+
configure_file(${EXAMPLE_IMG_NAME} ${EXAMPLE_IMG_NAME} COPYONLY)
17+
endforeach ()

examples/surfaces/meshz/meshz_2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ int main() {
66
auto [X, Y] = meshgrid(iota(-3, .125, 3));
77
auto Z = peaks(X, Y);
88
auto [FX, FY] = gradient(Z);
9+
(void) FY;
910
meshz(X, Y, Z, FX);
1011
colorbar();
1112

0 commit comments

Comments
 (0)