thibautjombart / adegenet

adegenet: a R package for the multivariate analysis of genetic markers
165 stars 64 forks source link

failing CRAN check in C23 mode #341

Closed zkamvar closed 1 year ago

zkamvar commented 1 year ago

See https://www.stats.ox.ac.uk/pub/bdr/C23/, including the README.txt

Packages

 IRon ManlyMix MatManlyMix Rbeast SiMRiv TSP adegenet cubature earth
 forecast gap groupedSurv locfit mcr nfer ordinalgmifs phangorn
 pomdpSolve rmumps robets seriation tth

fail to install when LLVM clang >= 15 is used in C23 mode. The most common problem is that false, true and bool have become reserved words ('Writing R Extensions' has been warning about this).

For ManlyMix MatManlyMix you are redeclaring system functions with incorrect parameter lists: sqrt() is the same as sqrt(void) in C23. Just use !

K&R-style declarations are an error in C23 (seen in locfit and tth).

The same issues are seen with gcc trunk (but not 12.2) in C23 mode.

Please correct before 2023-01-24 to safely retain your package on CRAN (some may have earlier deadlines already). (CRAN submissions are shut until 2023-01-06.)

zkamvar commented 1 year ago

Here are the logged errors:

* installing *source* package ‘adegenet’ ...
** package ‘adegenet’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘clang version 16.0.0 (https://github.com/llvm/llvm-project.git 6c295a932d26681f07037d7289df405e36350dd4)’
make[1]: Entering directory '/data/gannet/ripley/R/packages/tests-clang-trunk/adegenet/src'
/usr/local/clang-trunk/bin/clang -std=gnu2x -I"/data/gannet/ripley/R/R-clang-trunk/include" -DNDEBUG   -I/usr/local/include    -fpic  -O3 -Wall -pedantic -Werror=implicit-function-declaration -Wstrict-prototypes  -c GLfunctions.c -o GLfunctions.o
/usr/local/clang-trunk/bin/clang -std=gnu2x -I"/data/gannet/ripley/R/R-clang-trunk/include" -DNDEBUG   -I/usr/local/include    -fpic  -O3 -Wall -pedantic -Werror=implicit-function-declaration -Wstrict-prototypes  -c adesub.c -o adesub.o
/usr/local/clang-trunk/bin/clang -std=gnu2x -I"/data/gannet/ripley/R/R-clang-trunk/include" -DNDEBUG   -I/usr/local/include    -fpic  -O3 -Wall -pedantic -Werror=implicit-function-declaration -Wstrict-prototypes  -c init.c -o init.o
/usr/local/clang-trunk/bin/clang -std=gnu2x -I"/data/gannet/ripley/R/R-clang-trunk/include" -DNDEBUG   -I/usr/local/include    -fpic  -O3 -Wall -pedantic -Werror=implicit-function-declaration -Wstrict-prototypes  -c monmonier-utils.c -o monmonier-utils.o
In file included from GLfunctions.c:17:
./snpbin.h:12:9: error: 'short bool' is invalid
typedef short bool;
        ^
./snpbin.h:12:1: warning: typedef requires a name [-Wmissing-declarations]
typedef short bool;
^~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
make[1]: *** [/data/gannet/ripley/R/R-clang-trunk/etc/Makeconf:180: GLfunctions.o] Error 1
/usr/local/clang-trunk/bin/clang -std=gnu2x -I"/data/gannet/ripley/R/R-clang-trunk/include" -DNDEBUG   -I/usr/local/include    -fpic  -O3 -Wall -pedantic -Werror=implicit-function-declaration -Wstrict-prototypes  -c sharedAll.c -o sharedAll.o
/usr/local/clang-trunk/bin/clang -std=gnu2x -I"/data/gannet/ripley/R/R-clang-trunk/include" -DNDEBUG   -I/usr/local/include    -fpic  -O3 -Wall -pedantic -Werror=implicit-function-declaration -Wstrict-prototypes  -c snpbin.c -o snpbin.o
monmonier-utils.c:40:29: error: expected ';' after enum
typedef enum { FALSE, TRUE } bool;
                            ^
                            ;
monmonier-utils.c:40:1: warning: typedef requires a name [-Wmissing-declarations]
typedef enum { FALSE, TRUE } bool;
^~~~~~~
monmonier-utils.c:40:30: warning: declaration does not declare anything [-Wmissing-declarations]
typedef enum { FALSE, TRUE } bool;
                             ^~~~
adesub.c:479:15: warning: unused variable 'seed' [-Wunused-variable]
    int i, n, seed;
              ^
2 warnings and 1 error generated.
make[1]: *** [/data/gannet/ripley/R/R-clang-trunk/etc/Makeconf:180: monmonier-utils.o] Error 1
In file included from snpbin.c:29:
./snpbin.h:12:9: error: 'short bool' is invalid
typedef short bool;
        ^
./snpbin.h:12:1: warning: typedef requires a name [-Wmissing-declarations]
typedef short bool;
^~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
make[1]: *** [/data/gannet/ripley/R/R-clang-trunk/etc/Makeconf:180: snpbin.o] Error 1
1 warning generated.
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/data/gannet/ripley/R/packages/tests-clang-trunk/adegenet/src'
ERROR: compilation failed for package ‘adegenet’
* removing ‘/data/gannet/ripley/R/packages/tests-clang-trunk/adegenet.Rcheck/adegenet’
zkamvar commented 1 year ago

I'm attempting to fix this by using #include <stdbool.c>