Add additional shielding against the ERROR macro.

Including the logging header with ERROR defined will always be a
problem, so check for it explicitly.

Move the NOGDI define from logging.cpp to logging.h since the standard
library headers might be including windows.h, pulling in ERROR.

Change-Id: Ib426973d2f1840710c0bf0e0cfb2420d0d322e27
This commit is contained in:
Dan Albert 2015-05-04 16:40:38 -07:00
parent 14799c6249
commit ea41c213be
2 changed files with 9 additions and 1 deletions

View file

@ -17,6 +17,15 @@
#ifndef BASE_LOGGING_H
#define BASE_LOGGING_H
#ifdef ERROR
#error ERROR is already defined. If this is Windows code, #define NOGDI before \
including anything.
#endif
#ifdef _WIN32
#define NOGDI // Suppress the evil ERROR macro.
#endif
#include <functional>
#include <memory>
#include <ostream>

View file

@ -35,7 +35,6 @@
#ifndef _WIN32
#include <mutex>
#else
#define NOGDI // Suppress the evil ERROR macro.
#include <windows.h>
#endif