Skip to content

Commit

Permalink
explicitly disable ASAN on forwarded to_arrow
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Mar 18, 2024
1 parent 3fce6f7 commit 71edf5b
Show file tree
Hide file tree
Showing 42 changed files with 125 additions and 71 deletions.
67 changes: 36 additions & 31 deletions crates/re_types_builder/src/codegen/cpp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1462,13 +1462,12 @@ fn to_arrow_method(
quote! {#namespace_ident}
};

let (inline, definition_body) = if transparent_forwarded_fqname(obj).is_some() {
(
true,
quote! {
return Loggable<TypeFwd>::to_arrow(reinterpret_cast<const TypeFwd*>(instances), num_instances);
},
)
let is_forwarding = transparent_forwarded_fqname(obj).is_some();

let definition_body = if is_forwarding {
quote! {
return Loggable<TypeFwd>::to_arrow(reinterpret_cast<const TypeFwd*>(instances), num_instances);
}
} else {
hpp_includes.insert_rerun("result.hpp");
declarations.insert("arrow", ForwardDecl::Class(format_ident!("Array")));
Expand All @@ -1479,28 +1478,34 @@ fn to_arrow_method(
let arrow_builder_type =
arrow_array_builder_type_object(obj, objects, &mut ForwardDecls::default());

(
false,
quote! {
#NEWLINE_TOKEN
#todo_pool
arrow::MemoryPool* pool = arrow::default_memory_pool();
auto datatype = arrow_datatype();
#NEWLINE_TOKEN
#NEWLINE_TOKEN
ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool))
if (instances && num_instances > 0) {
RR_RETURN_NOT_OK(Loggable<#quoted_namespace::#type_ident>::fill_arrow_array_builder(
static_cast<arrow::#arrow_builder_type*>(builder.get()),
instances,
num_instances
));
}
std::shared_ptr<arrow::Array> array;
ARROW_RETURN_NOT_OK(builder->Finish(&array));
return array;
},
)
quote! {
#NEWLINE_TOKEN
#todo_pool
arrow::MemoryPool* pool = arrow::default_memory_pool();
auto datatype = arrow_datatype();
#NEWLINE_TOKEN
#NEWLINE_TOKEN
ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool))
if (instances && num_instances > 0) {
RR_RETURN_NOT_OK(Loggable<#quoted_namespace::#type_ident>::fill_arrow_array_builder(
static_cast<arrow::#arrow_builder_type*>(builder.get()),
instances,
num_instances
));
}
std::shared_ptr<arrow::Array> array;
ARROW_RETURN_NOT_OK(builder->Finish(&array));
return array;
}
};

let return_type = if is_forwarding {
// Disable asan since we got rather strange spurious ci failure on Linux with these methods:
// Some Linux runs end up spamming `AddressSanitizer:DEADLYSIGNAL`` indefinitely with no additional information.1
hpp_includes.insert_rerun("compiler_utils.hpp"); // RR_DISABLE_ASAN
quote! { RR_DISABLE_ASAN Result<std::shared_ptr<arrow::Array>> }
} else {
quote! { Result<std::shared_ptr<arrow::Array>> }
};

Method {
Expand All @@ -1510,13 +1515,13 @@ fn to_arrow_method(
.into(),
declaration: MethodDeclaration {
is_static: true,
return_type: quote! { Result<std::shared_ptr<arrow::Array>> },
return_type,
name_and_parameters: quote! {
to_arrow(const #quoted_namespace::#type_ident* instances, size_t num_instances)
},
},
definition_body,
inline,
inline: is_forwarding,
}
}

Expand Down
3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/blueprint/components/active_tab.hpp

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

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

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

3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/blueprint/components/panel_expanded.hpp

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

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

3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/blueprint/components/root_container.hpp

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

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

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

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

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

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

9 changes: 9 additions & 0 deletions rerun_cpp/src/rerun/compiler_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@
#else
#define RR_DISABLE_DEPRECATION_WARNING
#endif

// Disable ASAN.
#if defined(__GNUC__) || defined(__clang__)
#define RR_DISABLE_ASAN __attribute__((no_sanitize("address")))
#elif defined(_MSC_VER)
#define RR_DISABLE_ASAN __declspec(no_sanitize_address)
#else
#define RR_DISABLE_ASAN
#endif
3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/components/class_id.hpp

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

3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/components/color.hpp

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

3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/components/half_sizes2d.hpp

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

3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/components/half_sizes3d.hpp

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

3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/components/keypoint_id.hpp

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

3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/components/material.hpp

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

Loading

0 comments on commit 71edf5b

Please sign in to comment.