Switch to static_assert in base/.
BUG=442514
Review URL: https://codereview.chromium.org/1467003002
Cr-Commit-Position: refs/heads/master@{#361337}
CrOS-Libchrome-Original-Commit: 4ec0dffe9e013e64058ff506a76bc822957227aa
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
index a5aee01..9760f04 100644
--- a/base/files/file_posix.cc
+++ b/base/files/file_posix.cc
@@ -22,9 +22,9 @@
namespace base {
// Make sure our Whence mappings match the system headers.
-COMPILE_ASSERT(File::FROM_BEGIN == SEEK_SET &&
- File::FROM_CURRENT == SEEK_CUR &&
- File::FROM_END == SEEK_END, whence_matches_system);
+static_assert(File::FROM_BEGIN == SEEK_SET && File::FROM_CURRENT == SEEK_CUR &&
+ File::FROM_END == SEEK_END,
+ "whence mapping must match the system headers");
namespace {
@@ -184,11 +184,11 @@
SCOPED_FILE_TRACE_WITH_SIZE("Seek", offset);
#if defined(OS_ANDROID)
- COMPILE_ASSERT(sizeof(int64) == sizeof(off64_t), off64_t_64_bit);
+ static_assert(sizeof(int64) == sizeof(off64_t), "off64_t must be 64 bits");
return lseek64(file_.get(), static_cast<off64_t>(offset),
static_cast<int>(whence));
#else
- COMPILE_ASSERT(sizeof(int64) == sizeof(off_t), off_t_64_bit);
+ static_assert(sizeof(int64) == sizeof(off_t), "off_t must be 64 bits");
return lseek(file_.get(), static_cast<off_t>(offset),
static_cast<int>(whence));
#endif
@@ -471,7 +471,7 @@
else if (flags & FLAG_APPEND)
open_flags |= O_APPEND | O_WRONLY;
- COMPILE_ASSERT(O_RDONLY == 0, O_RDONLY_must_equal_zero);
+ static_assert(O_RDONLY == 0, "O_RDONLY must equal zero");
int mode = S_IRUSR | S_IWUSR;
#if defined(OS_CHROMEOS)