-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MSWin] win32/GNUmakefile CFLAGS needs "-Wno-error=implicit-function-declaration" if building perl with gcc-14.1.0 #22211
Comments
It seems like we should be fixing the use of implicit function declarations, not trying to ignore it. |
Yeah, we had a similar issue before on Mac and ignoring these errors gave problems later on. |
The "isnanl" warning has been around ever since -Duselongdouble builds were enabled for Windows (about 10 years ago), and we've been ignoring it for all that time.
Does that inclusion of math.h needs to be made conditional on something ? If so, conditional on what ? The POSIX warnings have also been around for a long time:
That one goes away if the offending occurrence of But the warnings given in relation to the bessel functions such as the following one (and other similar ones) has me stumped for the moment:
I haven't yet discovered what needs to be done in order to silence that one. |
The
But if I add
Any thoughts on how best to suppress those warnings without removing UPDATE: I've just noticed that, with the |
I suspect we should just be using You're getting rubbish from j0() because without the prototype the The putenv() code isn't actually called to my knowledge, switching win32 from emulating putenv to emulating setenv is on my tuit list (complicated by implicit sys). Is your gcc UCRT or MSVCRT? |
Is there a good reason to avoid using
Is there a fix for that ? My gcc is UCRT (with MCF threads), |
The fix is writing code in the C programming language. Implicit function declarations are not, as it turns out, the C programming language. Well. It's valid K&R C. But in c99 this was made illegal and declared invalid, without a deprecation period. A notable move for a language that doesn't even like to deprecate things! To go right to deleting it! The problem is, as observed, that you're using a function that has a return type (in a header file!) and asking the compiler to generate code without the header file to tell it what code to generate. In K&R C, it was allowable to say "I know from outside context that it returns an int, and I solemnly swear on my mother's grave that I am willing to have demons fly out of my nostrils if it turns out I was mistaken. Please don't warn me that I might have made a judgment error". The correct solution is invariably to simply include the headers that you make use of. There are no downsides to including the headers that you make use of. Sometimes the answer is to include your own function prototypes, though. GCC 14 and clang 16 finally caught up to the standard 25 years after the fact: rather than live in fear of C programmers saying "a compiler update made my code stop building, it must be a bug in the compiler" and simply allowing invalid C code, it is now a default error to try to compile invalid C code. This is a desperately needed fix, because it was always Undefined Behavior (even on GCC 13) which means even if the function actually was an int function the compiler is still allowed to do nasal demons, and compilers are increasingly good at optimizing your code by assuming UB can't exist through a variety of clever mechanisms including making blocks of code a no-op and generating zero machine code for parts of your program. This is not cosmetic, not even for GCC 13. It is buggy and prone to both crashing and succeeding-but-with-incorrect-answers, and you cannot predict when it will do either one, but the chances go way up when building with optimizations of any sort, or when compiling for platforms other than i686/amd64, or when upgrading to new compilers. The compiler is telling you the code has always had UB errors in it -- please don't solve that by telling it not to warn you about UB. If you do, though, then please add a configure error stating that the code only builds on i686/amd64, and enforce that the code is always built with -O0, as this will greatly reduce (but not eliminate) the likelihood of things going wrong. |
I don't believe I've suggested in this thread that any warnings be suppressed. I think I have a patch for POSIX.xs that fixes these issues, but I'll spend some time testing it before posting it here (later today). |
If you have problems finding the time for this, post here and I'll work on a patch. |
Time's not really an issue for me .... can't say the same for "programming capability", unfortunately. I have managed to get POSIX.xs to build without any need to mess with the flags, using the following patch.
That, along with my original proposed patch to perl.h (re As a test of the bessel functions on those patched perls I simply ran the following script which checks for "ballpark" results:
That test script is fine on the patched 5.39.10, as it is also on 5.38.0.
I think a test script that performs some tests on the bessel functions should be added to ext/POSIX/t. As I said at the start of this post, I generally have plenty of time, and running tests is something that I'll happily do. |
Description
The mingw-w64 ports of gcc-14.1.0 currently available from https://winlibs.com turn "implicit declaration of function..." warnings into fatal errors.
This prevents ext/POSIX from building on all configurations.
It also stops -Duselongdouble builds at a very early stage because of an implicit function declaration (of
isnanl
) in sv.c.Both of those failings can be addressed in win32/GNUmakefile by replacing:
I'll make a PR for that in the next devel cycle, unless there's a better idea.
The text was updated successfully, but these errors were encountered: