Skip to content

Build failure with GCC 15: custom_getenv declared with empty parameter list, incompatible with C23 #141

@SamHerts

Description

@SamHerts

Building Spindle with GCC 15 fails in src/utils/parseloc.c when compiling the SLURM plugin

../../src/utils/parseloc.c: In function 'parse_location_impl':
../../src/utils/parseloc.c:106:25: error: too many arguments to function 'custom_getenv'; expected 0, have 1
  106 |             env_value = custom_getenv(envvar);
      |                         ^~~~~~~~~~~~~ ~~~~~~
../../src/utils/parseloc.c:46:14: note: declared here
   46 | extern char *custom_getenv();
      |              ^~~~~~~~~~~~~

Root Cause:

parseloc declares custom_getenv with an empty parameter list:

extern char *custom_getenv();

while the actual definition in src/slurm_plugin/slurm_plugin has always taken one argument:

char *custom_getenv(char *envname)
{
return readSpankEnv(current_spank, envname);
}

C Reference denotes the empty parameter list is obsolete in c23, GNU Reference calls it bad practice.

Suggested fix

Update the declaration in src/utils/parseloc.c:46 to match the slurm plugin definition:

extern char *custom_getenv(char *envname);

Environment

  • Spindle: devel branch (commit 4174224)
  • OS: Rocky Linux 10.1 (Red Quartz)
  • Compiler: GCC 15 (gnu15 toolchain)
  • Affected files: src/utils/parseloc.c:46, src/slurm_plugin/slurm_plugin.c:509

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions