Module: Mesa
Branch: main
Commit: e0eea5ea4edbca9d28b91224830ef168ab7ecc5c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0eea5ea4edbca9d28b91224830ef168ab7ecc5c

Author: Caio Oliveira <caio.olive...@intel.com>
Date:   Thu Sep 21 10:29:41 2023 -0700

nir: Disable -Wmisleading-indentation when compiling with GCC

When a file is too large, -Wmisleading-indentantion will give the warning
below, that we can't prevent from a #pragma:

```
src/compiler/nir/nir_opt_algebraic.c: In function ‘nir_opt_algebraic’:
src/compiler/nir/nir_opt_algebraic.c:1469069: note: ‘-Wmisleading-indentation’ 
is disabled from this point onwards, since column-tracking was disabled due to 
the size of the code/headers
1469069 |    nir_foreach_function_impl(impl, shader) {
        |
src/compiler/nir/nir_opt_algebraic.c:1469069: note: adding 
‘-flarge-source-files’ will allow for more column-tracking support, at the 
expense of compilation time and memory
```

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89549 for details.

Acked-by: Erik Faye-Lund <erik.faye-l...@collabora.com>
Reviewed-by: Eric Engestrom <e...@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25315>

---

 src/compiler/nir/meson.build | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index 2edbc6bcfe6..5ce85780cca 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -306,13 +306,23 @@ files_libnir = files(
   'nir_xfb_info.h',
 )
 
+# When a file is too large, -Wmisleading-indentation will give a note about
+# not being able to process it, however that is not suppressable by a #pragma
+# in GCC.  This happens with the generated code in nir_opt_algebraic.c.
+#
+# As a workaround, drop the warning for GCC.  Clang builds should cover this.
+no_misleading_indentation = []
+if cc.get_id() == 'gcc'
+  no_misleading_indentation += 
cc.get_supported_arguments('-Wno-misleading-indentation')
+endif
+
 _libnir = static_library(
   'nir',
   [files_libnir, nir_opt_algebraic_c, nir_opcodes_c,
    nir_opcodes_h, nir_constant_expressions_c, nir_builder_opcodes_h,
    nir_intrinsics_c, nir_intrinsics_h, nir_intrinsics_indices_h],
   include_directories : [inc_include, inc_src],
-  c_args : [c_msvc_compat_args, no_override_init_args],
+  c_args : [c_msvc_compat_args, no_override_init_args, 
no_misleading_indentation],
   gnu_symbol_visibility : 'hidden',
   dependencies : [idep_compiler, dep_valgrind],
   build_by_default : false,

Reply via email to