8.19.0 breaks compilation with ancient GCC (eg GCC 4.2) · Issue #20892 · curl/curl · GitHub
Skip to content You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert 8.19.0 breaks compilation with ancient GCC (eg GCC 4.2) #20892 New issue Copy link New issue Copy link Closed Closed 8.19.0 breaks compilation with ancient GCC (eg GCC 4.2) #20892 Copy link Labels build Description fds242 opened on Mar 11, 2026 Issue body actions I did this 3 source files in 8.19.0 got added #pragma GCC diagnostic push #pragma GCC diagnostic ignored … directives, only wrapping it in a basic check for __GNUC__ .
This breaks compilation in ancient versions of GCC with an error of #pragma GCC diagnostic not allowed inside functions . It isn't clear to me from past issues like #16062 or #16152 on what was ultimately decided on supporting such old compilers. I'm filing this issue then since: those previous issues were corrected curl is a stickler for requiring nothing newer than C89, and even GCC 4.2 was a C99-capable compiler simple enough, if wordy, to extend the check for the correct version: (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) The newly affected files in 8.19.0: lib/mprintf.c inside function out_double() src/tool_cb_prg.c inside function tool_progress_cb() src/tool_writeout.c inside function outtime() I expected the following No response curl/libcurl version curl 8.19.0 operating system n/a Reacted by Vasiliy-Kkk Activity bagder added build on Mar 11, 2026 bagder commented on Mar 11, 2026 bagder on Mar 11, 2026 Member More actions Why do we care about ancient gcc?
Reacted by Viktor Szakats vszakats commented on Mar 12, 2026 vszakats on Mar 12, 2026 Member More actions Earlier attempts were driven by Windows CE with gcc 4.4 its latest. With it gone, the oldest version in CI is 4.8.1 (paired with mingw-w64 3) and 6.3.0 on old linux. Things without CI tests tend to decay. Keeping compatibility is more complicated than extending guards: these warnings then need to be disabled globally in these cases, in autotools and cmake.
Possibly more, because these ancient versions also do not support push/pop. It's not impossible to support ancient gcc (also present in tests via CURL_GNUC_DIAG , and constraining an example), but unfun to spend effort on, esp. without tests. Drawing the line at 4.8.1 (2013-03-22) may be a reasonable compromise IMO. Reacted by Stefan Eissing and Daniel Stenberg bagder commented on Mar 12, 2026 bagder on Mar 12, 2026 Member More actions Drawing the line at 4.8.1 (2013-03-22) may be a reasonable compromise IMO.
Sounds good to me. We could add that in the INTERNALS.md list. fds242 commented on Mar 12, 2026 fds242 on Mar 12, 2026 Author More actions Documenting a minimum version of GCC, even a much more recent one than 4.8.1, is of course eminently reasonable, and will be perfectly sufficient for me to know not to file related issues, and keep my patches local. There's only the funny dichotomy to state that curl, while only requiring a C89 compiler, in practice requires at least GCC 4.8, a C11 compiler. (A C11 compiler already is required by important dependencies such as ngtcp2.) I must say though that the average user does not wear CI-colored glasses or compile with -Werror enabled, and as such, consider compiler warnings quite harmless, and easily ignored.
In that sense then, it really is sufficient not to squelch the warning, and simply extend the ifdef guard. A modicum of support – warnings but no errors – for the ancient compiler would be more than enough! It really is way too much effort to devise a way to actually silence the warning everywhere. [My interest here is retro computing, and long abandoned PowerPC Macs. The very last compiler Apple provided that could target these systems happens to be GCC 4.2.1.
Mainline GCC, including the current GCC 15.2, also continues to support these systems. There remains however a significant practical divide between software that is compilable with the final Apple-provided GCC and those that absolutely need a modern compiler . Particularly for various package managers that attempt to locally build everything, it is very desirable to have some basic, foundational packages that could be built before having new tools.] fds242 closed this as completed on Mar 12, 2026 bagder commented on Mar 12, 2026 bagder on Mar 12, 2026 Member More actions There's only the funny dichotomy to state that curl, while only requiring a C89 compiler, in practice requires at least GCC 4.8, a C11 compiler curl builds fine with lots of other compilers as well. vszakats added a commit that references this issue on Mar 18, 2026 gcc: guard `#pragma diagnostic` in core code for <4.6, disable picky … This issue will close once commit 578ee6b is merged into the 'master' branch.
578ee6b outcast36 added a commit that references this issue on Jun 3, 2026 gcc: guard `#pragma diagnostic` in core code for <4.6, disable picky … This issue will close once commit 749ee41 is merged into the 'master' branch. 749ee41 Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment Metadata Metadata Assignees No one assigned Labels build Type No type Projects No projects Milestone No milestone Relationships None yet Development No branches or pull requests Issue actions You can’t perform that action at this time.