Skip to content

Commit

Permalink
Handle Windows headers defining ERROR to 0 in log levels. (flutter#6677)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde committed Oct 26, 2018
1 parent 505d2a9 commit ba8f6aa
Show file tree
Hide file tree
Showing 18 changed files with 7 additions and 68 deletions.
4 changes: 0 additions & 4 deletions assets/asset_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
#include "flutter/assets/directory_asset_bundle.h"
#include "flutter/fml/trace_event.h"

#ifdef ERROR
#undef ERROR
#endif

namespace blink {

AssetManager::AssetManager() = default;
Expand Down
4 changes: 0 additions & 4 deletions flow/layers/platform_view_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

#include "flutter/flow/layers/platform_view_layer.h"

#ifdef ERROR
#undef ERROR
#endif

namespace flow {

PlatformViewLayer::PlatformViewLayer() = default;
Expand Down
7 changes: 7 additions & 0 deletions fml/log_level.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ constexpr LogSeverity LOG_ERROR = 2;
constexpr LogSeverity LOG_FATAL = 3;
constexpr LogSeverity LOG_NUM_SEVERITIES = 4;

// One of the Windows headers defines ERROR to 0. This makes the token
// concatenation in FML_LOG(ERROR) to resolve to LOG_0. We define this back to
// the appropriate log level.
#ifdef _WIN32
#define LOG_0 LOG_ERROR
#endif

// LOG_DFATAL is LOG_FATAL in debug mode, ERROR in normal mode
#ifdef NDEBUG
const LogSeverity LOG_DFATAL = LOG_ERROR;
Expand Down
4 changes: 0 additions & 4 deletions lib/ui/painting/codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
#include "third_party/tonic/logging/dart_invoke.h"
#include "third_party/tonic/typed_data/uint8_list.h"

#ifdef ERROR
#undef ERROR
#endif

using tonic::DartInvoke;
using tonic::DartPersistentValue;
using tonic::ToDart;
Expand Down
4 changes: 0 additions & 4 deletions lib/ui/painting/image_encoding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ using tonic::DartInvoke;
using tonic::DartPersistentValue;
using tonic::ToDart;

#ifdef ERROR
#undef ERROR
#endif

namespace blink {
namespace {

Expand Down
4 changes: 0 additions & 4 deletions runtime/dart_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
#include "third_party/tonic/scopes/dart_api_scope.h"
#include "third_party/tonic/scopes/dart_isolate_scope.h"

#ifdef ERROR
#undef ERROR
#endif

namespace blink {

std::weak_ptr<DartIsolate> DartIsolate::CreateRootIsolate(
Expand Down
4 changes: 0 additions & 4 deletions runtime/dart_vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
#include "third_party/tonic/scopes/dart_api_scope.h"
#include "third_party/tonic/typed_data/uint8_list.h"

#ifdef ERROR
#undef ERROR
#endif

namespace dart {
namespace observatory {

Expand Down
4 changes: 0 additions & 4 deletions runtime/runtime_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
#include "flutter/runtime/runtime_delegate.h"
#include "third_party/tonic/dart_message_handler.h"

#ifdef ERROR
#undef ERROR
#endif

namespace blink {

RuntimeController::RuntimeController(
Expand Down
4 changes: 0 additions & 4 deletions shell/common/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

static constexpr char kAssetChannel[] = "flutter/assets";
Expand Down
4 changes: 0 additions & 4 deletions shell/common/isolate_configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
#include "flutter/fml/make_copyable.h"
#include "flutter/runtime/dart_vm.h"

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

IsolateConfiguration::IsolateConfiguration() = default;
Expand Down
4 changes: 0 additions & 4 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
#include "third_party/skia/include/core/SkSurfaceCharacterization.h"
#include "third_party/skia/include/utils/SkBase64.h"

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

Rasterizer::Rasterizer(blink::TaskRunners task_runners)
Expand Down
4 changes: 0 additions & 4 deletions shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
#include "third_party/skia/include/core/SkGraphics.h"
#include "third_party/tonic/common/log.h"

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

std::unique_ptr<Shell> Shell::CreateShellOnPlatformThread(
Expand Down
4 changes: 0 additions & 4 deletions shell/gpu/gpu_surface_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
#define GPU_GL_RGB565 0x8D62
#define GPU_GL_VERSION 0x1F02

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

// Default maximum number of budgeted resources in the cache.
Expand Down
4 changes: 0 additions & 4 deletions shell/platform/embedder/embedder_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

#include "flutter/fml/make_copyable.h"

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

EmbedderEngine::EmbedderEngine(
Expand Down
4 changes: 0 additions & 4 deletions shell/platform/embedder/embedder_surface_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

#include "flutter/shell/common/io_manager.h"

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

EmbedderSurfaceGL::EmbedderSurfaceGL(GLDispatchTable gl_dispatch_table,
Expand Down
4 changes: 0 additions & 4 deletions shell/platform/embedder/embedder_surface_software.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
#include "flutter/fml/trace_event.h"
#include "third_party/skia/include/gpu/GrContext.h"

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

EmbedderSurfaceSoftware::EmbedderSurfaceSoftware(
Expand Down
4 changes: 0 additions & 4 deletions shell/platform/embedder/platform_view_embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

#include "flutter/shell/platform/embedder/platform_view_embedder.h"

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

PlatformViewEmbedder::PlatformViewEmbedder(
Expand Down
4 changes: 0 additions & 4 deletions shell/testing/tester_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
#include "flutter/shell/common/thread_host.h"
#include "third_party/dart/runtime/include/bin/dart_io_api.h"

#ifdef ERROR
#undef ERROR
#endif

namespace shell {

// Checks whether the engine's main Dart isolate has no pending work. If so,
Expand Down

0 comments on commit ba8f6aa

Please sign in to comment.