add --allow-warnings flag in gen.py

This is for
https://gn-review.googlesource.com/c/gn/+/13782/10#message-094221aa03a2d7b443cbc25b3a343186e56f837c

Change-Id: I4e09e6976a4c2fbd7fb7cf336bdcadf7a56ceb8d
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/13940
Reviewed-by: Petr Hosek <phosek@google.com>
Commit-Queue: Takuto Ikuta <tikuta@google.com>
diff --git a/README.md b/README.md
index 75821c6..2034efb 100644
--- a/README.md
+++ b/README.md
@@ -94,7 +94,7 @@
 
     git clone https://gn.googlesource.com/gn
     cd gn
-    python build/gen.py
+    python build/gen.py # --allow-warning if you want to build with warnings.
     ninja -C out
     # To run tests:
     out/gn_unittests
diff --git a/build/gen.py b/build/gen.py
index c7a73a8..fe56186 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -183,6 +183,9 @@
                           'library, or \'-l<name>\' on POSIX systems. Can be ' +
                           'used multiple times. Useful to link custom malloc ' +
                           'or cpu profiling libraries.'))
+  args_list.add('--allow-warnings', action='store_true', default=False,
+                    help=('Allow compiler warnings, don\'t treat them as '
+                          'errors.'))
   if sys.platform == 'zos':
     args_list.add('--zoslib-dir',
                       action='store',
@@ -427,6 +430,9 @@
         cflags.extend(['-flto', '-fwhole-program-vtables'])
         ldflags.extend(['-flto', '-fwhole-program-vtables'])
 
+    if not options.allow_warnings:
+      cflags.append('-Werror')
+
     cflags.extend([
         '-D_FILE_OFFSET_BITS=64',
         '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS',
@@ -435,7 +441,6 @@
         '-fno-exceptions',
         '-fno-rtti',
         '-fdiagnostics-color',
-        '-Werror',
         '-Wall',
         '-Wextra',
         '-Wno-unused-parameter',
@@ -513,6 +518,9 @@
         libflags.extend(['/LTCG'])
         ldflags.extend(['/LTCG'])
 
+    if not options.allow_warnings:
+      cflags.append('/WX')
+
     cflags.extend([
         '/DNOMINMAX',
         '/DUNICODE',
@@ -524,7 +532,6 @@
         '/D_WIN32_WINNT=0x0A00',
         '/FS',
         '/W4',
-        '/WX',
         '/Zi',
         '/wd4099',
         '/wd4100',