]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Add an ifdef allowing to rename Solvable dependency members 477/head
authorLukáš Hrázký <lhrazky@redhat.com>
Fri, 15 Oct 2021 13:51:19 +0000 (15:51 +0200)
committerLukáš Hrázký <lhrazky@redhat.com>
Wed, 3 Nov 2021 14:48:26 +0000 (15:48 +0100)
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

index 0298db4f8b997d335f60894505057f51cf9c5549..4b26661acea507649743c460a75b22259052b741 100644 (file)
@@ -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 */