Skip to content

Commit

Permalink
fix c++ deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Dec 16, 2024
1 parent cc322dd commit 5f8ce34
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/build/re_types_builder/src/codegen/cpp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2591,7 +2591,22 @@ fn quote_loggable_hpp_and_cpp(

hpp_includes.insert_rerun("component_descriptor.hpp");

let (deprecation_ignore_start, deprecation_ignore_end) = if obj.deprecation_notice().is_some() {
hpp_includes.insert_rerun("compiler_utils.hpp");
(
quote! {
RR_PUSH_WARNINGS #NEWLINE_TOKEN
RR_DISABLE_DEPRECATION_WARNING #NEWLINE_TOKEN
},
quote! { RR_POP_WARNINGS },
)
} else {
(quote!(), quote!())
};

let hpp = quote! {
#deprecation_ignore_start

namespace rerun {
#predeclarations_and_static_assertions

Expand All @@ -2604,6 +2619,8 @@ fn quote_loggable_hpp_and_cpp(
#(#methods_hpp)*
};
}

#deprecation_ignore_end
};

let cpp = if methods.iter().any(|m| !m.inline) {
Expand Down
3 changes: 3 additions & 0 deletions docs/snippets/all/archetypes/disconnected_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <rerun.hpp>

// DisconnectedSpace is deprecated and will be removed in the future.
RR_DISABLE_DEPRECATION_WARNING

int main() {
const auto rec = rerun::RecordingStream("rerun_example_disconnected_space");
rec.spawn().exit_on_failure();
Expand Down
3 changes: 3 additions & 0 deletions rerun_cpp/src/rerun/archetypes/disconnected_space.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions rerun_cpp/src/rerun/components/disconnected_space.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions rerun_cpp/tests/archetypes/disconnected_space.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "archetype_test.hpp"

RR_DISABLE_DEPRECATION_WARNING

#include <rerun/archetypes/disconnected_space.hpp>

using namespace rerun::archetypes;
Expand Down
5 changes: 5 additions & 0 deletions tests/cpp/roundtrips/disconnected_space/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#include <rerun/compiler_utils.hpp>

// DisconnectedSpace is deprecated and will be removed in the future.
RR_DISABLE_DEPRECATION_WARNING

#include <rerun/archetypes/disconnected_space.hpp>
#include <rerun/recording_stream.hpp>

Expand Down

0 comments on commit 5f8ce34

Please sign in to comment.