Skip to content

Fix linking to strong enum values from tagfiles if they're inside a class or namespace #11137

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mosra
Copy link
Contributor

@mosra mosra commented Sep 12, 2024

The refactor in 35711f2 (part of 1.9.5) lost this particular bit, causing the code to be only able to link to enum values from tagfiles where the enum was in global scope, not in any subnamespace.

Expanded the strong enums test with various possible combinations to ensure this doesn't regress again. In particular, without the change in doxygen.cpp, the following warnings are produced:

doxygen/testing/058_strong_enum.cpp:40: warning: unable to resolve reference to 'external::ns::Enum1::Flag' for \ref command
doxygen/testing/058_strong_enum.cpp:44: warning: unable to resolve reference to 'external::ns::Class::Enum2::Flag' for \ref command
doxygen/testing/058_strong_enum.cpp:48: warning: unable to resolve reference to 'ExternalClass::Enum1::Flag' for \ref command

In particular, linking to the enum did work, but to its values not, only if the enum itself was in global scope. The tagfile is hand-crafted to make visual verification of the XML output easier, hopefully there aren't any serious errors.

For some reason the CI test doesn't want to pick up the referenced tagfile, not sure why... Also, If I'm abusing a wrong test case for this, let me know -- I can separate that into a new one.

Note: I did not handle the case of linking to weak enum values by prefixing them with the enum, i.e. @ref WeakEnum::WeakEnumFlag, @ref ExternalWeakEnum::ExternalWeakEnumFlag etc. For locally defined enums this works, but for the tagfile it doesn't, as the tagfile doesn't preserve any relation between the enum and the value. (And to my knowledge it never did.) Which means it isn't really a regression that needs a fix, and I'm fine with this part not working.

@mosra mosra force-pushed the tagfile-namespace-enum-links branch from 94a6e1d to b0c21b0 Compare September 12, 2024 22:31
The refactor in 35711f2 lost this
particular bit, causing the code to be only able to link to enum values
from tagfiles where the enum was in global scope, not in any
subnamespace.

Expanded the strong enums test with various possible combinations to
ensure this doesn't regress again.
@mosra mosra force-pushed the tagfile-namespace-enum-links branch from b0c21b0 to 7560c15 Compare September 12, 2024 22:46
@doxygen
Copy link
Owner

doxygen commented Sep 15, 2024

@mosra Not clear why the CI pipeline fails to find the tag file. Needs further debugging. Maybe you can remove the part of the example that depends on it for now, if you want the pull request to be merged already.

@mosra
Copy link
Contributor Author

mosra commented Sep 15, 2024

I'll extract the tests to a dedicated file to make them simpler (in retrospect that's what I should have done initially, the original test verifies something else entirely), and will attempt some more debugging on my end.

But I feel like there should be at least one such test for the tagfiles, because from my past experience this is an area that's prone to easy breakage. So I'll try to do my best to make that work, and only if I fail I reduce it to just that two-line change :)

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.

2 participants