enable -Wundef and make warning as error
This is to prevent typo like
https://gn-review.googlesource.com/c/gn/+/13720/1..3/src/util/aligned_alloc.h#b61
with
https://clang.llvm.org/docs/DiagnosticsReference.html#wundef
Change-Id: I79092766de2a98119da06f33f3caef181c3baa11
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/13781
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@google.com>
diff --git a/build/gen.py b/build/gen.py
index 3ec0560..6e915b8 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -435,9 +435,11 @@
'-fno-exceptions',
'-fno-rtti',
'-fdiagnostics-color',
+ '-Werror',
'-Wall',
'-Wextra',
'-Wno-unused-parameter',
+ '-Wundef',
'-std=c++17'
])
diff --git a/src/base/compiler_specific.h b/src/base/compiler_specific.h
index ec139d2..dd46c98 100644
--- a/src/base/compiler_specific.h
+++ b/src/base/compiler_specific.h
@@ -18,9 +18,9 @@
#endif // COMPILER_MSVC
-#if COMPILER_GCC && defined(NDEBUG)
+#if defined(COMPILER_GCC) && defined(NDEBUG)
#define ALWAYS_INLINE inline __attribute__((__always_inline__))
-#elif COMPILER_MSVC && defined(NDEBUG)
+#elif defined(COMPILER_MSVC) && defined(NDEBUG)
#define ALWAYS_INLINE __forceinline
#else
#define ALWAYS_INLINE inline
diff --git a/src/base/logging.cc b/src/base/logging.cc
index c8673e4..e8929c1 100644
--- a/src/base/logging.cc
+++ b/src/base/logging.cc
@@ -77,7 +77,7 @@
} // namespace
-#if DCHECK_IS_CONFIGURABLE
+#if defined(DCHECK_IS_CONFIGURABLE)
// In DCHECK-enabled Chrome builds, allow the meaning of LOG_DCHECK to be
// determined at run-time. We default it to INFO, to avoid it triggering
// crashes before the run-time has explicitly chosen the behaviour.
diff --git a/src/base/logging.h b/src/base/logging.h
index 2b1af7f..18f827f 100644
--- a/src/base/logging.h
+++ b/src/base/logging.h
@@ -607,7 +607,7 @@
#if DCHECK_IS_ON()
-#if DCHECK_IS_CONFIGURABLE
+#if defined(DCHECK_IS_CONFIGURABLE)
extern LogSeverity LOG_DCHECK;
#else
const LogSeverity LOG_DCHECK = LOG_FATAL;