In curl 7.88.1, wrapping curl_easy_setopt in macro is broken when compiling with GCC <12.1 #10726
I did this
Our project is currently using GCC 10.3 and as far as I know, this should be supported by curl 7.88.1. However, upon trying to upgrade curl from 7.86.0 to 7.88.1 we get some compilation errors in our existing code. The issue is known and appears to be fixed in GCC 12.1;
This is a rough simplification of what our code looks like, and a highly simplified version of the current logic within curl 7.88:
Please try this code snippet out on godbolt.org under GCC < 12.1 The compiler output should look something like this:
And the preprocessor output should look something like this:
Compilation will fail on every macro wrapping
If you try this same code block with >=12.1 the #pragmas are correctly placed and compilation is fine.
I expected the following
libcurl macros need to be rewritten to handle this case for GCC < 12.1
Proprietary platform, however this is a compilation issue so that shouldn't matter.
The text was updated successfully, but these errors were encountered:
I tried your code with gcc 9.3 and I confirm.
Possible caller's workarounds using the current curl code base are:
On curl's side, I don's see any possible workaround. We'll probably need to raise the conditioning gcc version again :-( This is a pity: gcc 12.1 is only 10 month old.
Thanks for your prompt response, I'll forward to the team that there are no plans for curl to handle the GCC bug. I too quickly tried a few tricks to try to get the #pragma directives to be correctly placed and I couldn't get it working.
Looks like pushing for GCC update is the best solution.
All the best.
Reported-by: kchow-FTNT on github Fixes #10726