Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(930)

Unified Diff: base/logging.h

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/json/json_writer_unittest.cc ('k') | base/logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/logging.h
diff --git a/base/logging.h b/base/logging.h
index ea096d19f729cb9043b0a6fcaea7a935e0d943aa..d72c39836a3348cf2730f7d51d4694aa274f4f05 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -138,11 +138,7 @@
namespace logging {
// TODO(avi): do we want to do a unification of character types here?
-#if defined(OS_WIN)
-typedef wchar_t PathChar;
-#else
typedef char PathChar;
-#endif
// Where to record logging output? A flat file and/or system debug log
// via OutputDebugString.
@@ -153,12 +149,9 @@ enum LoggingDestination {
LOG_TO_ALL = LOG_TO_FILE | LOG_TO_SYSTEM_DEBUG_LOG,
- // On Windows, use a file next to the exe; on POSIX platforms, where
- // it may not even be possible to locate the executable on disk, use
- // stderr.
-#if defined(OS_WIN)
- LOG_DEFAULT = LOG_TO_FILE,
-#elif defined(OS_POSIX)
+ // On POSIX platforms, where it may not even be possible to locate the
+ // executable on disk, use stderr.
+#if defined(OS_POSIX)
LOG_DEFAULT = LOG_TO_SYSTEM_DEBUG_LOG,
#endif
};
@@ -322,20 +315,6 @@ const LogSeverity LOG_DFATAL = LOG_FATAL;
#define COMPACT_GOOGLE_LOG_DFATAL \
COMPACT_GOOGLE_LOG_EX_DFATAL(LogMessage)
-#if defined(OS_WIN)
-// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
-// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
-// to keep using this syntax, we define this macro to do the same thing
-// as COMPACT_GOOGLE_LOG_ERROR, and also define ERROR the same way that
-// the Windows SDK does for consistency.
-#define ERROR 0
-#define COMPACT_GOOGLE_LOG_EX_0(ClassName, ...) \
- COMPACT_GOOGLE_LOG_EX_ERROR(ClassName , ##__VA_ARGS__)
-#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
-// Needed for LOG_IS_ON(ERROR).
-const LogSeverity LOG_0 = LOG_ERROR;
-#endif
-
// As special cases, we can assume that LOG_IS_ON(FATAL) always holds. Also,
// LOG_IS_ON(DFATAL) always holds in debug mode. In particular, CHECK()s will
// always fire if they fail.
@@ -382,11 +361,7 @@ const LogSeverity LOG_0 = LOG_ERROR;
LAZY_STREAM(VLOG_STREAM(verbose_level), \
VLOG_IS_ON(verbose_level) && (condition))
-#if defined (OS_WIN)
-#define VPLOG_STREAM(verbose_level) \
- logging::Win32ErrorLogMessage(__FILE__, __LINE__, -verbose_level, \
- ::logging::GetLastSystemErrorCode()).stream()
-#elif defined(OS_POSIX)
+#if defined(OS_POSIX)
#define VPLOG_STREAM(verbose_level) \
logging::ErrnoLogMessage(__FILE__, __LINE__, -verbose_level, \
::logging::GetLastSystemErrorCode()).stream()
@@ -406,11 +381,7 @@ const LogSeverity LOG_0 = LOG_ERROR;
#define SYSLOG_ASSERT(condition) \
SYSLOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". "
-#if defined(OS_WIN)
-#define PLOG_STREAM(severity) \
- COMPACT_GOOGLE_LOG_EX_ ## severity(Win32ErrorLogMessage, \
- ::logging::GetLastSystemErrorCode()).stream()
-#elif defined(OS_POSIX)
+#if defined(OS_POSIX)
#define PLOG_STREAM(severity) \
COMPACT_GOOGLE_LOG_EX_ ## severity(ErrnoLogMessage, \
::logging::GetLastSystemErrorCode()).stream()
@@ -450,26 +421,6 @@ const LogSeverity LOG_0 = LOG_ERROR;
#else
-#if defined(_PREFAST_) && defined(OS_WIN)
-// Use __analysis_assume to tell the VC++ static analysis engine that
-// assert conditions are true, to suppress warnings. The LAZY_STREAM
-// parameter doesn't reference 'condition' in /analyze builds because
-// this evaluation confuses /analyze. The !! before condition is because
-// __analysis_assume gets confused on some conditions:
-// http://randomascii.wordpress.com/2011/09/13/analyze-for-visual-studio-the-ugly-part-5/
-
-#define CHECK(condition) \
- __analysis_assume(!!(condition)), \
- LAZY_STREAM(LOG_STREAM(FATAL), false) \
- << "Check failed: " #condition ". "
-
-#define PCHECK(condition) \
- __analysis_assume(!!(condition)), \
- LAZY_STREAM(PLOG_STREAM(FATAL), false) \
- << "Check failed: " #condition ". "
-
-#else // _PREFAST_
-
#define CHECK(condition) \
LAZY_STREAM(LOG_STREAM(FATAL), !(condition)) \
<< "Check failed: " #condition ". "
@@ -478,8 +429,6 @@ const LogSeverity LOG_0 = LOG_ERROR;
LAZY_STREAM(PLOG_STREAM(FATAL), !(condition)) \
<< "Check failed: " #condition ". "
-#endif // _PREFAST_
-
// Helper macro for binary operators.
// Don't use this macro directly in your code, use CHECK_EQ et al below.
//
@@ -638,21 +587,6 @@ const LogSeverity LOG_DCHECK = LOG_INFO;
// variable warnings if the only use of a variable is in a DCHECK.
// This behavior is different from DLOG_IF et al.
-#if defined(_PREFAST_) && defined(OS_WIN)
-// See comments on the previous use of __analysis_assume.
-
-#define DCHECK(condition) \
- __analysis_assume(!!(condition)), \
- LAZY_STREAM(LOG_STREAM(DCHECK), false) \
- << "Check failed: " #condition ". "
-
-#define DPCHECK(condition) \
- __analysis_assume(!!(condition)), \
- LAZY_STREAM(PLOG_STREAM(DCHECK), false) \
- << "Check failed: " #condition ". "
-
-#else // _PREFAST_
-
#define DCHECK(condition) \
LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() ? !(condition) : false) \
<< "Check failed: " #condition ". "
@@ -661,8 +595,6 @@ const LogSeverity LOG_DCHECK = LOG_INFO;
LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() ? !(condition) : false) \
<< "Check failed: " #condition ". "
-#endif // _PREFAST_
-
// Helper macro for binary operators.
// Don't use this macro directly in your code, use DCHECK_EQ et al below.
#define DCHECK_OP(name, op, val1, val2) \
@@ -750,26 +682,6 @@ class BASE_EXPORT LogMessage {
const char* file_;
const int line_;
-#if defined(OS_WIN)
- // Stores the current value of GetLastError in the constructor and restores
- // it in the destructor by calling SetLastError.
- // This is useful since the LogMessage class uses a lot of Win32 calls
- // that will lose the value of GLE and the code that called the log function
- // will have lost the thread error value when the log call returns.
- class SaveLastError {
- public:
- SaveLastError();
- ~SaveLastError();
-
- unsigned long get_error() const { return last_error_; }
-
- protected:
- unsigned long last_error_;
- };
-
- SaveLastError last_error_;
-#endif
-
DISALLOW_COPY_AND_ASSIGN(LogMessage);
};
@@ -790,9 +702,7 @@ class LogMessageVoidify {
void operator&(std::ostream&) { }
};
-#if defined(OS_WIN)
-typedef unsigned long SystemErrorCode;
-#elif defined(OS_POSIX)
+#if defined(OS_POSIX)
typedef int SystemErrorCode;
#endif
@@ -801,27 +711,7 @@ typedef int SystemErrorCode;
BASE_EXPORT SystemErrorCode GetLastSystemErrorCode();
BASE_EXPORT std::string SystemErrorCodeToString(SystemErrorCode error_code);
-#if defined(OS_WIN)
-// Appends a formatted system message of the GetLastError() type.
-class BASE_EXPORT Win32ErrorLogMessage {
- public:
- Win32ErrorLogMessage(const char* file,
- int line,
- LogSeverity severity,
- SystemErrorCode err);
-
- // Appends the error message before destructing the encapsulated class.
- ~Win32ErrorLogMessage();
-
- std::ostream& stream() { return log_message_.stream(); }
-
- private:
- SystemErrorCode err_;
- LogMessage log_message_;
-
- DISALLOW_COPY_AND_ASSIGN(Win32ErrorLogMessage);
-};
-#elif defined(OS_POSIX)
+#if defined(OS_POSIX)
// Appends a formatted system message of the errno type
class BASE_EXPORT ErrnoLogMessage {
public:
@@ -841,7 +731,7 @@ class BASE_EXPORT ErrnoLogMessage {
DISALLOW_COPY_AND_ASSIGN(ErrnoLogMessage);
};
-#endif // OS_WIN
+#endif // OS_POSIX
// Closes the log file explicitly if open.
// NOTE: Since the log file is opened as necessary by the action of logging
@@ -860,11 +750,6 @@ BASE_EXPORT void RawLog(int level, const char* message);
logging::RawLog(logging::LOG_FATAL, "Check failed: " #condition "\n"); \
} while (0)
-#if defined(OS_WIN)
-// Returns the default log file path.
-BASE_EXPORT std::wstring GetLogFileFullPath();
-#endif
-
} // namespace logging
// Note that "The behavior of a C++ program is undefined if it adds declarations
« no previous file with comments | « base/json/json_writer_unittest.cc ('k') | base/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698