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

Feature extern c #183

Merged
merged 6 commits into from
May 17, 2024
Merged

Feature extern c #183

merged 6 commits into from
May 17, 2024

Conversation

cburstedde
Copy link
Owner

Set C linkage for hack prototype

Following up on issue #179.

Proposed changes: Make the prototype of sc_extern_c_hack_2 have C linkage, which allows to use the same names of the hack functions for both C and C++. Hopefully this avoids the warning with Clang. (Wondering why Clang would complain about declaring an unused prototype in a header, which is what headers do.)

For completeness, also implement the two dummy functions even though they are never called from the code.

We declare dummy prototypes to cater to the needs of GNU indent
when it encounters our SC_EXTERN_C_BEGIN macros plus a semicolon,
and likewise for SC_EXTERN_C_END.  To make sure the semicolon is
not semantically superfluous, we add said prototypes.

These are now made the same for both C and C++ compile of libsc.
We had previously only provided the prototype for the function
hack to work around the needs of GNU indent.  Now adding the code.
@cburstedde cburstedde changed the base branch from master to develop May 13, 2024 10:15
@cburstedde
Copy link
Owner Author

Pinging @dutkalex for checking this with clang-17, if you like.

@dutkalex
Copy link
Contributor

Pinging @dutkalex for checking this with clang-17, if you like.

Looks good! No more warnings :)

@cburstedde cburstedde merged commit 164b57f into develop May 17, 2024
36 checks passed
@cburstedde cburstedde deleted the feature-extern-c branch May 17, 2024 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants