Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch most of rpm over to C++ #3028

Merged
merged 8 commits into from
Apr 9, 2024

Conversation

pmatilai
Copy link
Member

@pmatilai pmatilai commented Apr 9, 2024

As per #2983, here goes.

More details in commits, but to summarize: add necessary casts to most of the codebase to make it buildable with a c++ compiler, and then switch over to c++. Exempt from this conversion are

  • Python bindings: there are no big benefits from converting it right now, and it'll serve as a C API canary as well
  • plugins: some of these may want to move to their real upstream repository now that the plugin API is public, we don't want to for language changes for them just now
  • the low-level ndb engine is left up to maintainer (@mlschroe ) discretion, there's no need to convert it

Following commits will add the necessary C-style casts that make
the codebase buildable both as C and C++. Intentionally exempt from
this conversion are:
- Python bindings (there's no big benefit to doing so, and will
  serve as a C API compatibility canary for now)
- plugins (some plugins may want to move outside rpm now that the
  plugin API is public, give them time to do so)
- low-level ndb engine (leaving to maintainer discretion)

Switch to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS for passing the various
global compiler options as not all options are legitimate for both
languages.

Signed comparison warnings are disabled initially, those need to be
cleared up eventually but for now, these issues exist in the C code
already and it's known to work nevertheless. Similarly C++20
compatibility warnings are disabled initially (there are keyword
clashes on "requires"), we'll cross that bridge when we come to it.

Exceptions are disabled at least initially because at in this first
stage this is effectively just C that doesn't know how to handle them,
called by (mostly) other C that doesn't know either.
In other words, a whole lot of "yes, really".
The low level ndb engine is intentionally exempt here, leaving if/when
to maintainer discretion.
@pmatilai
Copy link
Member Author

pmatilai commented Apr 9, 2024

This is (very) obviously a case of "things will get worse before they get better", these casts are just unsightly but most will go away once things are converted to actual native C++.

We'll rename the C++ sources to an appropriate extension before 6.0 (probably after 4.20 rc is out) but the cxx_sources hack is kinda necessary to get this thing bootstrapped, and also not having to rename things just now helps cherry-picking stuff to 4.20.

@pmatilai
Copy link
Member Author

pmatilai commented Apr 9, 2024

🙈

@pmatilai pmatilai merged commit 8c7d8d9 into rpm-software-management:master Apr 9, 2024
1 check passed
@pmatilai pmatilai deleted the cxx-pr branch April 9, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant