From 9cf5b7571ea26320cdacd26bb66d0d807bd27c9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= Date: Fri, 15 Oct 2021 15:51:19 +0200 Subject: [PATCH] Add an ifdef allowing to rename Solvable dependency members In C++20 "requires" is a new keyword, causing a conflict with the Solvable::requires attribute. From the outside this can only be fixed with an ugly preprocessor redefinition of the symbol around each libsolv header include. This commit adds an #ifdef allowing to rename the dep attributes in case C++20 or higher is used, which can be easily defined in one place in the libolv user's build system. --- src/solvable.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/solvable.h b/src/solvable.h index 0298db4f..4b26661a 100644 --- a/src/solvable.h +++ b/src/solvable.h @@ -34,6 +34,19 @@ typedef struct s_Solvable { struct s_Repo *repo; /* repo we belong to */ /* dependencies are offsets into repo->idarraydata */ + /* the ifdef resolves "requires" conflicting with a C++20 keyword */ +#ifdef LIBSOLV_SOLVABLE_PREPEND_DEP + Offset dep_provides; /* terminated with Id 0 */ + Offset dep_obsoletes; + Offset dep_conflicts; + + Offset dep_requires; + Offset dep_recommends; + Offset dep_suggests; + + Offset dep_supplements; + Offset dep_enhances; +#else Offset provides; /* terminated with Id 0 */ Offset obsoletes; Offset conflicts; @@ -44,7 +57,7 @@ typedef struct s_Solvable { Offset supplements; Offset enhances; - +#endif } Solvable; /* lookup functions */ -- 2.47.2