KineticPreProcessor / KPP

The KPP kinetic preprocessor is a software tool that assists the computer simulation of chemical kinetic systems
GNU General Public License v3.0
19 stars 11 forks source link

Warnings generated when compiling KPP with gcc 13 #102

Closed yantosca closed 1 month ago

yantosca commented 1 month ago

Report a bug or issue with KPP:

When compiling KPP on MacOSX with gcc 13, we get these warnings:

gcc -g -Wall -Wno-unused-function -I/usr/include -c code_f90.c
code_f90.c:319:5: warning: variable 'nlines' set but not used [-Wunused-but-set-variable]
int nlines;
    ^
1 warning generated.
gcc -g -Wall -Wno-unused-function -I/usr/include -c code_matlab.c
code_matlab.c:262:5: warning: variable 'nlines' set but not used [-Wunused-but-set-variable]
int nlines;
    ^
1 warning generated.
gcc -g -Wall -Wno-unused-function -I/usr/include -c debug.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c gen.c
gen.c:3494:25: warning: passing arguments to 'Use_F' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
    case F77_LANG: Use_F( rootFileName );
                        ^
gen.c:3496:27: warning: passing arguments to 'Use_F90' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
    case F90_LANG: Use_F90( rootFileName );
                          ^
gen.c:3498:23: warning: passing arguments to 'Use_C' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
    case C_LANG: Use_C( rootFileName );
                      ^
gen.c:3500:33: warning: passing arguments to 'Use_MATLAB' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
    case MATLAB_LANG: Use_MATLAB( rootFileName );

4 warnings generated.
gcc -g -Wall -Wno-unused-function -I/usr/include -c kpp.c
kpp.c:597:11: warning: passing arguments to 'Generate' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  Generate( rootFileName );
          ^

I suspect it has to do that we are passing rootFileName to various C routines but the function prototype for these routines do not have the rootFileName argument:

code.h:190:void Use_C();
code.h:191:void Use_F();
code.h:192:void Use_F90();
code.h:193:void Use_MATLAB();
gdata.h:260:void Generate();

I think this is due to stricter parsing of the source code in GCC 13.

Version:

$ gcc --version
gcc-13 (Homebrew GCC 13.2.0) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

We could try adding rootFileName to the function prototypes and see if it clears the error.

yantosca commented 1 month ago

We can close this issue now that PR #103 is merged.