From 017009437dc1f81b9a2b4fcdbdd18b1ed350a41e Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 2 Jun 2024 15:15:54 -0400 Subject: [PATCH] Meta: Update compilation flags in the GN build to match the CMake build --- Meta/gn/build/BUILD.gn | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Meta/gn/build/BUILD.gn b/Meta/gn/build/BUILD.gn index 9869e48e5d2..f11d1931f43 100644 --- a/Meta/gn/build/BUILD.gn +++ b/Meta/gn/build/BUILD.gn @@ -79,12 +79,21 @@ config("compiler_defaults") { # Linetables always go in the .o file, even with -gsplit-dwarf, so there's # no point in passing -gsplit-dwarf here. } - if (is_optimized) { - cflags += [ "-O3" ] - } - cflags += [ "-fdiagnostics-color" ] - cflags += [ "-ffp-contract=off" ] + if (is_optimized) { + cflags += [ "-O2" ] + } + + cflags += [ + "-D_FILE_OFFSET_BITS=64", + "-DENABLE_COMPILETIME_FORMAT_CHECK", + ] + + cflags += [ + "-fdiagnostics-color", + "-ffp-contract=off", + "-fsigned-char", + ] if (use_lld) { ldflags += [ "-Wl,--color-diagnostics" ] @@ -103,11 +112,14 @@ config("compiler_defaults") { cflags += [ "-Wall", "-Wextra", + "-Werror", ] cflags += [ - "-Wno-unused-parameter", "-Wno-invalid-offsetof", + "-Wno-unknown-warning-option", + "-Wno-unused-parameter", ] + if (is_clang) { cflags += [ "-Wdelete-non-virtual-dtor", @@ -116,6 +128,7 @@ config("compiler_defaults") { "-fconstexpr-steps=16777216", "-Wno-unused-private-field", "-Wno-implicit-const-int-float-conversion", + "-Wno-vla-cxx-extension", ] } else { cflags += [ @@ -166,7 +179,10 @@ config("compiler_defaults") { "-isysroot", rebase_path(sdk_path, root_build_dir), ] + } else { + cflags += [ "-fno-semantic-interposition" ] } + if (sysroot != "" && current_os != "win" && is_clang) { cflags += [ "-Wpoison-system-directories" ] }