mesa/src/gallium/drivers/iris
Antonio Ospite ddf2aa3a4d build: avoid redefining unreachable() which is standard in C23
In the C23 standard unreachable() is now a predefined function-like
macro in <stddef.h>

See https://android.googlesource.com/platform/bionic/+/HEAD/docs/c23.md#is-now-a-predefined-function_like-macro-in

And this causes build errors when building for C23:

-----------------------------------------------------------------------
In file included from ../src/util/log.h:30,
                 from ../src/util/log.c:30:
../src/util/macros.h:123:9: warning: "unreachable" redefined
  123 | #define unreachable(str)    \
      |         ^~~~~~~~~~~
In file included from ../src/util/macros.h:31:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:456:9: note: this is the location of the previous definition
  456 | #define unreachable() (__builtin_unreachable ())
      |         ^~~~~~~~~~~
-----------------------------------------------------------------------

So don't redefine it with the same name, but use the name UNREACHABLE()
to also signify it's a macro.

Using a different name also makes sense because the behavior of the
macro was extending the one of __builtin_unreachable() anyway, and it
also had a different signature, accepting one argument, compared to the
standard unreachable() with no arguments.

This change improves the chances of building mesa with the C23 standard,
which for instance is the default in recent AOSP versions.

All the instances of the macro, including the definition, were updated
with the following command line:

  git grep -l '[^_]unreachable(' -- "src/**" | sort | uniq | \
  while read file; \
  do \
    sed -e 's/\([^_]\)unreachable(/\1UNREACHABLE(/g' -i "$file"; \
  done && \
  sed -e 's/#undef unreachable/#undef UNREACHABLE/g' -i src/intel/isl/isl_aux_info.c

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36437>
2025-07-31 17:49:42 +00:00
..
i915 iris: Replace BO_ALLOC_* macros by a enum 2025-03-06 16:25:04 +00:00
xe build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
driinfo_iris.h isl/iris/anv: setup L1CacheControl based on surface and buffer usage 2025-03-26 20:19:07 +00:00
iris_batch.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_batch.h mi-builder: add read/write memory fencing support on Gfx20+ 2024-06-13 11:04:31 +00:00
iris_binder.c iris: enable generated indirect draws 2024-02-13 00:06:45 +00:00
iris_binder.h iris: enable generated indirect draws 2024-02-13 00:06:45 +00:00
iris_blit.c anv/iris/blorp: use the right MOCS values for each engine 2024-03-06 20:33:12 +00:00
iris_blorp.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_border_color.c
iris_bufmgr.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_bufmgr.h iris: implement SVM interfaces 2025-06-10 12:17:39 +00:00
iris_clear.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_context.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_context.h build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_defines.h iris: Don't return timestamps modulo 36-bits 2024-01-24 23:13:15 +00:00
iris_disk_cache.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_draw.c iris: Fix issue with conditional dispatching 2025-07-08 10:00:45 +00:00
iris_fence.c gallium: fix timeline semaphore value passing 2025-07-07 21:18:29 +00:00
iris_fence.h
iris_fine_fence.c iris: Nuke useless flags from iris_fine_fence_new() 2023-10-09 21:12:56 +00:00
iris_fine_fence.h iris: Nuke useless flags from iris_fine_fence_new() 2023-10-09 21:12:56 +00:00
iris_formats.c
iris_genx_macros.h build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_genx_protos.h iris: enable generated indirect draws 2024-02-13 00:06:45 +00:00
iris_indirect_gen.c iris: set dependency between SF_CL and CC states 2025-05-22 19:34:46 +00:00
iris_kmd_backend.c
iris_kmd_backend.h iris: Replace BO_ALLOC_* macros by a enum 2025-03-06 16:25:04 +00:00
iris_measure.c intel/measure: add nogl feature 2024-11-04 20:25:14 +00:00
iris_measure.h
iris_monitor.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_monitor.h
iris_perf.c
iris_perf.h
iris_performance_query.c
iris_pipe.h
iris_pipe_control.c iris: Add helper for indirect_ubos_use_sampler 2024-02-21 00:38:35 +00:00
iris_program.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_program_cache.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_query.c iris: Fix issue with conditional dispatching 2025-07-08 10:00:45 +00:00
iris_resolve.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_resource.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_resource.h iris: Add support for damage region 2025-01-02 14:40:47 +00:00
iris_screen.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_screen.h anv/iris: add drirc keys to disable VF/TE distribution 2025-02-27 21:10:59 +00:00
iris_state.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
iris_utrace.c u_trace: pass tracepoint flags to the read_timestamp callback 2025-02-24 08:08:02 +00:00
iris_utrace.h
meson.build intel: Add meson option -Dintel-elk 2025-01-30 00:45:59 +00:00