Skip to content

Fix configure function checks for recent clang versions - #1347

Merged
flyingmutant merged 1 commit into
cmus:masterfrom
pgaskin:configure-fn-check
Sep 8, 2024
Merged

flyingmutant merged 1 commit into
cmus:masterfrom
pgaskin:configure-fn-check

Conversation

@pgaskin

@pgaskin pgaskin commented Aug 6, 2024

Copy link
Copy Markdown
Member

Simply try taking the address of the function instead of doing funny stuff with the pointer.

Simply try taking the address of the function instead of doing funny
stuff with the pointer which clang doesn't like anymore.

This works with `-std=c89 -pendantic` and anything more permissive. On
recent versions of clang works while producing -Wstrict-prototypes due
to function declaration without a prototype being deprecated).
@pgaskin
pgaskin force-pushed the configure-fn-check branch from 55943ef to 3de76fa Compare August 6, 2024 01:35

@pgaskin pgaskin left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Tested on multiple compiler versions with and without strict and/or pedantic C89+, with existent and non-existent functions.

@pgaskin

pgaskin commented Aug 6, 2024 •

Copy link
Copy Markdown
Member Author

@pgaskin

pgaskin commented Sep 2, 2024

Copy link
Copy Markdown
Member Author

@flyingmutant

@gavtroy gavtroy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks okay. It might also have been enough to void *x = (void*) &$1; rather than using a function pointer signature.

@pgaskin

pgaskin commented Sep 3, 2024

Copy link
Copy Markdown
Member Author

That results in a warning in some configurations (and an error if the compiler is configured to be strict) @gavtroy.

@flyingmutant
flyingmutant merged commit 6f994b5 into cmus:master Sep 8, 2024
@flyingmutant

Copy link
Copy Markdown
Member

Thanks! Merged.

@pgaskin
pgaskin deleted the configure-fn-check branch September 11, 2024 15: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.

3 participants