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

Unified Diff: base/files/file_posix.cc

Issue 1467003002: Switch to static_assert in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/containers/stack_container.h ('k') | base/files/file_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_posix.cc
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
index a5aee01aa2935f3d2e1110c1822d44b6cabe8217..9760f04fcdffbf2654070c51feb4493d8c2f03a7 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 @@ int64 File::Seek(Whence whence, int64 offset) {
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 @@ void File::DoInitialize(const FilePath& path, uint32 flags) {
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)
« no previous file with comments | « base/containers/stack_container.h ('k') | base/files/file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698