From acbd952abf20a5d2ecfa96af2ce031abfe9a2261 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Fri, 11 Aug 2023 12:27:56 +0300 Subject: [PATCH] Cleanup: fewer iostreams related includes from BLI/BKE headers Including or similar headers is quite expensive, since it also pulls in things like and so on. In many BLI headers, iostreams are only used to implement some sort of "debug print", or an operator<< for ostream. Change some of the commonly used places to instead include , which is the standard way of forward-declaring iostreams related classes, and move the actual debug-print / operator<< implementations into .cc files. This is not done for templated classes though (it would be possible to provide explicit operator<< instantiations somewhere in the source file, but that would lead to hard-to-figure-out linker error whenever someone would add a different template type). There, where possible, I changed from full include to only the needed part. For Span, I just removed print_as_lines since it's not used by anything. It could be moved into a .cc file using a similar approach as above if needed. Doing full blender build changes include counts this way: - 1986 -> 978 - 2880 -> 925 It does not affect the total build time much though, mostly because towards the end of it there's just several CPU cores finishing compiling OpenVDB related source files. Pull Request: https://projects.blender.org/blender/blender/pulls/111046 --- .../asset_system/intern/asset_catalog.cc | 1 + .../asset_system/intern/asset_catalog_path.cc | 2 + .../blendthumb/src/blender_thumbnailer.cc | 1 + source/blender/blenkernel/BKE_geometry_set.hh | 2 +- .../blenkernel/intern/bake_items_serialize.cc | 2 + .../blender/blenkernel/intern/lib_override.cc | 1 + .../intern/node_tree_anonymous_attributes.cc | 2 + .../blender/blenkernel/intern/paint_canvas.cc | 2 + .../blenkernel/intern/pbvh_uv_islands.cc | 2 + .../intern/simulation_state_serialize.cc | 2 + source/blender/blenlib/BLI_bit_ref.hh | 13 ++---- source/blender/blenlib/BLI_color.hh | 2 +- source/blender/blenlib/BLI_cpp_type.hh | 17 +------ source/blender/blenlib/BLI_cpp_type_make.hh | 1 + source/blender/blenlib/BLI_dot_export.hh | 2 +- source/blender/blenlib/BLI_hash_tables.hh | 21 +-------- source/blender/blenlib/BLI_index_range.hh | 9 +--- .../blenlib/BLI_inplace_priority_queue.hh | 2 + .../blender/blenlib/BLI_math_angle_types.hh | 2 +- .../blenlib/BLI_math_axis_angle_types.hh | 2 +- .../blender/blenlib/BLI_math_basis_types.hh | 38 ++-------------- .../blender/blenlib/BLI_math_euler_types.hh | 2 +- .../blender/blenlib/BLI_math_matrix_types.hh | 2 +- .../blenlib/BLI_math_quaternion_types.hh | 2 +- .../blender/blenlib/BLI_math_vector_types.hh | 2 +- source/blender/blenlib/BLI_mesh_intersect.hh | 2 +- source/blender/blenlib/BLI_serialize.hh | 2 +- source/blender/blenlib/BLI_span.hh | 24 ---------- source/blender/blenlib/BLI_string_ref.hh | 14 +----- source/blender/blenlib/BLI_uuid.h | 3 +- source/blender/blenlib/BLI_vector.hh | 22 ++++----- source/blender/blenlib/BLI_virtual_array.hh | 6 ++- source/blender/blenlib/CMakeLists.txt | 8 ++++ source/blender/blenlib/intern/BLI_color.cc | 21 +++++++++ source/blender/blenlib/intern/bit_ref.cc | 21 +++++++++ source/blender/blenlib/intern/bit_span.cc | 2 + .../blender/blenlib/intern/compute_context.cc | 1 + source/blender/blenlib/intern/cpp_type.cc | 30 +++++++++++++ source/blender/blenlib/intern/dot_export.cc | 2 + source/blender/blenlib/intern/hash_tables.cc | 29 ++++++++++++ source/blender/blenlib/intern/index_range.cc | 17 +++++++ .../blenlib/intern/math_basis_types.cc | 45 +++++++++++++++++++ source/blender/blenlib/intern/string_ref.cc | 23 ++++++++++ source/blender/blenlib/intern/vector.cc | 26 +++++++++++ .../blender/blenlib/intern/virtual_array.cc | 12 +++++ .../intern/shader_operation.cc | 2 + .../debug/deg_debug_relations_graphviz.cc | 2 + .../draw/engines/eevee/eevee_shaders_extra.cc | 2 + .../draw/engines/eevee_next/eevee_film.hh | 2 + .../eevee_next/eevee_reflection_probes.cc | 2 + .../draw/engines/gpencil/gpencil_shader.cc | 2 + source/blender/draw/intern/draw_debug.cc | 1 + source/blender/draw/intern/draw_pass.hh | 2 + .../blender/draw/intern/draw_texture_pool.cc | 1 + .../editors/asset/intern/asset_indexer.cc | 2 + .../editors/asset/intern/asset_shelf.cc | 2 + .../editors/interface/interface_drop.cc | 2 + .../interface/views/abstract_view_item.cc | 2 + .../blender/editors/space_node/node_draw.cc | 1 + .../space_outliner/tree/tree_element.cc | 1 + .../tree/tree_element_overrides.cc | 2 + .../space_sequencer/sequencer_buttons.cc | 1 + .../space_spreadsheet/space_spreadsheet.cc | 2 + .../spreadsheet_row_filter_ui.cc | 2 + .../functions/intern/lazy_function_graph.cc | 2 + .../intern/lazy_function_graph_executor.cc | 1 + .../intern/multi_function_procedure.cc | 2 + source/blender/gpu/intern/gpu_framebuffer.cc | 1 + source/blender/gpu/intern/gpu_shader.cc | 1 + source/blender/gpu/opengl/gl_shader.cc | 2 + .../gpencil/intern/gpencil_io_export_pdf.cc | 2 + .../gpencil/intern/gpencil_io_import_svg.cc | 3 ++ .../io/ply/exporter/ply_file_buffer.cc | 2 + .../io/ply/importer/ply_import_buffer.cc | 1 + .../io/ply/tests/io_ply_exporter_test.cc | 2 + .../exporter/obj_export_file_writer.cc | 1 + .../exporter/obj_export_file_writer.hh | 2 + .../importer/obj_import_file_reader.cc | 1 + .../wavefront_obj/importer/obj_import_mtl.cc | 2 + source/blender/modifiers/intern/MOD_nodes.cc | 1 + .../function/nodes/node_fn_value_to_string.cc | 1 + .../intern/geometry_nodes_lazy_function.cc | 1 + 82 files changed, 359 insertions(+), 146 deletions(-) create mode 100644 source/blender/blenlib/intern/bit_ref.cc create mode 100644 source/blender/blenlib/intern/cpp_type.cc create mode 100644 source/blender/blenlib/intern/hash_tables.cc create mode 100644 source/blender/blenlib/intern/index_range.cc create mode 100644 source/blender/blenlib/intern/math_basis_types.cc create mode 100644 source/blender/blenlib/intern/string_ref.cc create mode 100644 source/blender/blenlib/intern/vector.cc create mode 100644 source/blender/blenlib/intern/virtual_array.cc diff --git a/source/blender/asset_system/intern/asset_catalog.cc b/source/blender/asset_system/intern/asset_catalog.cc index fd742163e9f..bdc12263fe3 100644 --- a/source/blender/asset_system/intern/asset_catalog.cc +++ b/source/blender/asset_system/intern/asset_catalog.cc @@ -7,6 +7,7 @@ */ #include +#include #include #include "AS_asset_catalog.hh" diff --git a/source/blender/asset_system/intern/asset_catalog_path.cc b/source/blender/asset_system/intern/asset_catalog_path.cc index b4f6cacedb7..a8d7924db9e 100644 --- a/source/blender/asset_system/intern/asset_catalog_path.cc +++ b/source/blender/asset_system/intern/asset_catalog_path.cc @@ -10,6 +10,8 @@ #include "BLI_path_util.h" +#include + namespace blender::asset_system { const char AssetCatalogPath::SEPARATOR = '/'; diff --git a/source/blender/blendthumb/src/blender_thumbnailer.cc b/source/blender/blendthumb/src/blender_thumbnailer.cc index d69ee50bfbc..836c923ed82 100644 --- a/source/blender/blendthumb/src/blender_thumbnailer.cc +++ b/source/blender/blendthumb/src/blender_thumbnailer.cc @@ -21,6 +21,7 @@ */ #include +#include #include #include diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index e3a707ebeac..fc3b243d8de 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -8,7 +8,7 @@ * \ingroup bke */ -#include +#include #include #include "BLI_bounds_types.hh" diff --git a/source/blender/blenkernel/intern/bake_items_serialize.cc b/source/blender/blenkernel/intern/bake_items_serialize.cc index 95806fe65de..d7487e4e2eb 100644 --- a/source/blender/blenkernel/intern/bake_items_serialize.cc +++ b/source/blender/blenkernel/intern/bake_items_serialize.cc @@ -20,6 +20,8 @@ #include "RNA_access.hh" #include "RNA_enum_types.hh" +#include + namespace blender::bke { using namespace io::serialize; diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc index 926b18b73b5..99f86772511 100644 --- a/source/blender/blenkernel/intern/lib_override.cc +++ b/source/blender/blenkernel/intern/lib_override.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include diff --git a/source/blender/blenkernel/intern/node_tree_anonymous_attributes.cc b/source/blender/blenkernel/intern/node_tree_anonymous_attributes.cc index 124ba93c209..5e06978119b 100644 --- a/source/blender/blenkernel/intern/node_tree_anonymous_attributes.cc +++ b/source/blender/blenkernel/intern/node_tree_anonymous_attributes.cc @@ -13,6 +13,8 @@ #include "BLI_resource_scope.hh" +#include + namespace blender::bke::anonymous_attribute_inferencing { namespace aal = nodes::aal; using nodes::NodeDeclaration; diff --git a/source/blender/blenkernel/intern/paint_canvas.cc b/source/blender/blenkernel/intern/paint_canvas.cc index b2cbd3d7d98..174a15f3e40 100644 --- a/source/blender/blenkernel/intern/paint_canvas.cc +++ b/source/blender/blenkernel/intern/paint_canvas.cc @@ -14,6 +14,8 @@ #include "IMB_imbuf_types.h" +#include + namespace blender::bke::paint::canvas { static TexPaintSlot *get_active_slot(Object *ob) { diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc index 003eb2326c2..a9700742647 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@ -8,7 +8,9 @@ #include "pbvh_uv_islands.hh" +#include #include +#include namespace blender::bke::pbvh::uv_islands { diff --git a/source/blender/blenkernel/intern/simulation_state_serialize.cc b/source/blender/blenkernel/intern/simulation_state_serialize.cc index f89d37d535d..12b7143165f 100644 --- a/source/blender/blenkernel/intern/simulation_state_serialize.cc +++ b/source/blender/blenkernel/intern/simulation_state_serialize.cc @@ -25,6 +25,8 @@ #include "RNA_access.hh" #include "RNA_enum_types.hh" +#include + namespace blender::bke::sim { /** diff --git a/source/blender/blenlib/BLI_bit_ref.hh b/source/blender/blenlib/BLI_bit_ref.hh index 9b8ae3865c3..1312b095af9 100644 --- a/source/blender/blenlib/BLI_bit_ref.hh +++ b/source/blender/blenlib/BLI_bit_ref.hh @@ -20,7 +20,7 @@ #include "BLI_index_range.hh" #include "BLI_utildefines.h" -#include +#include namespace blender::bits { @@ -234,15 +234,8 @@ class MutableBitRef { } }; -inline std::ostream &operator<<(std::ostream &stream, const BitRef &bit) -{ - return stream << (bit ? "1" : "0"); -} - -inline std::ostream &operator<<(std::ostream &stream, const MutableBitRef &bit) -{ - return stream << BitRef(bit); -} +std::ostream &operator<<(std::ostream &stream, const BitRef &bit); +std::ostream &operator<<(std::ostream &stream, const MutableBitRef &bit); } // namespace blender::bits diff --git a/source/blender/blenlib/BLI_color.hh b/source/blender/blenlib/BLI_color.hh index 0512f6a77bb..26fe10e1c09 100644 --- a/source/blender/blenlib/BLI_color.hh +++ b/source/blender/blenlib/BLI_color.hh @@ -4,7 +4,7 @@ #pragma once -#include +#include #include "BLI_math_color.h" diff --git a/source/blender/blenlib/BLI_cpp_type.hh b/source/blender/blenlib/BLI_cpp_type.hh index 5de417dcb30..c508acd5dd2 100644 --- a/source/blender/blenlib/BLI_cpp_type.hh +++ b/source/blender/blenlib/BLI_cpp_type.hh @@ -637,22 +637,9 @@ class CPPType : NonCopyable, NonMovable { print_(value, ss); } - std::string to_string(const void *value) const - { - std::stringstream ss; - this->print(value, ss); - return ss.str(); - } + std::string to_string(const void *value) const; - void print_or_default(const void *value, std::stringstream &ss, StringRef default_value) const - { - if (this->is_printable()) { - this->print(value, ss); - } - else { - ss << default_value; - } - } + void print_or_default(const void *value, std::stringstream &ss, StringRef default_value) const; bool is_equal(const void *a, const void *b) const { diff --git a/source/blender/blenlib/BLI_cpp_type_make.hh b/source/blender/blenlib/BLI_cpp_type_make.hh index 4008dead434..944780bd52d 100644 --- a/source/blender/blenlib/BLI_cpp_type_make.hh +++ b/source/blender/blenlib/BLI_cpp_type_make.hh @@ -10,6 +10,7 @@ #include "BLI_cpp_type.hh" #include "BLI_utildefines.h" +#include namespace blender::cpp_type_util { diff --git a/source/blender/blenlib/BLI_dot_export.hh b/source/blender/blenlib/BLI_dot_export.hh index fe2333d5c21..8d3d547b0bf 100644 --- a/source/blender/blenlib/BLI_dot_export.hh +++ b/source/blender/blenlib/BLI_dot_export.hh @@ -18,8 +18,8 @@ #include "BLI_dot_export_attribute_enums.hh" +#include #include -#include namespace blender::dot { diff --git a/source/blender/blenlib/BLI_hash_tables.hh b/source/blender/blenlib/BLI_hash_tables.hh index 7b68d9d140c..b268f7f1315 100644 --- a/source/blender/blenlib/BLI_hash_tables.hh +++ b/source/blender/blenlib/BLI_hash_tables.hh @@ -303,26 +303,7 @@ class HashTableStats { removed_load_factor_ = (float)removed_amount_ / (float)capacity_; } - void print(StringRef name = "") - { - std::cout << "Hash Table Stats: " << name << "\n"; - std::cout << " Address: " << address_ << "\n"; - std::cout << " Total Slots: " << capacity_ << "\n"; - std::cout << " Occupied Slots: " << size_ << " (" << load_factor_ * 100.0f << " %)\n"; - std::cout << " Removed Slots: " << removed_amount_ << " (" << removed_load_factor_ * 100.0f - << " %)\n"; - - char memory_size_str[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE]; - BLI_str_format_byte_unit(memory_size_str, size_in_bytes_, true); - std::cout << " Size: ~" << memory_size_str << "\n"; - std::cout << " Size per Slot: " << size_per_element_ << " bytes\n"; - - std::cout << " Average Collisions: " << average_collisions_ << "\n"; - for (int64_t collision_count : keys_by_collision_count_.index_range()) { - std::cout << " " << collision_count - << " Collisions: " << keys_by_collision_count_[collision_count] << "\n"; - } - } + void print(StringRef name = "") const; }; /** \} */ diff --git a/source/blender/blenlib/BLI_index_range.hh b/source/blender/blenlib/BLI_index_range.hh index b1e14c75b63..755848a6d0e 100644 --- a/source/blender/blenlib/BLI_index_range.hh +++ b/source/blender/blenlib/BLI_index_range.hh @@ -38,9 +38,8 @@ */ #include -#include #include -#include +#include #include "BLI_utildefines.h" @@ -324,11 +323,7 @@ class IndexRange { return IndexRange(start_ + n, size_); } - friend std::ostream &operator<<(std::ostream &stream, IndexRange range) - { - stream << "[" << range.start() << ", " << range.one_after_last() << ")"; - return stream; - } + friend std::ostream &operator<<(std::ostream &stream, IndexRange range); }; struct AlignedIndexRanges { diff --git a/source/blender/blenlib/BLI_inplace_priority_queue.hh b/source/blender/blenlib/BLI_inplace_priority_queue.hh index a1abc5af310..a0c778148e1 100644 --- a/source/blender/blenlib/BLI_inplace_priority_queue.hh +++ b/source/blender/blenlib/BLI_inplace_priority_queue.hh @@ -7,6 +7,8 @@ #include "BLI_array.hh" #include "BLI_dot_export.hh" +#include + namespace blender { /** diff --git a/source/blender/blenlib/BLI_math_angle_types.hh b/source/blender/blenlib/BLI_math_angle_types.hh index 32de5921782..ffb9ca45362 100644 --- a/source/blender/blenlib/BLI_math_angle_types.hh +++ b/source/blender/blenlib/BLI_math_angle_types.hh @@ -17,7 +17,7 @@ * This design allows some function overloads to be more efficient with certain types. */ -#include +#include #include "BLI_math_base.hh" diff --git a/source/blender/blenlib/BLI_math_axis_angle_types.hh b/source/blender/blenlib/BLI_math_axis_angle_types.hh index 73ba49e3ee9..45e4c70caa9 100644 --- a/source/blender/blenlib/BLI_math_axis_angle_types.hh +++ b/source/blender/blenlib/BLI_math_axis_angle_types.hh @@ -20,7 +20,7 @@ * the fastest and more correct option. */ -#include +#include #include "BLI_math_angle_types.hh" #include "BLI_math_base.hh" diff --git a/source/blender/blenlib/BLI_math_basis_types.hh b/source/blender/blenlib/BLI_math_basis_types.hh index e25be2acfc0..49ed8d4a86c 100644 --- a/source/blender/blenlib/BLI_math_basis_types.hh +++ b/source/blender/blenlib/BLI_math_basis_types.hh @@ -23,7 +23,7 @@ * - Curve Tangent-Space: X-left, Y-up, Z-forward */ -#include +#include #include "BLI_math_base.hh" #include "BLI_math_vector_types.hh" @@ -88,20 +88,7 @@ class Axis { /** Avoid hell. */ explicit operator bool() const = delete; - friend std::ostream &operator<<(std::ostream &stream, const Axis axis) - { - switch (axis.axis_) { - default: - BLI_assert_unreachable(); - return stream << "Invalid Axis"; - case Value::X: - return stream << 'X'; - case Value::Y: - return stream << 'Y'; - case Value::Z: - return stream << 'Z'; - } - } + friend std::ostream &operator<<(std::ostream &stream, const Axis axis); }; /** @@ -190,21 +177,7 @@ class AxisSigned { /** Avoid hell. */ explicit operator bool() const = delete; - friend std::ostream &operator<<(std::ostream &stream, const AxisSigned axis) - { - switch (axis.axis_) { - default: - BLI_assert_unreachable(); - return stream << "Invalid AxisSigned"; - case Value::X_POS: - case Value::Y_POS: - case Value::Z_POS: - case Value::X_NEG: - case Value::Y_NEG: - case Value::Z_NEG: - return stream << axis.axis() << (axis.sign() == -1 ? '-' : '+'); - } - } + friend std::ostream &operator<<(std::ostream &stream, const AxisSigned axis); }; constexpr static bool operator<=(const Axis::Value a, const Axis::Value b) @@ -417,10 +390,7 @@ struct CartesianBasis { return axes.z; } - friend std::ostream &operator<<(std::ostream &stream, const CartesianBasis &rot) - { - return stream << "CartesianBasis" << rot.axes; - } + friend std::ostream &operator<<(std::ostream &stream, const CartesianBasis &rot); }; /** diff --git a/source/blender/blenlib/BLI_math_euler_types.hh b/source/blender/blenlib/BLI_math_euler_types.hh index 53648823cb1..dfc033dfa9d 100644 --- a/source/blender/blenlib/BLI_math_euler_types.hh +++ b/source/blender/blenlib/BLI_math_euler_types.hh @@ -26,7 +26,7 @@ * eg: `Euler3 my_euler(EulerOrder::XYZ); my_euler = my_quaternion:` */ -#include +#include #include "BLI_math_angle_types.hh" #include "BLI_math_base.hh" diff --git a/source/blender/blenlib/BLI_math_matrix_types.hh b/source/blender/blenlib/BLI_math_matrix_types.hh index 48be7067c70..978d30466f6 100644 --- a/source/blender/blenlib/BLI_math_matrix_types.hh +++ b/source/blender/blenlib/BLI_math_matrix_types.hh @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include "BLI_math_vector_types.hh" diff --git a/source/blender/blenlib/BLI_math_quaternion_types.hh b/source/blender/blenlib/BLI_math_quaternion_types.hh index c35ab0e9e51..c5f2c8815cc 100644 --- a/source/blender/blenlib/BLI_math_quaternion_types.hh +++ b/source/blender/blenlib/BLI_math_quaternion_types.hh @@ -8,7 +8,7 @@ * \ingroup bli */ -#include +#include #include "BLI_math_angle_types.hh" #include "BLI_math_base.hh" diff --git a/source/blender/blenlib/BLI_math_vector_types.hh b/source/blender/blenlib/BLI_math_vector_types.hh index 091124ea581..97e6429043e 100644 --- a/source/blender/blenlib/BLI_math_vector_types.hh +++ b/source/blender/blenlib/BLI_math_vector_types.hh @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include "BLI_utildefines.h" diff --git a/source/blender/blenlib/BLI_mesh_intersect.hh b/source/blender/blenlib/BLI_mesh_intersect.hh index 1ba3cc9ea95..6059f6d1489 100644 --- a/source/blender/blenlib/BLI_mesh_intersect.hh +++ b/source/blender/blenlib/BLI_mesh_intersect.hh @@ -13,7 +13,7 @@ #ifdef WITH_GMP -# include +# include # include "BLI_array.hh" # include "BLI_index_range.hh" diff --git a/source/blender/blenlib/BLI_serialize.hh b/source/blender/blenlib/BLI_serialize.hh index f17e6cf40ea..1ade17877d9 100644 --- a/source/blender/blenlib/BLI_serialize.hh +++ b/source/blender/blenlib/BLI_serialize.hh @@ -59,7 +59,7 @@ * `serialize`/`deserialize` methods should be implemented. */ -#include +#include #include "BLI_map.hh" #include "BLI_string_ref.hh" diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh index d2db9d0c1c5..498e32feef3 100644 --- a/source/blender/blenlib/BLI_span.hh +++ b/source/blender/blenlib/BLI_span.hh @@ -58,7 +58,6 @@ #include #include -#include #include #include @@ -449,29 +448,6 @@ template class Span { { return !(a == b); } - - /** - * A debug utility to print the content of the Span. Every element will be printed on a - * separate line using the given callback. - */ - template void print_as_lines(std::string name, PrintLineF print_line) const - { - std::cout << "Span: " << name << " \tSize:" << size_ << '\n'; - for (const T &value : *this) { - std::cout << " "; - print_line(value); - std::cout << '\n'; - } - } - - /** - * A debug utility to print the content of the span. Every element be printed on a separate - * line. - */ - void print_as_lines(std::string name) const - { - this->print_as_lines(name, [](const T &value) { std::cout << value; }); - } }; /** diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh index 4475580b1d9..2254796e902 100644 --- a/source/blender/blenlib/BLI_string_ref.hh +++ b/source/blender/blenlib/BLI_string_ref.hh @@ -32,7 +32,6 @@ */ #include -#include #include #include @@ -571,17 +570,8 @@ constexpr StringRef::StringRef(std::string_view view) /** \name Operator Overloads * \{ */ -inline std::ostream &operator<<(std::ostream &stream, StringRef ref) -{ - stream << std::string(ref); - return stream; -} - -inline std::ostream &operator<<(std::ostream &stream, StringRefNull ref) -{ - stream << std::string(ref.data(), size_t(ref.size())); - return stream; -} +std::ostream &operator<<(std::ostream &stream, StringRef ref); +std::ostream &operator<<(std::ostream &stream, StringRefNull ref); /** * Adding two #StringRefs will allocate an std::string. diff --git a/source/blender/blenlib/BLI_uuid.h b/source/blender/blenlib/BLI_uuid.h index bcd48beec9f..64a392bb281 100644 --- a/source/blender/blenlib/BLI_uuid.h +++ b/source/blender/blenlib/BLI_uuid.h @@ -57,7 +57,8 @@ bool BLI_uuid_parse_string(bUUID *uuid, const char *buffer) ATTR_NONNULL(); } # include -# include +# include +# include /** Output the UUID as formatted ASCII string, see #BLI_uuid_format(). */ std::ostream &operator<<(std::ostream &stream, bUUID uuid); diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh index 8b915a60fbc..c1553afe712 100644 --- a/source/blender/blenlib/BLI_vector.hh +++ b/source/blender/blenlib/BLI_vector.hh @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "BLI_allocator.hh" @@ -36,7 +35,6 @@ #include "BLI_math_base.h" #include "BLI_memory_utils.hh" #include "BLI_span.hh" -#include "BLI_string.h" #include "BLI_string_ref.hh" #include "BLI_utildefines.h" @@ -44,6 +42,15 @@ namespace blender { +namespace internal { +void vector_print_stats(StringRef name, + void *address, + int64_t size, + int64_t capacity, + int64_t inlineCapacity, + int64_t memorySize); +} + template< /** * Type of the values stored in this vector. It has to be movable. @@ -978,15 +985,8 @@ class Vector { */ void print_stats(StringRef name = "") const { - std::cout << "Vector Stats: " << name << "\n"; - std::cout << " Address: " << this << "\n"; - std::cout << " Elements: " << this->size() << "\n"; - std::cout << " Capacity: " << (capacity_end_ - begin_) << "\n"; - std::cout << " Inline Capacity: " << InlineBufferCapacity << "\n"; - - char memory_size_str[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE]; - BLI_str_format_byte_unit(memory_size_str, sizeof(*this), true); - std::cout << " Size on Stack: " << memory_size_str << "\n"; + internal::vector_print_stats( + name, this, this->size(), capacity_end_ - begin_, InlineBufferCapacity, sizeof(*this)); } private: diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh index 410b5f6a017..c3f6debec39 100644 --- a/source/blender/blenlib/BLI_virtual_array.hh +++ b/source/blender/blenlib/BLI_virtual_array.hh @@ -1071,6 +1071,10 @@ template class VArraySpan final : public Span { } }; +namespace internal { +void print_mutable_varray_span_warning(); +} + /** * Same as #VArraySpan, but for a mutable span. * The important thing to note is that when changing this span, the results might not be @@ -1141,7 +1145,7 @@ template class MutableVArraySpan final : public MutableSpan { if (varray_) { if (show_not_saved_warning_) { if (!save_has_been_called_) { - std::cout << "Warning: Call `save()` to make sure that changes persist in all cases.\n"; + internal::print_mutable_varray_span_warning(); } } } diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index b30da914f26..404e778ac1c 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -48,6 +48,7 @@ set(SRC intern/array_utils.cc intern/astar.c intern/atomic_disjoint_set.cc + intern/bit_ref.cc intern/bit_span.cc intern/bitmap.c intern/bitmap_draw_2d.c @@ -56,6 +57,7 @@ set(SRC intern/cache_mutex.cc intern/compute_context.cc intern/convexhull_2d.c + intern/cpp_type.cc intern/cpp_types.cc intern/delaunay_2d.cc intern/dot_export.cc @@ -78,8 +80,10 @@ set(SRC intern/hash_md5.c intern/hash_mm2a.c intern/hash_mm3.c + intern/hash_tables.cc intern/implicit_sharing.cc intern/index_mask.cc + intern/index_range.cc intern/jitter_2d.c intern/kdtree_1d.c intern/kdtree_2d.c @@ -92,6 +96,7 @@ set(SRC intern/math_base.c intern/math_base_inline.c intern/math_base_safe_inline.c + intern/math_basis_types.cc intern/math_bits_inline.c intern/math_boolean.cc intern/math_color.c @@ -135,6 +140,7 @@ set(SRC intern/storage.c intern/string.c intern/string_cursor_utf8.c + intern/string_ref.cc intern/string_search.cc intern/string_utf8.c intern/string_utils.c @@ -151,6 +157,8 @@ set(SRC intern/timeit.cc intern/uuid.cc intern/uvproject.c + intern/vector.cc + intern/virtual_array.cc intern/voronoi_2d.c intern/voxel.c intern/winstuff.c diff --git a/source/blender/blenlib/intern/BLI_color.cc b/source/blender/blenlib/intern/BLI_color.cc index b136249f4ea..46184b709b5 100644 --- a/source/blender/blenlib/intern/BLI_color.cc +++ b/source/blender/blenlib/intern/BLI_color.cc @@ -4,6 +4,8 @@ #include "BLI_color.hh" +#include + namespace blender { std::ostream &operator<<(std::ostream &stream, const eAlpha &space) @@ -40,4 +42,23 @@ std::ostream &operator<<(std::ostream &stream, const eSpace &space) return stream; } +template +std::ostream &operator<<(std::ostream &stream, + const ColorRGBA &c) +{ + stream << Space << Alpha << "(" << c.r << ", " << c.g << ", " << c.b << ", " << c.a << ")"; + return stream; +} + +template std::ostream &operator<<( + std::ostream &stream, const ColorRGBA &c); +template std::ostream &operator<<( + std::ostream &stream, const ColorRGBA &c); +template std::ostream &operator<<( + std::ostream &stream, + const ColorRGBA &c); +template std::ostream &operator<<( + std::ostream &stream, + const ColorRGBA &c); + } // namespace blender diff --git a/source/blender/blenlib/intern/bit_ref.cc b/source/blender/blenlib/intern/bit_ref.cc new file mode 100644 index 00000000000..b6bc02dfd7d --- /dev/null +++ b/source/blender/blenlib/intern/bit_ref.cc @@ -0,0 +1,21 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "BLI_bit_ref.hh" + +#include + +namespace blender::bits { + +std::ostream &operator<<(std::ostream &stream, const BitRef &bit) +{ + return stream << (bit ? '1' : '0'); +} + +std::ostream &operator<<(std::ostream &stream, const MutableBitRef &bit) +{ + return stream << BitRef(bit); +} + +} // namespace blender::bits diff --git a/source/blender/blenlib/intern/bit_span.cc b/source/blender/blenlib/intern/bit_span.cc index da8e6d02fc1..ae3d216bc2c 100644 --- a/source/blender/blenlib/intern/bit_span.cc +++ b/source/blender/blenlib/intern/bit_span.cc @@ -5,6 +5,8 @@ #include "BLI_bit_span.hh" #include "BLI_bit_span_ops.hh" +#include + namespace blender::bits { void MutableBitSpan::set_all() diff --git a/source/blender/blenlib/intern/compute_context.cc b/source/blender/blenlib/intern/compute_context.cc index 30829487d46..e9cfac36ba3 100644 --- a/source/blender/blenlib/intern/compute_context.cc +++ b/source/blender/blenlib/intern/compute_context.cc @@ -4,6 +4,7 @@ #include "BLI_compute_context.hh" #include "BLI_hash_md5.h" +#include namespace blender { diff --git a/source/blender/blenlib/intern/cpp_type.cc b/source/blender/blenlib/intern/cpp_type.cc new file mode 100644 index 00000000000..a4556fb057e --- /dev/null +++ b/source/blender/blenlib/intern/cpp_type.cc @@ -0,0 +1,30 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "BLI_cpp_type.hh" + +#include + +namespace blender { + +std::string CPPType::to_string(const void *value) const +{ + std::stringstream ss; + this->print(value, ss); + return ss.str(); +} + +void CPPType::print_or_default(const void *value, + std::stringstream &ss, + StringRef default_value) const +{ + if (this->is_printable()) { + this->print(value, ss); + } + else { + ss << default_value; + } +} + +} // namespace blender diff --git a/source/blender/blenlib/intern/dot_export.cc b/source/blender/blenlib/intern/dot_export.cc index 1ee68c073e9..744ecd6d913 100644 --- a/source/blender/blenlib/intern/dot_export.cc +++ b/source/blender/blenlib/intern/dot_export.cc @@ -6,6 +6,8 @@ #include "BLI_dot_export.hh" +#include + namespace blender::dot { /* Graph Building diff --git a/source/blender/blenlib/intern/hash_tables.cc b/source/blender/blenlib/intern/hash_tables.cc new file mode 100644 index 00000000000..44c8ef48370 --- /dev/null +++ b/source/blender/blenlib/intern/hash_tables.cc @@ -0,0 +1,29 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "BLI_hash_tables.hh" +#include "BLI_string.h" + +#include + +void blender::HashTableStats::print(StringRef name) const +{ + std::cout << "Hash Table Stats: " << name << "\n"; + std::cout << " Address: " << address_ << "\n"; + std::cout << " Total Slots: " << capacity_ << "\n"; + std::cout << " Occupied Slots: " << size_ << " (" << load_factor_ * 100.0f << " %)\n"; + std::cout << " Removed Slots: " << removed_amount_ << " (" << removed_load_factor_ * 100.0f + << " %)\n"; + + char memory_size_str[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE]; + BLI_str_format_byte_unit(memory_size_str, size_in_bytes_, true); + std::cout << " Size: ~" << memory_size_str << "\n"; + std::cout << " Size per Slot: " << size_per_element_ << " bytes\n"; + + std::cout << " Average Collisions: " << average_collisions_ << "\n"; + for (int64_t collision_count : keys_by_collision_count_.index_range()) { + std::cout << " " << collision_count + << " Collisions: " << keys_by_collision_count_[collision_count] << "\n"; + } +} diff --git a/source/blender/blenlib/intern/index_range.cc b/source/blender/blenlib/intern/index_range.cc new file mode 100644 index 00000000000..02decbf0641 --- /dev/null +++ b/source/blender/blenlib/intern/index_range.cc @@ -0,0 +1,17 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "BLI_index_range.hh" + +#include + +namespace blender { + +std::ostream &operator<<(std::ostream &stream, IndexRange range) +{ + stream << '[' << range.start() << ", " << range.one_after_last() << ')'; + return stream; +} + +} // namespace blender diff --git a/source/blender/blenlib/intern/math_basis_types.cc b/source/blender/blenlib/intern/math_basis_types.cc new file mode 100644 index 00000000000..e69ecce6e2f --- /dev/null +++ b/source/blender/blenlib/intern/math_basis_types.cc @@ -0,0 +1,45 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "BLI_math_basis_types.hh" + +#include + +namespace blender::math { + +std::ostream &operator<<(std::ostream &stream, const Axis axis) +{ + switch (axis.axis_) { + default: + BLI_assert_unreachable(); + return stream << "Invalid Axis"; + case Axis::Value::X: + return stream << 'X'; + case Axis::Value::Y: + return stream << 'Y'; + case Axis::Value::Z: + return stream << 'Z'; + } +} +std::ostream &operator<<(std::ostream &stream, const AxisSigned axis) +{ + switch (axis.axis_) { + default: + BLI_assert_unreachable(); + return stream << "Invalid AxisSigned"; + case AxisSigned::Value::X_POS: + case AxisSigned::Value::Y_POS: + case AxisSigned::Value::Z_POS: + case AxisSigned::Value::X_NEG: + case AxisSigned::Value::Y_NEG: + case AxisSigned::Value::Z_NEG: + return stream << axis.axis() << (axis.sign() == -1 ? '-' : '+'); + } +} +std::ostream &operator<<(std::ostream &stream, const CartesianBasis &rot) +{ + return stream << "CartesianBasis" << rot.axes; +} + +} // namespace blender::math diff --git a/source/blender/blenlib/intern/string_ref.cc b/source/blender/blenlib/intern/string_ref.cc new file mode 100644 index 00000000000..48688a7a2d2 --- /dev/null +++ b/source/blender/blenlib/intern/string_ref.cc @@ -0,0 +1,23 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "BLI_string_ref.hh" + +#include + +namespace blender { + +std::ostream &operator<<(std::ostream &stream, StringRef ref) +{ + stream << std::string(ref); + return stream; +} + +std::ostream &operator<<(std::ostream &stream, StringRefNull ref) +{ + stream << std::string(ref.data(), size_t(ref.size())); + return stream; +} + +} diff --git a/source/blender/blenlib/intern/vector.cc b/source/blender/blenlib/intern/vector.cc new file mode 100644 index 00000000000..6ed89944ebd --- /dev/null +++ b/source/blender/blenlib/intern/vector.cc @@ -0,0 +1,26 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "BLI_string.h" +#include "BLI_vector.hh" + +#include + +void blender::internal::vector_print_stats(StringRef name, + void *address, + int64_t size, + int64_t capacity, + int64_t inlineCapacity, + int64_t memorySize) +{ + std::cout << "Vector Stats: " << name << "\n"; + std::cout << " Address: " << address << "\n"; + std::cout << " Elements: " << size << "\n"; + std::cout << " Capacity: " << capacity << "\n"; + std::cout << " Inline Capacity: " << inlineCapacity << "\n"; + + char memory_size_str[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE]; + BLI_str_format_byte_unit(memory_size_str, memorySize, true); + std::cout << " Size on Stack: " << memory_size_str << "\n"; +} diff --git a/source/blender/blenlib/intern/virtual_array.cc b/source/blender/blenlib/intern/virtual_array.cc new file mode 100644 index 00000000000..75bc5d71664 --- /dev/null +++ b/source/blender/blenlib/intern/virtual_array.cc @@ -0,0 +1,12 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "BLI_virtual_array.hh" + +#include + +void blender::internal::print_mutable_varray_span_warning() +{ + std::cout << "Warning: Call `save()` to make sure that changes persist in all cases.\n"; +} diff --git a/source/blender/compositor/realtime_compositor/intern/shader_operation.cc b/source/blender/compositor/realtime_compositor/intern/shader_operation.cc index 5b51dc960a0..495d88e4e2d 100644 --- a/source/blender/compositor/realtime_compositor/intern/shader_operation.cc +++ b/source/blender/compositor/realtime_compositor/intern/shader_operation.cc @@ -31,6 +31,8 @@ #include "COM_shader_operation.hh" #include "COM_utilities.hh" +#include + namespace blender::realtime_compositor { using namespace nodes::derived_node_tree_types; diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc index 7e68c1388d8..86177c5371e 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc @@ -26,6 +26,8 @@ #include "intern/node/deg_node_operation.h" #include "intern/node/deg_node_time.h" +#include + namespace deg = blender::deg; namespace dot = blender::dot; diff --git a/source/blender/draw/engines/eevee/eevee_shaders_extra.cc b/source/blender/draw/engines/eevee/eevee_shaders_extra.cc index 61fde2f0400..7d5fedf4926 100644 --- a/source/blender/draw/engines/eevee/eevee_shaders_extra.cc +++ b/source/blender/draw/engines/eevee/eevee_shaders_extra.cc @@ -16,6 +16,8 @@ #include "eevee_private.h" +#include + using blender::gpu::shader::StageInterfaceInfo; void eevee_shader_material_create_info_amend(GPUMaterial *gpumat, diff --git a/source/blender/draw/engines/eevee_next/eevee_film.hh b/source/blender/draw/engines/eevee_next/eevee_film.hh index 7cc65331b11..fe83387251d 100644 --- a/source/blender/draw/engines/eevee_next/eevee_film.hh +++ b/source/blender/draw/engines/eevee_next/eevee_film.hh @@ -22,6 +22,8 @@ #include "eevee_shader_shared.hh" +#include + namespace blender::eevee { class Instance; diff --git a/source/blender/draw/engines/eevee_next/eevee_reflection_probes.cc b/source/blender/draw/engines/eevee_next/eevee_reflection_probes.cc index 78413b7c3bc..b0490ab4aaf 100644 --- a/source/blender/draw/engines/eevee_next/eevee_reflection_probes.cc +++ b/source/blender/draw/engines/eevee_next/eevee_reflection_probes.cc @@ -7,6 +7,8 @@ #include "eevee_instance.hh" #include "eevee_reflection_probes.hh" +#include + namespace blender::eevee { void ReflectionProbeModule::init() diff --git a/source/blender/draw/engines/gpencil/gpencil_shader.cc b/source/blender/draw/engines/gpencil/gpencil_shader.cc index 5b75dfd8365..c600d9e3c87 100644 --- a/source/blender/draw/engines/gpencil/gpencil_shader.cc +++ b/source/blender/draw/engines/gpencil/gpencil_shader.cc @@ -8,6 +8,8 @@ #include "gpencil_shader.hh" +#include + namespace blender::draw::greasepencil { ShaderModule *ShaderModule::g_shader_module = nullptr; diff --git a/source/blender/draw/intern/draw_debug.cc b/source/blender/draw/intern/draw_debug.cc index d645f2be52e..245caf42326 100644 --- a/source/blender/draw/intern/draw_debug.cc +++ b/source/blender/draw/intern/draw_debug.cc @@ -22,6 +22,7 @@ #include "draw_shader_shared.h" #include +#include #if defined(DEBUG) || defined(WITH_DRAW_DEBUG) # define DRAW_DEBUG diff --git a/source/blender/draw/intern/draw_pass.hh b/source/blender/draw/intern/draw_pass.hh index 2f3999a1eae..25585c118b0 100644 --- a/source/blender/draw/intern/draw_pass.hh +++ b/source/blender/draw/intern/draw_pass.hh @@ -55,6 +55,8 @@ #include "intern/gpu_codegen.h" +#include + namespace blender::draw { using namespace blender::draw; using namespace blender::draw::command; diff --git a/source/blender/draw/intern/draw_texture_pool.cc b/source/blender/draw/intern/draw_texture_pool.cc index f44d883bc43..8f3a9a930b3 100644 --- a/source/blender/draw/intern/draw_texture_pool.cc +++ b/source/blender/draw/intern/draw_texture_pool.cc @@ -8,6 +8,7 @@ #include "BKE_global.h" +#include "BLI_string.h" #include "BLI_vector.hh" #include "draw_texture_pool.h" diff --git a/source/blender/editors/asset/intern/asset_indexer.cc b/source/blender/editors/asset/intern/asset_indexer.cc index 006f793f26e..69abdc47d11 100644 --- a/source/blender/editors/asset/intern/asset_indexer.cc +++ b/source/blender/editors/asset/intern/asset_indexer.cc @@ -32,6 +32,8 @@ #include "CLG_log.h" +#include + static CLG_LogRef LOG = {"ed.asset"}; namespace blender::ed::asset::index { diff --git a/source/blender/editors/asset/intern/asset_shelf.cc b/source/blender/editors/asset/intern/asset_shelf.cc index 359a185be51..f000dbb1a11 100644 --- a/source/blender/editors/asset/intern/asset_shelf.cc +++ b/source/blender/editors/asset/intern/asset_shelf.cc @@ -12,6 +12,8 @@ #include "AS_asset_catalog_path.hh" +#include "BLI_string.h" + #include "BKE_context.h" #include "BKE_screen.h" diff --git a/source/blender/editors/interface/interface_drop.cc b/source/blender/editors/interface/interface_drop.cc index 937d7d6dfb4..bd02644f90d 100644 --- a/source/blender/editors/interface/interface_drop.cc +++ b/source/blender/editors/interface/interface_drop.cc @@ -8,6 +8,8 @@ #include "UI_interface.hh" +#include "BLI_string.h" + namespace blender::ui { DragInfo::DragInfo(const wmDrag &drag, const wmEvent &event, const DropLocation drop_location) diff --git a/source/blender/editors/interface/views/abstract_view_item.cc b/source/blender/editors/interface/views/abstract_view_item.cc index 7ec61df29a1..061414d9adf 100644 --- a/source/blender/editors/interface/views/abstract_view_item.cc +++ b/source/blender/editors/interface/views/abstract_view_item.cc @@ -18,6 +18,8 @@ #include "UI_abstract_view.hh" +#include + namespace blender::ui { /* ---------------------------------------------------------------------- */ diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 23d5369f5bb..e72de7a93b7 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -96,6 +96,7 @@ #include "node_intern.hh" /* own include */ #include +#include namespace geo_log = blender::nodes::geo_eval_log; using blender::bke::bNodeTreeZone; diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc index 8d5968cb7f2..922c0f38890 100644 --- a/source/blender/editors/space_outliner/tree/tree_element.cc +++ b/source/blender/editors/space_outliner/tree/tree_element.cc @@ -6,6 +6,7 @@ * \ingroup spoutliner */ +#include #include #include diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc index f859b318afa..657bcc8a4a3 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc @@ -26,6 +26,8 @@ #include "tree_element_label.hh" #include "tree_element_overrides.hh" +#include + namespace blender::ed::outliner { class OverrideRNAPathTreeBuilder { diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.cc b/source/blender/editors/space_sequencer/sequencer_buttons.cc index ea28a7ee912..bc73ab429e5 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.cc +++ b/source/blender/editors/space_sequencer/sequencer_buttons.cc @@ -12,6 +12,7 @@ #include "MEM_guardedalloc.h" #include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLT_translation.h" diff --git a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc index 93e37379adf..4563e0960a5 100644 --- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc +++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc @@ -45,6 +45,8 @@ #include "spreadsheet_row_filter.hh" #include "spreadsheet_row_filter_ui.hh" +#include + using namespace blender; using namespace blender::ed::spreadsheet; diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc index 1732379dfea..6421f9ff750 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc @@ -29,6 +29,8 @@ #include "spreadsheet_row_filter.hh" #include "spreadsheet_row_filter_ui.hh" +#include + using namespace blender; using namespace blender::ed::spreadsheet; diff --git a/source/blender/functions/intern/lazy_function_graph.cc b/source/blender/functions/intern/lazy_function_graph.cc index 43ac007209b..9738f4aa6fa 100644 --- a/source/blender/functions/intern/lazy_function_graph.cc +++ b/source/blender/functions/intern/lazy_function_graph.cc @@ -6,6 +6,8 @@ #include "FN_lazy_function_graph.hh" +#include + namespace blender::fn::lazy_function { Graph::~Graph() diff --git a/source/blender/functions/intern/lazy_function_graph_executor.cc b/source/blender/functions/intern/lazy_function_graph_executor.cc index 433e3a0c399..6ba6ae3804d 100644 --- a/source/blender/functions/intern/lazy_function_graph_executor.cc +++ b/source/blender/functions/intern/lazy_function_graph_executor.cc @@ -42,6 +42,7 @@ */ #include +#include #include "BLI_compute_context.hh" #include "BLI_enumerable_thread_specific.hh" diff --git a/source/blender/functions/intern/multi_function_procedure.cc b/source/blender/functions/intern/multi_function_procedure.cc index ef58c86f363..e419c5f1642 100644 --- a/source/blender/functions/intern/multi_function_procedure.cc +++ b/source/blender/functions/intern/multi_function_procedure.cc @@ -7,6 +7,8 @@ #include "BLI_dot_export.hh" #include "BLI_stack.hh" +#include + namespace blender::fn::multi_function { void InstructionCursor::set_next(Procedure &procedure, Instruction *new_instruction) const diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index b9ba0982a92..56575d8faa6 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -9,6 +9,7 @@ #include "MEM_guardedalloc.h" #include "BLI_math_base.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "GPU_batch.h" diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index 1a3b9bc7e66..7ea9538adf2 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -9,6 +9,7 @@ #include "MEM_guardedalloc.h" #include "BLI_math_matrix.h" +#include "BLI_string.h" #include "BLI_string_utils.h" #include "GPU_capabilities.h" diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index 3f94c0b7182..30b93c19968 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -20,6 +20,8 @@ #include "gl_shader.hh" #include "gl_shader_interface.hh" +#include + using namespace blender; using namespace blender::gpu; using namespace blender::gpu::shader; diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc index 4e675e01226..ebb0f5316cf 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc +++ b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc @@ -38,6 +38,8 @@ #include "gpencil_io.h" #include "gpencil_io_export_pdf.hh" +#include + namespace blender ::io ::gpencil { static void error_handler(HPDF_STATUS error_no, HPDF_STATUS detail_no, void * /*user_data*/) diff --git a/source/blender/io/gpencil/intern/gpencil_io_import_svg.cc b/source/blender/io/gpencil/intern/gpencil_io_import_svg.cc index 7fee64c1f5d..e87bcfaa700 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_import_svg.cc +++ b/source/blender/io/gpencil/intern/gpencil_io_import_svg.cc @@ -12,6 +12,7 @@ #include "BLI_math_vector.h" #include "BLI_math_vector_types.hh" #include "BLI_span.hh" +#include "BLI_string.h" #include "DNA_gpencil_legacy_types.h" @@ -28,6 +29,8 @@ #include "nanosvg.h" +#include + using blender::MutableSpan; namespace blender::io::gpencil { diff --git a/source/blender/io/ply/exporter/ply_file_buffer.cc b/source/blender/io/ply/exporter/ply_file_buffer.cc index f078d02a22a..332e9595246 100644 --- a/source/blender/io/ply/exporter/ply_file_buffer.cc +++ b/source/blender/io/ply/exporter/ply_file_buffer.cc @@ -8,6 +8,8 @@ #include "ply_file_buffer.hh" +#include + namespace blender::io::ply { FileBuffer::FileBuffer(const char *filepath, size_t buffer_chunk_size) diff --git a/source/blender/io/ply/importer/ply_import_buffer.cc b/source/blender/io/ply/importer/ply_import_buffer.cc index 248d99e36ee..8492c831949 100644 --- a/source/blender/io/ply/importer/ply_import_buffer.cc +++ b/source/blender/io/ply/importer/ply_import_buffer.cc @@ -7,6 +7,7 @@ #include "BLI_fileops.h" #include +#include static inline bool is_newline(char ch) { diff --git a/source/blender/io/ply/tests/io_ply_exporter_test.cc b/source/blender/io/ply/tests/io_ply_exporter_test.cc index 5809621f251..be552dd31b5 100644 --- a/source/blender/io/ply/tests/io_ply_exporter_test.cc +++ b/source/blender/io/ply/tests/io_ply_exporter_test.cc @@ -5,6 +5,8 @@ #include "testing/testing.h" #include "tests/blendfile_loading_base_test.h" +#include "BLI_string.h" + #include "BKE_appdir.h" #include "BKE_blender_version.h" diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc index 3026bd285f0..8134981d045 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc @@ -8,6 +8,7 @@ #include #include +#include #include "BKE_attribute.hh" #include "BKE_blender_version.h" diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh index 9ab2746c373..7ee1fd5a92f 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh @@ -18,6 +18,8 @@ #include "obj_export_io.hh" #include "obj_export_mtl.hh" +#include + namespace blender::io::obj { class OBJCurve; diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc index c1fefb6d123..aa83a13236e 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc @@ -18,6 +18,7 @@ #include #include +#include namespace blender::io::obj { diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc index 62d8894e94d..59cf9cb15b7 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc @@ -23,6 +23,8 @@ #include "obj_import_mtl.hh" #include "obj_import_string_utils.hh" +#include + namespace blender::io::obj { /** diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 9cc873d381e..f1ef2e800ea 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include "MEM_guardedalloc.h" diff --git a/source/blender/nodes/function/nodes/node_fn_value_to_string.cc b/source/blender/nodes/function/nodes/node_fn_value_to_string.cc index 548e471aa6e..f3e1d58e197 100644 --- a/source/blender/nodes/function/nodes/node_fn_value_to_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_value_to_string.cc @@ -4,6 +4,7 @@ #include "node_function_util.hh" #include +#include namespace blender::nodes::node_fn_value_to_string_cc { diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc index 4a1bf14e708..eaf7854798e 100644 --- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc +++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc @@ -49,6 +49,7 @@ #include "DEG_depsgraph_query.h" #include +#include namespace blender::nodes {