From b4502bb6ff55c8e6addae5610f2f5f2ad14fde51 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 10 Feb 2025 17:14:01 +0100 Subject: [PATCH] os: macro for marking struct fields xserver-internal Several drivers still accessing internal struct field they shouldn't, eg. directly calling or manipulating low level proc vectors, while there are higher level functions for that. Introducing a macro for marking struct fields internal, so the compiler spits out a deprecation warning when those are accessed by drivers directly. Signed-off-by: Enrico Weigelt, metux IT consult --- include/os.h | 6 ++++++ meson.build | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/os.h b/include/os.h index e26664d9a3..8819dc247f 100644 --- a/include/os.h +++ b/include/os.h @@ -84,6 +84,12 @@ typedef struct _NewClientRec *NewClientPtr; #include #include +#ifdef _INSIDE_XSERVER +#define _X_XSERVER_INTERNAL(msg) +#else +#define _X_XSERVER_INTERNAL(msg) _X_DEPRECATED_MSG(msg) +#endif + extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ ); extern _X_EXPORT int ReadFdFromClient(ClientPtr client); diff --git a/meson.build b/meson.build index e95743ff99..3925cb87bf 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,8 @@ project('xserver', 'c', release_date = '2021-07-05' add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc']) +add_project_arguments('-D_INSIDE_XSERVER', language: ['c', 'objc']) + cc = meson.get_compiler('c') add_project_arguments('-fno-strict-aliasing', language : 'c')