Skip to content

Commit

Permalink
Add missing header guards (flutter#41322)
Browse files Browse the repository at this point in the history
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-
```
  • Loading branch information
bdero authored Apr 19, 2023
1 parent bb29628 commit 25c5747
Show file tree
Hide file tree
Showing 21 changed files with 80 additions and 6 deletions.
5 changes: 5 additions & 0 deletions common/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
5 changes: 5 additions & 0 deletions flow/flow_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <string>

namespace flutter {
Expand All @@ -15,3 +18,5 @@ const std::string& GetFontFile();
void SetFontFile(const std::string& dir);

} // namespace flutter

#endif // FLUTTER_FLOW_TEST_UTILS_H_
5 changes: 5 additions & 0 deletions flow/paint_region.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <vector>
#include "flutter/fml/logging.h"
#include "third_party/skia/include/core/SkRect.h"
Expand Down Expand Up @@ -65,3 +68,5 @@ class PaintRegion {
};

} // namespace flutter

#endif // FLUTTER_FLOW_PAINT_REGION_H_
5 changes: 5 additions & 0 deletions flow/testing/diff_context_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -66,3 +69,5 @@ class DiffContextTest : public LayerTest {

} // namespace testing
} // namespace flutter

#endif // FLUTTER_SHELL_DIFF_CONTEXT_TEST_H_
5 changes: 5 additions & 0 deletions flow/testing/mock_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ostream>
#include <vector>

Expand Down Expand Up @@ -57,3 +60,5 @@ extern std::ostream& operator<<(std::ostream& os,

} // namespace testing
} // namespace flutter

#endif // FLOW_TESTING_MOCK_TEXTURE_H_
5 changes: 5 additions & 0 deletions fml/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -46,3 +49,5 @@ constexpr float k1OverSqrt2 = 0.70710678118654752440;

} // namespace math
} // namespace flutter

#endif // FLUTTER_FML_MATH_H_
2 changes: 2 additions & 0 deletions impeller/archivist/archive_class_registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <map>
#include <optional>

Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/contents/scene_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <memory>

#include "impeller/entity/contents/color_source_contents.h"
Expand Down
2 changes: 2 additions & 0 deletions impeller/fixtures/golden_paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <vector>

#include "impeller/geometry/path_component.h"
Expand Down
2 changes: 2 additions & 0 deletions impeller/fixtures/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions impeller/geometry/geometry_asserts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <array>
#include <iostream>

Expand Down
2 changes: 2 additions & 0 deletions impeller/renderer/backend/gles/formats_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <optional>

#include "flutter/fml/logging.h"
Expand Down
2 changes: 2 additions & 0 deletions impeller/renderer/backend/metal/vertex_descriptor_mtl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Metal/Metal.h>

#include <set>
Expand Down
5 changes: 5 additions & 0 deletions lib/snapshot/snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <inttypes.h>
#include <stddef.h>
#include <stdint.h>
Expand All @@ -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_
5 changes: 5 additions & 0 deletions lib/ui/painting/image_generator_apng.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -214,3 +217,5 @@ class APNGImageGenerator : public ImageGenerator {
};

} // namespace flutter

#endif // FLUTTER_LIB_UI_PAINTING_IMAGE_GENERATOR_APNG_H_
6 changes: 3 additions & 3 deletions shell/common/resource_cache_limit_calculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cstdint>
#include <unordered_map>
Expand Down Expand Up @@ -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_
5 changes: 5 additions & 0 deletions shell/platform/embedder/test_utils/proc_table_replacement.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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_
5 changes: 5 additions & 0 deletions shell/platform/fuchsia/dart_runner/embedder/snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cstdint>

namespace dart_runner {
Expand All @@ -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_
5 changes: 5 additions & 0 deletions third_party/accessibility/ax/ax_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cstdint>

namespace ax {
Expand All @@ -19,3 +22,5 @@ const int32_t kUnknownAriaColumnOrRowCount = -1;
} // namespace mojom

} // namespace ax

#endif // UI_ACCESSIBILITY_AX_CONSTANTS_H_
6 changes: 3 additions & 3 deletions third_party/accessibility/base/win/windows_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <concurrencysal.h>
Expand Down Expand Up @@ -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_
5 changes: 5 additions & 0 deletions third_party/txt/tests/txt_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <string>

namespace txt {
Expand All @@ -23,3 +26,5 @@ const std::string& GetFontDir();
void SetFontDir(const std::string& dir);

} // namespace txt

#endif // LIB_TXT_TESTS_TXT_TEST_UTILS_H_

0 comments on commit 25c5747

Please sign in to comment.