Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion common/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#define FLUTTER_COMMON_SETTINGS_H_

#include <fcntl.h>
#include <stdint.h>

#include <chrono>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion examples/glfw/FlutterEmbedderGLFW.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <assert.h>
#include <embedder.h>
#include <glfw3.h>

#include <cassert>
#include <chrono>
#include <iostream>

Expand Down
3 changes: 1 addition & 2 deletions flow/layers/layer_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#ifndef FLUTTER_FLOW_LAYERS_LAYER_TREE_H_
#define FLUTTER_FLOW_LAYERS_LAYER_TREE_H_

#include <stdint.h>

#include <cstdint>
#include <memory>

#include "flutter/flow/compositor_context.h"
Expand Down
5 changes: 1 addition & 4 deletions flow/matrix_decomposition_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/fml/build_config.h"

#if defined(OS_WIN)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This symbol is only required on Windows (for M_PI etc.) and this is the only place we actually wrap it in a platform check, but also the place we benefit least from doing so (unittest). We could wrap it everywhere, but figured it would be nice to keep the code consistent so people don't end up doing a mix of the two approaches.

#define _USE_MATH_DEFINES
#endif

#include <cmath>

#include "flutter/flow/matrix_decomposition.h"
Expand Down
3 changes: 1 addition & 2 deletions fml/command_line.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
#ifndef LIB_FML_COMMAND_LINE_H_
#define LIB_FML_COMMAND_LINE_H_

#include <stddef.h>

#include <cstddef>
#include <initializer_list>
#include <string>
#include <string_view>
Expand Down
2 changes: 1 addition & 1 deletion fml/log_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include "flutter/fml/log_settings.h"

#include <fcntl.h>
#include <string.h>

#include <algorithm>
#include <cstring>
#include <iostream>

#include "flutter/fml/logging.h"
Expand Down
3 changes: 2 additions & 1 deletion fml/platform/android/scoped_java_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#define FLUTTER_FML_PLATFORM_ANDROID_SCOPED_JAVA_REF_H_

#include <jni.h>
#include <stddef.h>

#include <cstddef>

#include "flutter/fml/macros.h"

Expand Down
3 changes: 2 additions & 1 deletion fml/platform/posix/paths_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

#include "flutter/fml/paths.h"

#include <limits.h>
#include <unistd.h>

#include <climits>

#include "flutter/fml/logging.h"

namespace fml {
Expand Down
2 changes: 1 addition & 1 deletion fml/platform/posix/posix_wrappers_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "flutter/fml/posix_wrappers.h"

#include <string.h>
#include <cstring>

namespace fml {

Expand Down
3 changes: 2 additions & 1 deletion fml/platform/win/file_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
#include <Fileapi.h>
#include <Shlwapi.h>
#include <fcntl.h>
#include <limits.h>

#include <algorithm>
#include <climits>
#include <cstring>
#include <sstream>

#include "flutter/fml/build_config.h"
Expand Down
2 changes: 1 addition & 1 deletion fml/platform/win/posix_wrappers_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "flutter/fml/posix_wrappers.h"

#include <string.h>
#include <cstring>

namespace fml {

Expand Down
6 changes: 3 additions & 3 deletions fml/synchronization/waitable_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

#include "flutter/fml/synchronization/waitable_event.h"

#include <cerrno>
#include <ctime>

#include "flutter/fml/logging.h"
#include "flutter/fml/time/time_delta.h"
#include "flutter/fml/time/time_point.h"

#include <errno.h>
#include <time.h>

namespace fml {

// Waits with a timeout on |condition()|. Returns true on timeout, or false if
Expand Down
7 changes: 3 additions & 4 deletions fml/synchronization/waitable_event_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

#include "flutter/fml/synchronization/waitable_event.h"

#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>

#include <atomic>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <thread>
#include <type_traits>
#include <vector>
Expand Down
5 changes: 2 additions & 3 deletions fml/time/time_delta.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#ifndef FLUTTER_FML_TIME_TIME_DELTA_H_
#define FLUTTER_FML_TIME_TIME_DELTA_H_

#include <stdint.h>
#include <time.h>

#include <chrono>
#include <cstdint>
#include <ctime>
#include <iosfwd>
#include <limits>

Expand Down
3 changes: 1 addition & 2 deletions fml/time/time_point.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#ifndef FLUTTER_FML_TIME_TIME_POINT_H_
#define FLUTTER_FML_TIME_TIME_POINT_H_

#include <stdint.h>

#include <cstdint>
#include <iosfwd>

#include "flutter/fml/time/time_delta.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/compositing/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef FLUTTER_LIB_UI_COMPOSITING_SCENE_H_
#define FLUTTER_LIB_UI_COMPOSITING_SCENE_H_

#include <stdint.h>
#include <cstdint>
#include <memory>

#include "flutter/flow/layers/layer_tree.h"
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/compositing/scene_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#ifndef FLUTTER_LIB_UI_COMPOSITING_SCENE_BUILDER_H_
#define FLUTTER_LIB_UI_COMPOSITING_SCENE_BUILDER_H_

#include <stdint.h>

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

Expand Down
7 changes: 4 additions & 3 deletions lib/ui/compositing/scene_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
#define FLUTTER_LIB_UI_COMPOSITING_SCENE_HOST_H_

#include <lib/ui/scenic/cpp/id.h>
#include <stdint.h>
#include <zircon/types.h>
#include "third_party/tonic/dart_library_natives.h"
#include "third_party/tonic/dart_persistent_value.h"

#include <cstdint>

#include "dart-pkg/zircon/sdk_ext/handle.h"
#include "flutter/fml/memory/ref_counted.h"
#include "flutter/fml/task_runner.h"
#include "flutter/lib/ui/dart_wrapper.h"
#include "third_party/tonic/dart_library_natives.h"
#include "third_party/tonic/dart_persistent_value.h"

namespace flutter {

Expand Down
7 changes: 3 additions & 4 deletions lib/ui/dart_runtime_hooks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

#include "flutter/lib/ui/dart_runtime_hooks.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>

Expand Down
5 changes: 3 additions & 2 deletions lib/ui/painting/canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#define _USE_MATH_DEFINES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep this with the header?

(Applies to the same change in other files as well.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a bunch of cases, we pull in cmath without defining this; if the first include is via something transitively included via canvas.h, we end up getting it without M_PI etc.

There are a couple options: one is that everywhere we include cmath, we define this. Another is the approach of defining this symbol before the first include in a given file, which feels safer, despite the fact it would be nice to keep them side-by-side. Thoughts/preferences?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add it as a define in GN instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. Will take a look; that avoids cluttering the code with this altogether. It's not obvious to readers at first blush why this is there until you look up what the define does and it's not anything insightful when you do finally find out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #21166


#include "flutter/lib/ui/painting/canvas.h"

#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>

#include "flutter/flow/layers/physical_shape_layer.h"
#include "flutter/lib/ui/painting/image.h"
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/painting/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#define _USE_MATH_DEFINES

#include "flutter/lib/ui/painting/path.h"

#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>

#include "flutter/lib/ui/painting/matrix.h"
#include "flutter/lib/ui/ui_dart_state.h"
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/painting/path_measure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#define _USE_MATH_DEFINES

#include "flutter/lib/ui/painting/path_measure.h"

#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>

#include "flutter/lib/ui/painting/matrix.h"
#include "flutter/lib/ui/ui_dart_state.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/semantics/semantics_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "flutter/lib/ui/semantics/semantics_node.h"

#include <string.h>
#include <cstring>

namespace flutter {

Expand Down
3 changes: 1 addition & 2 deletions lib/ui/semantics/semantics_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#ifndef FLUTTER_LIB_UI_SEMANTICS_SEMANTICS_NODE_H_
#define FLUTTER_LIB_UI_SEMANTICS_SEMANTICS_NODE_H_

#include <stdint.h>

#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/window/pointer_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "flutter/lib/ui/window/pointer_data.h"

#include <string.h>
#include <cstring>

namespace flutter {

Expand Down
2 changes: 1 addition & 1 deletion lib/ui/window/pointer_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef FLUTTER_LIB_UI_WINDOW_POINTER_DATA_H_
#define FLUTTER_LIB_UI_WINDOW_POINTER_DATA_H_

#include <stdint.h>
#include <cstdint>

namespace flutter {

Expand Down
2 changes: 1 addition & 1 deletion lib/ui/window/pointer_data_packet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "flutter/lib/ui/window/pointer_data_packet.h"

#include <string.h>
#include <cstring>

namespace flutter {

Expand Down
3 changes: 1 addition & 2 deletions lib/ui/window/pointer_data_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#ifndef FLUTTER_LIB_UI_WINDOW_POINTER_DATA_PACKET_H_
#define FLUTTER_LIB_UI_WINDOW_POINTER_DATA_PACKET_H_

#include <string.h>

#include <cstring>
#include <vector>

#include "flutter/fml/macros.h"
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/window/pointer_data_packet_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
// found in the LICENSE file.

#include "flutter/lib/ui/window/pointer_data_packet_converter.h"
#include "flutter/fml/logging.h"

#include <string.h>
#include <cstring>

#include "flutter/fml/logging.h"

namespace flutter {

Expand Down
3 changes: 1 addition & 2 deletions lib/ui/window/pointer_data_packet_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#ifndef FLUTTER_LIB_UI_WINDOW_POINTER_DATA_PACKET_CONVERTER_H_
#define FLUTTER_LIB_UI_WINDOW_POINTER_DATA_PACKET_CONVERTER_H_

#include <string.h>

#include <cstring>
#include <map>
#include <memory>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion runtime/dart_service_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include "flutter/runtime/dart_service_isolate.h"

#include <string.h>
#include <algorithm>
#include <cstring>

#include "flutter/fml/logging.h"
#include "flutter/fml/posix_wrappers.h"
Expand Down
2 changes: 1 addition & 1 deletion runtime/embedder_resources.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "flutter/runtime/embedder_resources.h"

#include <string.h>
#include <cstring>

#include "flutter/fml/logging.h"

Expand Down
3 changes: 1 addition & 2 deletions runtime/service_protocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

#include "flutter/runtime/service_protocol.h"

#include <string.h>

#include <cstring>
#include <sstream>
#include <string>
#include <utility>
Expand Down
5 changes: 4 additions & 1 deletion shell/common/engine_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
// found in the LICENSE file.
// FLUTTER_NOLINT

#include "flutter/runtime/dart_vm_lifecycle.h"
#include "flutter/shell/common/engine.h"

#include <cstring>

#include "flutter/runtime/dart_vm_lifecycle.h"
#include "flutter/shell/common/thread_host.h"
#include "flutter/testing/testing.h"
#include "gmock/gmock.h"
Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#define FML_USED_ON_EMBEDDER

#include <time.h>
#include <algorithm>
#include <ctime>
#include <functional>
#include <future>
#include <memory>
Expand Down
Loading