Skip to content

Commit

Permalink
Fix for GCC going more crazy than usual
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Oct 23, 2024
1 parent 7773a3b commit abcbcc3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 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,10 @@
#else
#define RR_DISABLE_DEPRECATION_WARNING
#endif

// Disable possible null reference warning
#if defined(__GNUC__) || defined(__clang__)
#define RR_DISABLE_NULL_DEREF_WARNING _Pragma("GCC diagnostic ignored \"-Wnull-dereference\"")
#else
#define RR_DISABLE_NULL_DEREF_WARNING
#endif
6 changes: 6 additions & 0 deletions rerun_cpp/src/rerun/component_column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "arrow_utils.hpp"
#include "c/rerun.h"
#include "compiler_utils.hpp"

#include <arrow/array/array_nested.h>
#include <arrow/buffer.h>
Expand All @@ -20,7 +21,12 @@ namespace rerun {
) {
// Convert lengths into offsets.
std::vector<uint32_t> offsets(lengths.size() + 1);
// Some GCC versions see ghosts here - this can't be a null dereference since we have at least 1 element.
RR_PUSH_WARNINGS
RR_DISABLE_NULL_DEREF_WARNING
offsets[0] = 0;
RR_POP_WARNINGS

for (size_t i = 0; i < lengths.size(); i++) {
offsets[i + 1] = offsets[i] + lengths[i];
}
Expand Down

0 comments on commit abcbcc3

Please sign in to comment.