Fix compilation with GCC 15 - #55
Merged
Merged
Conversation
This adds the -DUSE_TYPED_DSET and -DUSE_TYPED_DRVET definitions to the build, which fixes some compilation errors showing: - `too many arguments to function ‘pdset->init’; expected 0, have 1` - `too many arguments to function ‘pdrvet->report’; expected 0, have 1` This is because non-typed dset and drvet's member functions for C are declared as `typedef long (*)()` which changed meaning in C23, which is now enabled by default since GCC 15 ; see the [Function declarations without parameters] GCC porting guide. The typed variant of dset and drvet don't have these kinds of declarations, which fixes the build. [Function declarations without parameters]: https://gcc.gnu.org/gcc-15/porting_to.html#c23-fn-decls-without-parameters
Member
Because the original K&R C syntax did not require it. epics-base has been slowly migrating to standard/ANSI syntax for oh, about 30 years. These function pointer declarations are the last remnants. eg. 7fccc59 int main(argc, argv)
int argc;
char **argv;
{This was legal syntax! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the
-DUSE_TYPED_DSETand-DUSE_TYPED_DRVETdefinitions to the build, which fixes some compilation errors showing:too many arguments to function ‘pdset->init’; expected 0, have 1too many arguments to function ‘pdrvet->report’; expected 0, have 1This is because non-typed
dsetanddrvet's member functions for C are declared astypedef long (*)()which changed meaning in C23, which is the default in GCC 15+ ; see the Function declarations without parameters GCC porting guide.The typed variant of
dsetanddrvetdon't have these kinds of declarations, which fixes the build.I'm personally confused as to why the non-typed
dsetanddrvetdidn't declare their arguments (anddsetonly for C, not C++). Maybe epics-base should be fixed and have avoid*added?