-
Notifications
You must be signed in to change notification settings - Fork 93
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
Auto generate symbols map #2517
Conversation
0c0561a
to
e63fbfe
Compare
e63fbfe
to
2b175f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems an interesting approach, but it looks like maybe there could be more smarts in the script and less lying in the comments? Particularly: it seems the script could take a “what is the MirAL SOVER” parameter, and use that as the version for all symbols either without “Since” annotations, or with annotations indicating a version less than SOVER?
That'd dramatically cut down the diff, remove the need to lie in comments, and reduce the amount of future diff needed, too?
/// \remark Since MirAL 2.4 | ||
/// \remark Since MirAL 3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. This change is a lie, right? This was introduced in MirAL 2.4, but because we've bumped SONAME the symbols are for MIRAL_3.0
?
And so, when we bump SONAME again (as we will soon), all the “Since” remarks will want to change to “MirAL 4.0”?
class WindowManagerTools | ||
{ | ||
public: | ||
explicit WindowManagerTools(WindowManagerToolsImplementation* tools); | ||
explicit WindowManagerTools(miral::WindowManagerToolsImplementation* tools); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the failure mode if the (otherwise unnecessary) miral::
namespace specifier is left off here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The miral::
doesn't make it into the symbol, because for some reason doxygen can't resolve it the way it can most things (presumably something to do with it being forward-declared?). Investing more work and complexity into fixing that didn't seem worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explained in comment
This reverts commit ca5df76.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bold attempt. But it is getting stuff wrong and the need for "Since" tags and "unnecessary" explicit naming will be high maintenance
@@ -31,6 +31,7 @@ namespace mir | |||
* Note the reason parameter is a simple char* so its value is clearly visible | |||
* in stack trace output. | |||
* \remark There is no attempt to make this thread-safe, if it needs to be changed | |||
* \remark Since MirCore 0.25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want (nor should we need) "Since" annotations that date from before the current major version/SONAME.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly are you suggesting? Are you saying you prefer the current system of maintaining a separate file with symbols, or do you just want a different type of in-code annotation?
This PR comes out of discussions with RAOF where we concluded keeping export info alongside the symbols in the code would be nicer than in a separate file (in which case, all exported functions need to be annotated somehow). I suppose the generator could read a symbols.map file and leave previous stanzas as-is, but I like the idea of the generator being a pure function from source code to symbols.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems the script could take a “what is the MirAL SOVER” parameter, and use that as the version for all symbols either without “Since” annotations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's less about the version, and more about knowing which symbols to export at all. If the version seems like clutter we could make a different annotation that doesn't include the version but still marks them for export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's less about the version, and more about knowing which symbols to export at all. If the version seems like clutter we could make a different annotation that doesn't include the version but still marks them for export.
It isn't obvious why annotations are required, or even that they are a good, solution to this.
Symbols should be exported if they are:
- Declared in a public header;
- Accessible (i.e. namespace scope, public/protected static members, public/protected member functions);
- Not inline, nor template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, yeah. That's a nice approach!
There's the chance with 3. that they do need to be exported, but that's only for weird scenarios (eg: where something takes the address of the function) and I don't think we rely on any of that behaviour.
It seems that Doxygen collects that information, how hard would it be to use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not very, that's used in regenerate-miral-symbols-map.py
already
debian/libmiral4.symbols
Outdated
(c++)"miral::WaylandExtensions::Context::Context()@MIRAL_3.6" 3.6.0 | ||
(c++)"miral::WaylandExtensions::Context::~Context()@MIRAL_3.6" 3.6.0 | ||
(c++)"vtable for miral::WaylandExtensions::Context@MIRAL_3.6" 3.6.0 | ||
(c++)"typeinfo for miral::WaylandExtensions::Context@MIRAL_3.6" 3.6.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. WaylandExtensions::Context
comes from MIRAL_2.5 - so it belongs in the 3.0 stanza
auto create_workspace() -> std::shared_ptr<Workspace>; | ||
auto create_workspace() -> std::shared_ptr<miral::Workspace>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not looked at fixing this, but I'm not a fan of adding noise to code where it isn't necessary (except for deficiencies in this toolchain).
src/miral/symbols.map
Outdated
vtable?for?miral::WindowSpecification::AspectRatio; | ||
vtable?for?miral::X11Support; | ||
vtable?for?miral::Zone; | ||
"::SetApplicationAuthorizer(typename..., Args const&...)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong: template<typename Policy> class SetApplicationAuthorizer
is in namespace miral
, and templates don't export symbols unless instantiated.
Ah, looks like we're not building the docs in CI. We need to do that for the test to pass. |
@wmww should this go on? |
Lets try CI again so I can look at some logs. |
I think it's worth doing, bug it needs a rework based on feedback. Haven't gotten back to that yet. |
Superseded by: |
WIP attempt to auto-generate symbols.map and debian/*.symbols files based on doxygen data. Only file it tries to generate so far is miral/symbols.map, and that isn't complete enough to work yet.