mesa/src/intel/dev
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 build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
xe intel: Add has_partial_mmap_offset to intel_device_info 2025-04-30 12:56:39 +00:00
gen_wa_helpers.py intel/dev/mesa_defs.json: Add WCL WA entries 2025-07-21 21:22:05 +00:00
intel_debug.c intel: Add INTEL_DEBUG=no-vrt 2025-07-13 21:11:02 +00:00
intel_debug.h intel: Add INTEL_DEBUG=no-vrt 2025-07-13 21:11:02 +00:00
intel_device_info.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
intel_device_info.h build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
intel_device_info.py intel/dev: Add WCL platform enum 2025-07-21 21:22:05 +00:00
intel_device_info_gen_h.py intel: Remove circular dependency between intel/dev and intel/common 2024-02-14 17:29:54 +00:00
intel_device_info_override_test.c intel: Skip ioctls for querying device info when hardware is unsupported 2024-01-25 09:57:24 +00:00
intel_device_info_serialize.h intel/dev: implement json serialization for intel_device_info 2024-02-13 19:38:36 +00:00
intel_device_info_serialize_gen_c.py build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
intel_device_info_test.c intel/dev: Support INTEL_FORCE_PROBE env-var 2024-05-28 18:45:49 +00:00
intel_device_info_test.h intel/dev: Adjust prefetch_size values for MTL engines 2022-09-22 02:14:47 +00:00
intel_hwconfig.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
intel_hwconfig.h intel/dev: Call intel_device_info_update_after_hwconfig() from common code 2025-02-17 20:52:31 +00:00
intel_hwconfig_types.h intel/hwconfig: Sync hwconfig with IGT 2025-03-25 17:46:12 +00:00
intel_kmd.c intel: Enable Xe KMD support by default 2024-03-12 22:22:50 +00:00
intel_kmd.h intel/common: Prepare mi_builder tests to support Xe KMD 2024-11-20 01:47:04 +00:00
mesa_defs.json intel/dev/mesa_defs.json: Add WCL WA entries 2025-07-21 21:22:05 +00:00
meson.build format: Generate endian-independent format aliases 2024-07-19 13:50:42 +00:00