mesa/src/glx
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
..
apple Get rid of 5 remaining references to glapitable.h 2025-04-23 20:18:25 +00:00
windows glapi: rename exported symbols so as not to conflict with old libglapi 2025-01-23 00:49:05 +00:00
applegl_glx.c glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
clientattrib.c apple: Extended Apple feature support using GLX_USE_APPLE. 2024-03-18 18:06:45 +00:00
clientinfo.c glx: tabs -> spaces 2024-07-28 13:11:07 +00:00
compsize.c
create_context.c glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
dri3_glx.c dri: Get rid of __DRIbackgroundCallableExtension 2025-07-16 01:32:56 +00:00
dri3_priv.h mesa_interface: replace opaque __DRIscreen with struct dri_screen everywhere 2024-10-22 06:48:02 +00:00
dri_common.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
dri_common.h dri: Get rid of __DRIbackgroundCallableExtension 2025-07-16 01:32:56 +00:00
dri_common_query_renderer.c glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
drisw_glx.c dri: Get rid of __DRIbackgroundCallableExtension 2025-07-16 01:32:56 +00:00
drisw_priv.h glx: inline __GLXDRIscreen onto base glx_screen 2024-08-19 17:43:59 +00:00
driwindows_glx.c mesa_interface: replace opaque __DRIscreen with struct dri_screen everywhere 2024-10-22 06:48:02 +00:00
eval.c
g_glxglvnddispatchfuncs.c
g_glxglvnddispatchindices.h
glvnd-symbols.txt glx: stop exporting EXT_texture_object functions from libGLX_mesa.so 2025-03-27 05:46:35 +00:00
glx_error.c
glx_error.h glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
glx_pbuffer.c glx: Fix the GLX_EXT_swap_control_tear drawable attributes 2024-10-23 19:55:53 +00:00
glx_query.c
glxclient.h glx: clean up a litttle remains of DRI2 support. 2025-07-09 14:31:05 -07:00
glxcmds.c glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
glxconfig.c glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
glxconfig.h glx: tabs -> spaces 2024-07-28 13:11:07 +00:00
glxcurrent.c glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
glxext.c glx: Refuse to initialize if Display is not thread-safe 2025-07-16 01:32:56 +00:00
glxextensions.c glapi: remove unused functions from dispatch tables 2025-03-03 21:06:06 +00:00
glxextensions.h glapi: remove unused functions from dispatch tables 2025-03-03 21:06:06 +00:00
glxglvnd.c
glxglvnd.h
glxglvnddispatchfuncs.h
glxhash.c glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
glxhash.h
indirect_glx.c glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
indirect_init.h
indirect_texture_compression.c
indirect_transpose_matrix.c
indirect_vertex_array.c glapi: remove unused functions from dispatch tables 2025-03-03 21:06:06 +00:00
indirect_vertex_array.h
indirect_vertex_array_priv.h
indirect_vertex_program.c
indirect_window_pos.c
libgl-symbols.txt glx: add a test to verify exported symbols 2025-03-27 05:46:34 +00:00
meson.build x11: Remove DRI2 support 2025-07-09 17:49:58 +00:00
packrender.h
packsingle.h
pixel.c
pixelstore.c
query_renderer.c glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL 2025-02-20 15:47:23 +00:00
render2.c glx: Fix typos 2025-02-15 17:43:44 +00:00
renderpix.c glx: don't generate indirect GLX dispatch for ARB_imaging functions 2025-03-27 05:46:34 +00:00
single2.c glx: stop exporting EXT_texture_object functions from libGLX_mesa.so 2025-03-27 05:46:35 +00:00
vertarr.c glx: tabs -> spaces 2024-07-28 13:11:07 +00:00
xfont.c mesa: move dispatch.h and marshal_generated.h generation to glapi/gen 2025-03-27 05:46:35 +00:00