Skip to content

Fix compilation with GCC 15 - #55

Merged
mdavidsaver merged 1 commit into
epics-base:masterfrom
minijackson:typed-dset-drvet
Jul 24, 2026
Merged

mdavidsaver merged 1 commit into
epics-base:masterfrom
minijackson:typed-dset-drvet

Conversation

@minijackson

Copy link
Copy Markdown
Contributor

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 the default in 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.

I'm personally confused as to why the non-typed dset and drvet didn't declare their arguments (and dset only for C, not C++). Maybe epics-base should be fixed and have a void* added?

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
@mdavidsaver

Copy link
Copy Markdown
Member

I'm personally confused as to why the non-typed dset and drvet didn't declare their arguments

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!

@mdavidsaver
mdavidsaver merged commit d0ed25c into epics-base:master Jul 24, 2026
24 checks passed
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