Skip to content

8.19.0 breaks compilation with ancient GCC (eg GCC 4.2) #20892

@fds242

Description

@fds242

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions