Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cpp formatter differences #2773

Merged
merged 5 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BasedOnStyle: Google

# Make it slightly more similar to Rust.
# Based loosly on https://gist.github.com/YodaEmbedding/c2c77dc693d11f3734d78489f9a6eea4
# Based loosely on https://gist.github.com/YodaEmbedding/c2c77dc693d11f3734d78489f9a6eea4
AccessModifierOffset: -2
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
Expand All @@ -21,3 +21,9 @@ NamespaceIndentation: All
PointerAlignment: Left
SeparateDefinitionBlocks: Always
SpacesBeforeTrailingComments: 1
ReflowComments: true

# Don't change include blocks, we want to control this manually.
# Sorting headers however is allowed as all our headers should be standalone.
IncludeBlocks: Preserve
SortIncludes: CaseInsensitive
2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is a sha256 hash for all direct and indirect dependencies of this crate's build script.
# It can be safely removed at anytime to force the build script to run again.
# Check out build.rs to see how it's computed.
4e7bff9578be94c0d8e42808d39c49e58b03a4b6dd5dd571dbf87ed7640fcca4
70102e74a219445db03e9e5d914687f1756e85b35d93e187dd3346d87b99f806
7 changes: 5 additions & 2 deletions crates/re_types_builder/src/codegen/cpp/includes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ impl quote::ToTokens for Includes {
quote! { #hash include #name #NEWLINE_TOKEN }
});

// Put the local includes first. This is less common but makes it easier for us to early detect
// when a header relies on some system includes being present.
// (all our headers should be standalone, i.e. don't assume something else was included before them)
quote! {
#(#system)*
#NEWLINE_TOKEN
#(#local)*
#NEWLINE_TOKEN
#(#system)*
#NEWLINE_TOKEN
#NEWLINE_TOKEN
}
.to_tokens(tokens);
Expand Down
8 changes: 4 additions & 4 deletions rerun_cpp/src/archetypes/affix_fuzzer1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

#pragma once

#include <cstdint>
#include <optional>
#include <vector>

#include "../components/affix_fuzzer1.hpp"
#include "../components/affix_fuzzer10.hpp"
#include "../components/affix_fuzzer11.hpp"
Expand All @@ -27,6 +23,10 @@
#include "../components/affix_fuzzer8.hpp"
#include "../components/affix_fuzzer9.hpp"

#include <cstdint>
#include <optional>
#include <vector>

namespace rr {
namespace archetypes {
struct AffixFuzzer1 {
Expand Down
8 changes: 4 additions & 4 deletions rerun_cpp/src/archetypes/points2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

#pragma once

#include <cstdint>
#include <optional>
#include <vector>

#include "../components/class_id.hpp"
#include "../components/color.hpp"
#include "../components/draw_order.hpp"
Expand All @@ -16,6 +12,10 @@
#include "../components/point2d.hpp"
#include "../components/radius.hpp"

#include <cstdint>
#include <optional>
#include <vector>

namespace rr {
namespace archetypes {
/// A 2D point cloud with positions and optional colors, radii, labels, etc.
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/archetypes/transform3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

#pragma once

#include "../components/transform3d.hpp"

#include <cstdint>
#include <utility>

#include "../components/transform3d.hpp"

namespace rr {
namespace archetypes {
/// A 3D transform.
Expand Down
5 changes: 3 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer1.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>
#include "affix_fuzzer1.hpp"

#include "../datatypes/affix_fuzzer1.hpp"
#include "affix_fuzzer1.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

#pragma once

#include "../datatypes/affix_fuzzer1.hpp"

#include <cstdint>
#include <memory>
#include <utility>

#include "../datatypes/affix_fuzzer1.hpp"

namespace arrow {
class DataType;
}
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer10.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>

#include "affix_fuzzer10.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
std::shared_ptr<arrow::DataType> AffixFuzzer10::to_arrow_datatype() {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer11.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>

#include "affix_fuzzer11.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
std::shared_ptr<arrow::DataType> AffixFuzzer11::to_arrow_datatype() {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer12.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>

#include "affix_fuzzer12.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
std::shared_ptr<arrow::DataType> AffixFuzzer12::to_arrow_datatype() {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer13.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>

#include "affix_fuzzer13.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
std::shared_ptr<arrow::DataType> AffixFuzzer13::to_arrow_datatype() {
Expand Down
5 changes: 3 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer14.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>
#include "affix_fuzzer14.hpp"

#include "../datatypes/affix_fuzzer1.hpp"
#include "affix_fuzzer14.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer14.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

#pragma once

#include "../datatypes/affix_fuzzer3.hpp"

#include <cstdint>
#include <memory>
#include <utility>

#include "../datatypes/affix_fuzzer3.hpp"

namespace arrow {
class DataType;
}
Expand Down
5 changes: 3 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer15.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>
#include "affix_fuzzer15.hpp"

#include "../datatypes/affix_fuzzer1.hpp"
#include "affix_fuzzer15.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer15.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

#pragma once

#include "../datatypes/affix_fuzzer3.hpp"

#include <cstdint>
#include <memory>
#include <optional>
#include <utility>

#include "../datatypes/affix_fuzzer3.hpp"

namespace arrow {
class DataType;
}
Expand Down
5 changes: 3 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer16.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>
#include "affix_fuzzer16.hpp"

#include "../datatypes/affix_fuzzer1.hpp"
#include "affix_fuzzer16.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

#pragma once

#include "../datatypes/affix_fuzzer3.hpp"

#include <cstdint>
#include <memory>
#include <utility>
#include <vector>

#include "../datatypes/affix_fuzzer3.hpp"

namespace arrow {
class DataType;
}
Expand Down
5 changes: 3 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer17.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>
#include "affix_fuzzer17.hpp"

#include "../datatypes/affix_fuzzer1.hpp"
#include "affix_fuzzer17.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer17.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

#pragma once

#include "../datatypes/affix_fuzzer3.hpp"

#include <cstdint>
#include <memory>
#include <optional>
#include <utility>
#include <vector>

#include "../datatypes/affix_fuzzer3.hpp"

namespace arrow {
class DataType;
}
Expand Down
5 changes: 3 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer18.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>
#include "affix_fuzzer18.hpp"

#include "../datatypes/affix_fuzzer1.hpp"
#include "affix_fuzzer18.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer18.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

#pragma once

#include "../datatypes/affix_fuzzer4.hpp"

#include <cstdint>
#include <memory>
#include <optional>
#include <utility>
#include <vector>

#include "../datatypes/affix_fuzzer4.hpp"

namespace arrow {
class DataType;
}
Expand Down
5 changes: 3 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer19.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>
#include "affix_fuzzer19.hpp"

#include "../datatypes/affix_fuzzer5.hpp"
#include "affix_fuzzer19.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer19.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

#pragma once

#include "../datatypes/affix_fuzzer5.hpp"

#include <cstdint>
#include <memory>
#include <utility>

#include "../datatypes/affix_fuzzer5.hpp"

namespace arrow {
class DataType;
}
Expand Down
5 changes: 3 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer2.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT.
// Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs"

#include <arrow/api.h>
#include "affix_fuzzer2.hpp"

#include "../datatypes/affix_fuzzer1.hpp"
#include "affix_fuzzer2.hpp"

#include <arrow/api.h>

namespace rr {
namespace components {
Expand Down
4 changes: 2 additions & 2 deletions rerun_cpp/src/components/affix_fuzzer2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

#pragma once

#include "../datatypes/affix_fuzzer1.hpp"

#include <cstdint>
#include <memory>
#include <utility>

#include "../datatypes/affix_fuzzer1.hpp"

namespace arrow {
class DataType;
}
Expand Down
Loading