Enable -Wall -Wextra compiler warnings on non-Win too.
Fix warnings seen on the bots.
But don't turn on -Werror yet.
Change-Id: I2a9b0e744917405e863cea5fa9d458f3084fb302
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/6482
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
diff --git a/build/gen.py b/build/gen.py
index 26bce26..d2305c8 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -335,6 +335,9 @@
'-fno-exceptions',
'-fno-rtti',
'-fdiagnostics-color',
+ '-Wall',
+ '-Wextra',
+ '-Wno-unused-parameter',
])
cflags_cc.extend(['-std=c++17'])
diff --git a/src/base/files/file_util_posix.cc b/src/base/files/file_util_posix.cc
index 87a38dd..7054880 100644
--- a/src/base/files/file_util_posix.cc
+++ b/src/base/files/file_util_posix.cc
@@ -142,19 +142,7 @@
}
#endif // defined(OS_LINUX) || defined(OS_AIX)
-bool AdvanceEnumeratorWithStat(FileEnumerator* traversal,
- FilePath* out_next_path,
- struct stat* out_next_stat) {
- DCHECK(out_next_path);
- DCHECK(out_next_stat);
- *out_next_path = traversal->Next();
- if (out_next_path->empty())
- return false;
-
- *out_next_stat = traversal->GetInfo().stat();
- return true;
-}
-
+#if !defined(OS_MACOSX)
bool CopyFileContents(File* infile, File* outfile) {
static constexpr size_t kBufferSize = 32768;
std::vector<char> buffer(kBufferSize);
@@ -181,7 +169,6 @@
return false;
}
-#if !defined(OS_MACOSX)
// Appends |mode_char| to |mode| before the optional character set encoding; see
// https://www.gnu.org/software/libc/manual/html_node/Opening-Streams.html for
// details.
diff --git a/src/util/ticks.cc b/src/util/ticks.cc
index f26b5d8..121c719 100644
--- a/src/util/ticks.cc
+++ b/src/util/ticks.cc
@@ -33,7 +33,9 @@
#error Port.
#endif
+#if !defined(OS_MACOSX)
constexpr uint64_t kNano = 1'000'000'000;
+#endif
void Init() {
DCHECK(!g_initialized);