From: Lukáš Hrázký Date: Fri, 15 Oct 2021 13:51:19 +0000 (+0200) Subject: Add an ifdef allowing to rename Solvable dependency members X-Git-Tag: 0.7.21~18^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F477%2Fhead;p=thirdparty%2Flibsolv.git 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. --- 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 */