From b4271c24de1c76fd17f5175057d9e1149e3a4c02 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Wed, 19 Apr 2023 14:20:21 -0700 Subject: [PATCH] Add missing header guards (flutter/engine#41322) These keep turning up, so I did a little bash-fu to find them all. ```bash grep -lL "#pragma once" $(grep -lL "#ifndef .*_H_" $(find . | grep "\.h$")) | cut -c 3- ``` --- engine/src/flutter/common/constants.h | 5 +++++ engine/src/flutter/flow/flow_test_utils.h | 5 +++++ engine/src/flutter/flow/paint_region.h | 5 +++++ engine/src/flutter/flow/testing/diff_context_test.h | 5 +++++ engine/src/flutter/flow/testing/mock_texture.h | 5 +++++ engine/src/flutter/fml/math.h | 5 +++++ .../flutter/impeller/archivist/archive_class_registration.h | 2 ++ .../src/flutter/impeller/entity/contents/scene_contents.h | 2 ++ engine/src/flutter/impeller/fixtures/golden_paths.h | 2 ++ engine/src/flutter/impeller/fixtures/types.h | 2 ++ engine/src/flutter/impeller/geometry/geometry_asserts.h | 2 ++ .../flutter/impeller/renderer/backend/gles/formats_gles.h | 2 ++ .../impeller/renderer/backend/metal/vertex_descriptor_mtl.h | 2 ++ engine/src/flutter/lib/snapshot/snapshot.h | 5 +++++ engine/src/flutter/lib/ui/painting/image_generator_apng.h | 5 +++++ .../flutter/shell/common/resource_cache_limit_calculator.h | 6 +++--- .../platform/embedder/test_utils/proc_table_replacement.h | 5 +++++ .../shell/platform/fuchsia/dart_runner/embedder/snapshot.h | 5 +++++ .../src/flutter/third_party/accessibility/ax/ax_constants.h | 5 +++++ .../third_party/accessibility/base/win/windows_types.h | 6 +++--- engine/src/flutter/third_party/txt/tests/txt_test_utils.h | 5 +++++ 21 files changed, 80 insertions(+), 6 deletions(-) diff --git a/engine/src/flutter/common/constants.h b/engine/src/flutter/common/constants.h index 50b0f91e84..378f7c84e7 100644 --- a/engine/src/flutter/common/constants.h +++ b/engine/src/flutter/common/constants.h @@ -2,6 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLUTTER_COMMON_CONSTANTS_H_ +#define FLUTTER_COMMON_CONSTANTS_H_ + namespace flutter { constexpr double kMegaByteSizeInBytes = (1 << 20); } // namespace flutter + +#endif // FLUTTER_COMMON_CONSTANTS_H_ diff --git a/engine/src/flutter/flow/flow_test_utils.h b/engine/src/flutter/flow/flow_test_utils.h index ed4ca287fe..a4361813d4 100644 --- a/engine/src/flutter/flow/flow_test_utils.h +++ b/engine/src/flutter/flow/flow_test_utils.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLUTTER_FLOW_TEST_UTILS_H_ +#define FLUTTER_FLOW_TEST_UTILS_H_ + #include namespace flutter { @@ -15,3 +18,5 @@ const std::string& GetFontFile(); void SetFontFile(const std::string& dir); } // namespace flutter + +#endif // FLUTTER_FLOW_TEST_UTILS_H_ diff --git a/engine/src/flutter/flow/paint_region.h b/engine/src/flutter/flow/paint_region.h index 1fd8896b68..be12c82335 100644 --- a/engine/src/flutter/flow/paint_region.h +++ b/engine/src/flutter/flow/paint_region.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLUTTER_FLOW_PAINT_REGION_H_ +#define FLUTTER_FLOW_PAINT_REGION_H_ + #include #include "flutter/fml/logging.h" #include "third_party/skia/include/core/SkRect.h" @@ -65,3 +68,5 @@ class PaintRegion { }; } // namespace flutter + +#endif // FLUTTER_FLOW_PAINT_REGION_H_ diff --git a/engine/src/flutter/flow/testing/diff_context_test.h b/engine/src/flutter/flow/testing/diff_context_test.h index f606e42bca..69beb41d83 100644 --- a/engine/src/flutter/flow/testing/diff_context_test.h +++ b/engine/src/flutter/flow/testing/diff_context_test.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLUTTER_SHELL_DIFF_CONTEXT_TEST_H_ +#define FLUTTER_SHELL_DIFF_CONTEXT_TEST_H_ + #include "flutter/flow/layers/container_layer.h" #include "flutter/flow/layers/display_list_layer.h" #include "flutter/flow/layers/opacity_layer.h" @@ -66,3 +69,5 @@ class DiffContextTest : public LayerTest { } // namespace testing } // namespace flutter + +#endif // FLUTTER_SHELL_DIFF_CONTEXT_TEST_H_ diff --git a/engine/src/flutter/flow/testing/mock_texture.h b/engine/src/flutter/flow/testing/mock_texture.h index bf5d79bd25..c1b786eab8 100644 --- a/engine/src/flutter/flow/testing/mock_texture.h +++ b/engine/src/flutter/flow/testing/mock_texture.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLOW_TESTING_MOCK_TEXTURE_H_ +#define FLOW_TESTING_MOCK_TEXTURE_H_ + #include #include @@ -57,3 +60,5 @@ extern std::ostream& operator<<(std::ostream& os, } // namespace testing } // namespace flutter + +#endif // FLOW_TESTING_MOCK_TEXTURE_H_ diff --git a/engine/src/flutter/fml/math.h b/engine/src/flutter/fml/math.h index 848f161f57..6182ada09d 100644 --- a/engine/src/flutter/fml/math.h +++ b/engine/src/flutter/fml/math.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLUTTER_FML_MATH_H_ +#define FLUTTER_FML_MATH_H_ + namespace flutter { namespace math { @@ -46,3 +49,5 @@ constexpr float k1OverSqrt2 = 0.70710678118654752440; } // namespace math } // namespace flutter + +#endif // FLUTTER_FML_MATH_H_ diff --git a/engine/src/flutter/impeller/archivist/archive_class_registration.h b/engine/src/flutter/impeller/archivist/archive_class_registration.h index d290a46f5b..7976fe3931 100644 --- a/engine/src/flutter/impeller/archivist/archive_class_registration.h +++ b/engine/src/flutter/impeller/archivist/archive_class_registration.h @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#pragma once + #include #include diff --git a/engine/src/flutter/impeller/entity/contents/scene_contents.h b/engine/src/flutter/impeller/entity/contents/scene_contents.h index def5a36a04..9191728cb9 100644 --- a/engine/src/flutter/impeller/entity/contents/scene_contents.h +++ b/engine/src/flutter/impeller/entity/contents/scene_contents.h @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#pragma once + #include #include "impeller/entity/contents/color_source_contents.h" diff --git a/engine/src/flutter/impeller/fixtures/golden_paths.h b/engine/src/flutter/impeller/fixtures/golden_paths.h index fd53f52549..95fae57792 100644 --- a/engine/src/flutter/impeller/fixtures/golden_paths.h +++ b/engine/src/flutter/impeller/fixtures/golden_paths.h @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#pragma once + #include #include "impeller/geometry/path_component.h" diff --git a/engine/src/flutter/impeller/fixtures/types.h b/engine/src/flutter/impeller/fixtures/types.h index d8775956ba..aca0e96ad7 100644 --- a/engine/src/flutter/impeller/fixtures/types.h +++ b/engine/src/flutter/impeller/fixtures/types.h @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#pragma once + struct Uniforms { mat4 model; mat4 view; diff --git a/engine/src/flutter/impeller/geometry/geometry_asserts.h b/engine/src/flutter/impeller/geometry/geometry_asserts.h index d2c63fc2fe..57022b461f 100644 --- a/engine/src/flutter/impeller/geometry/geometry_asserts.h +++ b/engine/src/flutter/impeller/geometry/geometry_asserts.h @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#pragma once + #include #include diff --git a/engine/src/flutter/impeller/renderer/backend/gles/formats_gles.h b/engine/src/flutter/impeller/renderer/backend/gles/formats_gles.h index fa44297ba5..a4ceb93b45 100644 --- a/engine/src/flutter/impeller/renderer/backend/gles/formats_gles.h +++ b/engine/src/flutter/impeller/renderer/backend/gles/formats_gles.h @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#pragma once + #include #include "flutter/fml/logging.h" diff --git a/engine/src/flutter/impeller/renderer/backend/metal/vertex_descriptor_mtl.h b/engine/src/flutter/impeller/renderer/backend/metal/vertex_descriptor_mtl.h index 0fe392b214..030d36fe85 100644 --- a/engine/src/flutter/impeller/renderer/backend/metal/vertex_descriptor_mtl.h +++ b/engine/src/flutter/impeller/renderer/backend/metal/vertex_descriptor_mtl.h @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#pragma once + #include #include diff --git a/engine/src/flutter/lib/snapshot/snapshot.h b/engine/src/flutter/lib/snapshot/snapshot.h index 6a9ebfe4ea..9938f9fc42 100644 --- a/engine/src/flutter/lib/snapshot/snapshot.h +++ b/engine/src/flutter/lib/snapshot/snapshot.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLUTTER_LIB_SNAPSHOT_SNAPSHOT_H_ +#define FLUTTER_LIB_SNAPSHOT_SNAPSHOT_H_ + #include #include #include @@ -12,3 +15,5 @@ extern const uint8_t kDartVmSnapshotInstructions[]; extern const uint8_t kDartIsolateSnapshotData[]; extern const uint8_t kDartIsolateSnapshotInstructions[]; } + +#endif // FLUTTER_LIB_SNAPSHOT_SNAPSHOT_H_ diff --git a/engine/src/flutter/lib/ui/painting/image_generator_apng.h b/engine/src/flutter/lib/ui/painting/image_generator_apng.h index a18ef58cf0..14b357ad4a 100644 --- a/engine/src/flutter/lib/ui/painting/image_generator_apng.h +++ b/engine/src/flutter/lib/ui/painting/image_generator_apng.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLUTTER_LIB_UI_PAINTING_IMAGE_GENERATOR_APNG_H_ +#define FLUTTER_LIB_UI_PAINTING_IMAGE_GENERATOR_APNG_H_ + #include "image_generator.h" #include "flutter/fml/endianness.h" @@ -214,3 +217,5 @@ class APNGImageGenerator : public ImageGenerator { }; } // namespace flutter + +#endif // FLUTTER_LIB_UI_PAINTING_IMAGE_GENERATOR_APNG_H_ diff --git a/engine/src/flutter/shell/common/resource_cache_limit_calculator.h b/engine/src/flutter/shell/common/resource_cache_limit_calculator.h index cb47727ec4..89ef8fd7da 100644 --- a/engine/src/flutter/shell/common/resource_cache_limit_calculator.h +++ b/engine/src/flutter/shell/common/resource_cache_limit_calculator.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_COMMON_RESOURCE_CACHE_LIMIT_CALCULATOR_ -#define FLUTTER_SHELL_COMMON_RESOURCE_CACHE_LIMIT_CALCULATOR_ +#ifndef FLUTTER_SHELL_COMMON_RESOURCE_CACHE_LIMIT_CALCULATOR_H_ +#define FLUTTER_SHELL_COMMON_RESOURCE_CACHE_LIMIT_CALCULATOR_H_ #include #include @@ -45,4 +45,4 @@ class ResourceCacheLimitCalculator { }; } // namespace flutter -#endif // FLUTTER_SHELL_COMMON_RESOURCE_CACHE_LIMIT_CALCULATOR_ +#endif // FLUTTER_SHELL_COMMON_RESOURCE_CACHE_LIMIT_CALCULATOR_H_ diff --git a/engine/src/flutter/shell/platform/embedder/test_utils/proc_table_replacement.h b/engine/src/flutter/shell/platform/embedder/test_utils/proc_table_replacement.h index 711557ab8c..3f2cd88c3f 100644 --- a/engine/src/flutter/shell/platform/embedder/test_utils/proc_table_replacement.h +++ b/engine/src/flutter/shell/platform/embedder/test_utils/proc_table_replacement.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLUTTER_SHELL_PLATFORM_COMMON_TESTING_PROC_TABLE_REPLACEMENT_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_TESTING_PROC_TABLE_REPLACEMENT_H_ + #include "flutter/shell/platform/embedder/embedder.h" // Wraps capturing lambas with non-capturing version that can be assigned to @@ -22,3 +25,5 @@ static auto non_capturing = [](auto... args) { return closure(args...); }; \ return non_capturing; \ })() + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_TESTING_PROC_TABLE_REPLACEMENT_H_ diff --git a/engine/src/flutter/shell/platform/fuchsia/dart_runner/embedder/snapshot.h b/engine/src/flutter/shell/platform/fuchsia/dart_runner/embedder/snapshot.h index 44a890124c..edd9c1eae5 100644 --- a/engine/src/flutter/shell/platform/fuchsia/dart_runner/embedder/snapshot.h +++ b/engine/src/flutter/shell/platform/fuchsia/dart_runner/embedder/snapshot.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_RUNNER_EMBEDDER_SNAPSHOT_H_ +#define FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_RUNNER_EMBEDDER_SNAPSHOT_H_ + #include namespace dart_runner { @@ -10,3 +13,5 @@ extern uint8_t const* const vm_isolate_snapshot_buffer; extern uint8_t const* const isolate_snapshot_buffer; } // namespace dart_runner + +#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_RUNNER_EMBEDDER_SNAPSHOT_H_ diff --git a/engine/src/flutter/third_party/accessibility/ax/ax_constants.h b/engine/src/flutter/third_party/accessibility/ax/ax_constants.h index e9e7388b5d..db93292e48 100644 --- a/engine/src/flutter/third_party/accessibility/ax/ax_constants.h +++ b/engine/src/flutter/third_party/accessibility/ax/ax_constants.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef UI_ACCESSIBILITY_AX_CONSTANTS_H_ +#define UI_ACCESSIBILITY_AX_CONSTANTS_H_ + #include namespace ax { @@ -19,3 +22,5 @@ const int32_t kUnknownAriaColumnOrRowCount = -1; } // namespace mojom } // namespace ax + +#endif // UI_ACCESSIBILITY_AX_CONSTANTS_H_ diff --git a/engine/src/flutter/third_party/accessibility/base/win/windows_types.h b/engine/src/flutter/third_party/accessibility/base/win/windows_types.h index 9b8c421e69..d1084b80ac 100644 --- a/engine/src/flutter/third_party/accessibility/base/win/windows_types.h +++ b/engine/src/flutter/third_party/accessibility/base/win/windows_types.h @@ -5,8 +5,8 @@ // This file contains defines and typedefs that allow popular Windows types to // be used without the overhead of including windows.h. -#ifndef BASE_WIN_WINDOWS_TYPES_H -#define BASE_WIN_WINDOWS_TYPES_H +#ifndef BASE_WIN_WINDOWS_TYPES_H_ +#define BASE_WIN_WINDOWS_TYPES_H_ // Needed for function prototypes. #include @@ -273,4 +273,4 @@ WINBASEAPI VOID WINAPI SetLastError(_In_ DWORD dwErrCode); #define StartService StartServiceW #define UpdateResource UpdateResourceW -#endif // BASE_WIN_WINDOWS_TYPES_H +#endif // BASE_WIN_WINDOWS_TYPES_H_ diff --git a/engine/src/flutter/third_party/txt/tests/txt_test_utils.h b/engine/src/flutter/third_party/txt/tests/txt_test_utils.h index 897020fa05..603c93ab88 100644 --- a/engine/src/flutter/third_party/txt/tests/txt_test_utils.h +++ b/engine/src/flutter/third_party/txt/tests/txt_test_utils.h @@ -14,6 +14,9 @@ * limitations under the License. */ +#ifndef LIB_TXT_TESTS_TXT_TEST_UTILS_H_ +#define LIB_TXT_TESTS_TXT_TEST_UTILS_H_ + #include namespace txt { @@ -23,3 +26,5 @@ const std::string& GetFontDir(); void SetFontDir(const std::string& dir); } // namespace txt + +#endif // LIB_TXT_TESTS_TXT_TEST_UTILS_H_