Add missing compiler flags and fix warnings (#4889)

This makes the build fail on warnings. It caught two out-of-bounds reads
and a deprecation warning.
This commit is contained in:
Tyler Veness
2023-01-01 08:14:19 -08:00
committed by GitHub
parent 42fc4cb6bc
commit f0fa8205ac
9 changed files with 28 additions and 23 deletions

View File

@@ -41,14 +41,16 @@ nativeUtils.platformConfigs.each {
}
}
// Suppress OpenCV warning
// NativeUtils adds the following OpenCV warning suppression for Linux, but not
// for macOS
// https://github.com/opencv/opencv/issues/20269
nativeUtils.platformConfigs.each {
if (it.name == nativeUtils.wpi.platforms.linuxx64) {
it.cppCompiler.args.add("-Wno-deprecated-enum-enum-conversion")
} else if (it.name.contains('osx')) {
it.cppCompiler.args.add("-Wno-deprecated-anon-enum-enum-conversion")
}
nativeUtils.platformConfigs.osxuniversal.cppCompiler.args.add("-Wno-deprecated-anon-enum-enum-conversion")
// NativeUtils uses the wrong compiler arguments for roboRIO targets, but it's
// too late to fix NativeUtils for the 2023 season. This temporarily overwrites
// the flags.
nativeUtils.platformConfigs.named(nativeUtils.wpi.platforms.roborio).configure {
cppCompiler.args.remove('-Wno-error=deprecated-declarations')
}
nativeUtils.platformConfigs.linuxathena.linker.args.add("-Wl,--fatal-warnings")