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

Only use __attribute__((constructor)) if supported #66

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

bgilbert
Copy link
Collaborator

@bgilbert bgilbert commented Oct 3, 2023

The HAS_CONSTRUCTOR check didn't do anything, since we tried to use __attribute__((constructor)) whether it was defined or not. That caused a build failure on MSVC.

Also, we shouldn't add the constructor attribute from a public header, since it's only relevant while building the library, and is conditioned on a config.h macro that isn't visible outside the library. Move constructor handling directly to the one call site that needs it.

While we're here, simplify the constructor support check in meson.build.

The HAS_CONSTRUCTOR check didn't do anything, since we tried to use
__attribute__((constructor)) whether it was defined or not.  That caused
a build failure on MSVC.

Also, we shouldn't add the constructor attribute from a public header,
since it's only relevant while building the library, and is conditioned
on a config.h macro that isn't visible outside the library.  Move
constructor handling directly to the one call site that needs it.
Copy link
Collaborator

@jcupitt jcupitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jcupitt jcupitt merged commit d7877f7 into ImagingDataCommons:main Oct 3, 2023
4 checks passed
@bgilbert bgilbert deleted the ctor branch October 3, 2023 14:39
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