Closed tdhock closed 1 month ago
I've been ignoring this particular warning. It's explicitly noted in Complex.h:
And yes I think it comes from -std=c99
. As to that... it's been there since #2488. Before that it was -std=gnu99
. That was documented as being done to reveal some issue:
https://github.com/Rdatatable/data.table/pull/2488/commits/98aa9d1b296c46a6ba77d93967e5e3d3fd9cf266
I agree it seems odd to have competing compilation options. If anything, maybe we should have different GHA testing "unusual" compiler setups.
Looking a bit further:
https://g.co/gemini/share/e7f3ab7b9f5a https://gcc.gnu.org/onlinedocs/gcc/Standards.html https://cran.r-project.org/doc/manuals/r-release/R-exts.html https://www.reddit.com/r/C_Programming/comments/7g7rol/what_std_do_you_use_with_gcc/ https://clang.llvm.org/c_status.html
std=
we should supportgcc
will default to -std=gnu17
if we simply drop -std=
from the options. I don't see what clang
's default is.-std=c11
still only has "partial" support in gcc
and clang
, but I doubt it will affect us.Specifying c11
or a higher standard should remove that warning.
I don't see what
clang
's default is.
Looks like gnu11
(or c11
with GNU extensions) on my Windows laptop:
clang -dM -E - < NUL | find "__STDC_VERSION__"
#define __STDC_VERSION__ 201112L
Off-topic but for comparison, clang
(or rather Apple Clang) is gnu17
on my Mac:
clang -dM -E - < /dev/null | grep __STDC_VERSION__
#define __STDC_VERSION__ 201710L
related to #6466 and #6468 which I observe also.
on windows using gcc/rtools44 I see no warning when compiling reorder.c (for example, other are affected too)
with cc(), I see a warning:
The different/unique compiler flags are:
I guess the issue comes from using -std=c99, I wonder if we can remove that? more generally, why are the cc() compiler flags so different from the R CMD INSTALL compiler flags? is that desirable for us for some reason? (If there is no strong reason for the difference, I would suggest changing cc flags to match R CMD INSTALL flags)