From adcc33e0375694c68728c61b289975c1d7d0ee0b Mon Sep 17 00:00:00 2001 From: Georg Sauthoff Date: Tue, 16 Oct 2018 22:09:43 +0200 Subject: Fix doc target missing declarations errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building the docs (e.g. with `ninja doc`) failed with GCC (e.g. GCC 7.3 under Fedora 27) with some missing declaration errors. Example: ../Rx/v2/examples/doxygen/main.cpp:7:13: error: no previous declaration for ‘std::__cxx11::string get_pid()’ [-Werror=missing-declarations] Thus, this change adds a shared declaration for `get_pid()` that is included by all users/the file where it's defined such that accidental deviation in the signature are immediately noticed (as compile error). Similarly, the visibility of the example `less()` is changed to static as it's only locally used. With those changes the doc target succeeds again. --- Rx/v2/examples/doxygen/amb.cpp | 2 +- Rx/v2/examples/doxygen/buffer.cpp | 2 +- Rx/v2/examples/doxygen/combine_latest.cpp | 2 +- Rx/v2/examples/doxygen/concat_map.cpp | 2 +- Rx/v2/examples/doxygen/flat_map.cpp | 2 +- Rx/v2/examples/doxygen/from.cpp | 2 +- Rx/v2/examples/doxygen/group_by.cpp | 2 +- Rx/v2/examples/doxygen/main.cpp | 3 +++ Rx/v2/examples/doxygen/main.hpp | 3 +++ Rx/v2/examples/doxygen/merge.cpp | 2 +- Rx/v2/examples/doxygen/merge_delay_error.cpp | 2 +- Rx/v2/examples/doxygen/observe_on.cpp | 2 +- Rx/v2/examples/doxygen/pairwise.cpp | 2 +- Rx/v2/examples/doxygen/range.cpp | 2 +- Rx/v2/examples/doxygen/replay.cpp | 2 +- Rx/v2/examples/doxygen/skip_until.cpp | 2 +- Rx/v2/examples/doxygen/subscribe_on.cpp | 2 +- Rx/v2/examples/doxygen/take_until.cpp | 2 +- Rx/v2/examples/doxygen/with_latest_from.cpp | 2 +- Rx/v2/examples/doxygen/zip.cpp | 2 +- 20 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 Rx/v2/examples/doxygen/main.hpp diff --git a/Rx/v2/examples/doxygen/amb.cpp b/Rx/v2/examples/doxygen/amb.cpp index e7dfaa6..eab7f7e 100644 --- a/Rx/v2/examples/doxygen/amb.cpp +++ b/Rx/v2/examples/doxygen/amb.cpp @@ -30,7 +30,7 @@ SCENARIO("implicit amb sample"){ printf("//! [implicit amb sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("threaded amb sample"){ printf("//! [threaded amb sample]\n"); diff --git a/Rx/v2/examples/doxygen/buffer.cpp b/Rx/v2/examples/doxygen/buffer.cpp index 58f023a..503db12 100644 --- a/Rx/v2/examples/doxygen/buffer.cpp +++ b/Rx/v2/examples/doxygen/buffer.cpp @@ -35,7 +35,7 @@ SCENARIO("buffer count+skip sample"){ printf("//! [buffer count+skip sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("buffer period+skip+coordination sample"){ printf("//! [buffer period+skip+coordination sample]\n"); diff --git a/Rx/v2/examples/doxygen/combine_latest.cpp b/Rx/v2/examples/doxygen/combine_latest.cpp index b220da4..5f2168b 100644 --- a/Rx/v2/examples/doxygen/combine_latest.cpp +++ b/Rx/v2/examples/doxygen/combine_latest.cpp @@ -17,7 +17,7 @@ SCENARIO("combine_latest sample"){ printf("//! [combine_latest sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("Coordination combine_latest sample"){ printf("//! [Coordination combine_latest sample]\n"); diff --git a/Rx/v2/examples/doxygen/concat_map.cpp b/Rx/v2/examples/doxygen/concat_map.cpp index 957665f..a087431 100644 --- a/Rx/v2/examples/doxygen/concat_map.cpp +++ b/Rx/v2/examples/doxygen/concat_map.cpp @@ -22,7 +22,7 @@ SCENARIO("concat_map sample"){ printf("//! [concat_map sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("threaded concat_map sample"){ printf("//! [threaded concat_map sample]\n"); diff --git a/Rx/v2/examples/doxygen/flat_map.cpp b/Rx/v2/examples/doxygen/flat_map.cpp index 0c88cbe..3e0a09f 100644 --- a/Rx/v2/examples/doxygen/flat_map.cpp +++ b/Rx/v2/examples/doxygen/flat_map.cpp @@ -22,7 +22,7 @@ SCENARIO("flat_map sample"){ printf("//! [flat_map sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("threaded flat_map sample"){ printf("//! [threaded flat_map sample]\n"); diff --git a/Rx/v2/examples/doxygen/from.cpp b/Rx/v2/examples/doxygen/from.cpp index 15186ba..7cc2276 100644 --- a/Rx/v2/examples/doxygen/from.cpp +++ b/Rx/v2/examples/doxygen/from.cpp @@ -13,7 +13,7 @@ SCENARIO("from sample"){ printf("//! [from sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("threaded from sample"){ printf("//! [threaded from sample]\n"); diff --git a/Rx/v2/examples/doxygen/group_by.cpp b/Rx/v2/examples/doxygen/group_by.cpp index d30f334..b716d6f 100644 --- a/Rx/v2/examples/doxygen/group_by.cpp +++ b/Rx/v2/examples/doxygen/group_by.cpp @@ -23,7 +23,7 @@ SCENARIO("group_by sample"){ } //! [group_by full intro] -bool less(int v1, int v2){ +static bool less(int v1, int v2){ return v1 < v2; } //! [group_by full intro] diff --git a/Rx/v2/examples/doxygen/main.cpp b/Rx/v2/examples/doxygen/main.cpp index 8a831f2..4da59c5 100644 --- a/Rx/v2/examples/doxygen/main.cpp +++ b/Rx/v2/examples/doxygen/main.cpp @@ -4,6 +4,9 @@ #include #include #include + +#include "main.hpp" + std::string get_pid() { std::stringstream s; s << std::this_thread::get_id(); diff --git a/Rx/v2/examples/doxygen/main.hpp b/Rx/v2/examples/doxygen/main.hpp new file mode 100644 index 0000000..7439c6a --- /dev/null +++ b/Rx/v2/examples/doxygen/main.hpp @@ -0,0 +1,3 @@ +#pragma once + +std::string get_pid(); diff --git a/Rx/v2/examples/doxygen/merge.cpp b/Rx/v2/examples/doxygen/merge.cpp index 6ff6539..008c378 100644 --- a/Rx/v2/examples/doxygen/merge.cpp +++ b/Rx/v2/examples/doxygen/merge.cpp @@ -30,7 +30,7 @@ SCENARIO("implicit merge sample"){ printf("//! [implicit merge sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("threaded merge sample"){ printf("//! [threaded merge sample]\n"); diff --git a/Rx/v2/examples/doxygen/merge_delay_error.cpp b/Rx/v2/examples/doxygen/merge_delay_error.cpp index 8c28cd8..7a94570 100644 --- a/Rx/v2/examples/doxygen/merge_delay_error.cpp +++ b/Rx/v2/examples/doxygen/merge_delay_error.cpp @@ -33,7 +33,7 @@ SCENARIO("implicit merge_delay_error sample"){ printf("//! [implicit merge_delay_error sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("threaded merge_delay_error sample"){ printf("//! [threaded merge_delay_error sample]\n"); diff --git a/Rx/v2/examples/doxygen/observe_on.cpp b/Rx/v2/examples/doxygen/observe_on.cpp index 927c339..9046999 100644 --- a/Rx/v2/examples/doxygen/observe_on.cpp +++ b/Rx/v2/examples/doxygen/observe_on.cpp @@ -3,7 +3,7 @@ #include "rxcpp/rx-test.hpp" #include "catch.hpp" -std::string get_pid(); +#include "main.hpp" SCENARIO("observe_on sample"){ printf("//! [observe_on sample]\n"); diff --git a/Rx/v2/examples/doxygen/pairwise.cpp b/Rx/v2/examples/doxygen/pairwise.cpp index 3dd8d34..3133679 100644 --- a/Rx/v2/examples/doxygen/pairwise.cpp +++ b/Rx/v2/examples/doxygen/pairwise.cpp @@ -23,7 +23,7 @@ SCENARIO("pairwise short sample"){ printf("//! [pairwise short sample]\n"); } -//std::string get_pid(); +//#include "main.hpp" // //SCENARIO("threaded flat_map sample"){ // printf("//! [threaded flat_map sample]\n"); diff --git a/Rx/v2/examples/doxygen/range.cpp b/Rx/v2/examples/doxygen/range.cpp index 69eecbd..3abb0ec 100644 --- a/Rx/v2/examples/doxygen/range.cpp +++ b/Rx/v2/examples/doxygen/range.cpp @@ -13,7 +13,7 @@ SCENARIO("range sample"){ printf("//! [range sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("threaded range sample"){ printf("//! [threaded range sample]\n"); diff --git a/Rx/v2/examples/doxygen/replay.cpp b/Rx/v2/examples/doxygen/replay.cpp index d6f08ed..2340851 100644 --- a/Rx/v2/examples/doxygen/replay.cpp +++ b/Rx/v2/examples/doxygen/replay.cpp @@ -3,7 +3,7 @@ #include "rxcpp/rx-test.hpp" #include "catch.hpp" -std::string get_pid(); +#include "main.hpp" SCENARIO("replay sample"){ printf("//! [replay sample]\n"); diff --git a/Rx/v2/examples/doxygen/skip_until.cpp b/Rx/v2/examples/doxygen/skip_until.cpp index c539d8e..d99cb6e 100644 --- a/Rx/v2/examples/doxygen/skip_until.cpp +++ b/Rx/v2/examples/doxygen/skip_until.cpp @@ -15,7 +15,7 @@ SCENARIO("skip_until sample"){ printf("//! [skip_until sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("threaded skip_until sample"){ printf("//! [threaded skip_until sample]\n"); diff --git a/Rx/v2/examples/doxygen/subscribe_on.cpp b/Rx/v2/examples/doxygen/subscribe_on.cpp index e2614bc..7a9da50 100644 --- a/Rx/v2/examples/doxygen/subscribe_on.cpp +++ b/Rx/v2/examples/doxygen/subscribe_on.cpp @@ -3,7 +3,7 @@ #include "rxcpp/rx-test.hpp" #include "catch.hpp" -std::string get_pid(); +#include "main.hpp" SCENARIO("subscribe_on sample"){ printf("//! [subscribe_on sample]\n"); diff --git a/Rx/v2/examples/doxygen/take_until.cpp b/Rx/v2/examples/doxygen/take_until.cpp index 5c98bc4..082171b 100644 --- a/Rx/v2/examples/doxygen/take_until.cpp +++ b/Rx/v2/examples/doxygen/take_until.cpp @@ -26,7 +26,7 @@ SCENARIO("take_until time sample"){ printf("//! [take_until time sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("threaded take_until sample"){ printf("//! [threaded take_until sample]\n"); diff --git a/Rx/v2/examples/doxygen/with_latest_from.cpp b/Rx/v2/examples/doxygen/with_latest_from.cpp index 200f446..cf0a422 100644 --- a/Rx/v2/examples/doxygen/with_latest_from.cpp +++ b/Rx/v2/examples/doxygen/with_latest_from.cpp @@ -17,7 +17,7 @@ SCENARIO("with_latest_from sample"){ printf("//! [with_latest_from sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("Coordination with_latest_from sample"){ printf("//! [Coordination with_latest_from sample]\n"); diff --git a/Rx/v2/examples/doxygen/zip.cpp b/Rx/v2/examples/doxygen/zip.cpp index c5cd07b..6bd295b 100644 --- a/Rx/v2/examples/doxygen/zip.cpp +++ b/Rx/v2/examples/doxygen/zip.cpp @@ -17,7 +17,7 @@ SCENARIO("zip sample"){ printf("//! [zip sample]\n"); } -std::string get_pid(); +#include "main.hpp" SCENARIO("Coordination zip sample"){ printf("//! [Coordination zip sample]\n"); -- cgit v1.2.3