AIX: Fix gcc compilation on aix
- Wrange-loop-analysis is not supported by gcc
- On the switch case an error is being generated
with gcc 8.3 indicating:
```
error: this statement may fall through
```
Change-Id: I31862810a66034ba46c8b157aa181da528688089
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/13840
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@google.com>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
diff --git a/build/gen.py b/build/gen.py
index 9fd68e9..2d89af4 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -439,11 +439,14 @@
'-Wall',
'-Wextra',
'-Wno-unused-parameter',
- '-Wrange-loop-analysis',
'-Wundef',
'-std=c++17'
])
+ # flag not supported by gcc/g++.
+ if not (platform.is_aix() or platform.is_msys() or platform.is_mingw()):
+ cflags.extend(['-Wrange-loop-analysis']);
+
if platform.is_linux() or platform.is_mingw() or platform.is_msys():
ldflags.append('-Wl,--as-needed')
diff --git a/src/gn/exec_process.cc b/src/gn/exec_process.cc
index 69d631e..e1e123f 100644
--- a/src/gn/exec_process.cc
+++ b/src/gn/exec_process.cc
@@ -253,6 +253,8 @@
argv_cstr[argv.size()] = nullptr;
execvp(argv_cstr[0], argv_cstr.get());
_exit(127);
+ // Avoid `fall through` warning on some gcc versions.
+ break;
}
default: // parent
{