Navigation Menu

Skip to content
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

Azure DevOps shows GCC 10 compilation errors due to type mismatch between curl_off_t typeof and format #6079

Closed
mback2k opened this issue Oct 14, 2020 · 7 comments
Labels
build CI Continuous Integration Windows Windows-specific

Comments

@mback2k
Copy link
Member

mback2k commented Oct 14, 2020

I did this

#5891 tried to fix this previously as I spotted this locally. Now that GCC 10 is also being used in the MSYS2 based Azure DevOps builds, we are bitten by this again in CI:

Logs taken from 32-bit and 64-bit builds of today's release:

2020-10-14T09:24:38.3859321Z tool_filetime.c: In function 'setfiletime':
2020-10-14T09:24:38.3860145Z tool_filetime.c:106:15: error: ISO C does not support the 'I' printf flag [-Werror=format=]
2020-10-14T09:24:38.3860990Z   106 |               "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
2020-10-14T09:24:38.3862159Z       |               ^~~~~~~~~~~~~~~~~~~~~~~~~~
2020-10-14T09:24:38.3863740Z tool_filetime.c:106:15: error: format '%d' expects argument of type 'int', but argument 3 has type 'curl_off_t' {aka 'long long int'} [-Werror=format=]
2020-10-14T09:24:38.3864867Z In file included from ../include/curl/curl.h:38,
2020-10-14T09:24:38.3865679Z                  from ../lib/curl_setup.h:152,
2020-10-14T09:24:38.3866111Z                  from tool_setup.h:36,
2020-10-14T09:24:38.3866514Z                  from tool_filetime.h:24,
2020-10-14T09:24:38.3866881Z                  from tool_filetime.c:22:
2020-10-14T09:24:38.3867258Z ../include/curl/system.h:199:42: note: format string is defined here
2020-10-14T09:24:38.3867656Z   199 | #  define CURL_FORMAT_CURL_OFF_T     "I64d"
2020-10-14T09:24:38.3868391Z tool_filetime.c:125:17: error: ISO C does not support the 'I' printf flag [-Werror=format=]
2020-10-14T09:24:38.3868916Z   125 |                 "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
2020-10-14T09:24:38.3869346Z       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
2020-10-14T09:24:38.3870193Z tool_filetime.c:125:17: error: format '%d' expects argument of type 'int', but argument 3 has type 'curl_off_t' {aka 'long long int'} [-Werror=format=]
2020-10-14T09:24:38.3870895Z In file included from ../include/curl/curl.h:38,
2020-10-14T09:24:38.3871413Z                  from ../lib/curl_setup.h:152,
2020-10-14T09:24:38.3871932Z                  from tool_setup.h:36,
2020-10-14T09:24:38.3872287Z                  from tool_filetime.h:24,
2020-10-14T09:24:38.3872668Z                  from tool_filetime.c:22:
2020-10-14T09:24:38.3873427Z ../include/curl/system.h:199:42: note: format string is defined here
2020-10-14T09:24:38.3873985Z   199 | #  define CURL_FORMAT_CURL_OFF_T     "I64d"
2020-10-14T09:24:38.3874407Z tool_filetime.c:133:15: error: ISO C does not support the 'I' printf flag [-Werror=format=]
2020-10-14T09:24:38.3874846Z   133 |               "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
2020-10-14T09:24:38.3875234Z       |               ^~~~~~~~~~~~~~~~~~~~~~~~~~
2020-10-14T09:24:38.3875731Z tool_filetime.c:133:15: error: format '%d' expects argument of type 'int', but argument 3 has type 'curl_off_t' {aka 'long long int'} [-Werror=format=]
2020-10-14T09:24:38.3876236Z In file included from ../include/curl/curl.h:38,
2020-10-14T09:24:38.3876588Z                  from ../lib/curl_setup.h:152,
2020-10-14T09:24:38.3876927Z                  from tool_setup.h:36,
2020-10-14T09:24:38.3877275Z                  from tool_filetime.h:24,
2020-10-14T09:24:38.3877615Z                  from tool_filetime.c:22:
2020-10-14T09:28:52.1275602Z tool_filetime.c: In function 'setfiletime':
2020-10-14T09:28:52.1276670Z tool_filetime.c:106:15: error: ISO C does not support the 'I' printf flag [-Werror=format=]
2020-10-14T09:28:52.1277949Z   106 |               "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
2020-10-14T09:28:52.1278863Z       |               ^~~~~~~~~~~~~~~~~~~~~~~~~~
2020-10-14T09:28:52.1280631Z tool_filetime.c:106:15: error: format '%d' expects argument of type 'int', but argument 3 has type 'curl_off_t' {aka 'long long int'} [-Werror=format=]
2020-10-14T09:28:52.1281620Z In file included from ../include/curl/curl.h:38,
2020-10-14T09:28:52.1282397Z                  from ../lib/curl_setup.h:152,
2020-10-14T09:28:52.1282945Z                  from tool_setup.h:36,
2020-10-14T09:28:52.1283792Z                  from tool_filetime.h:24,
2020-10-14T09:28:52.1284368Z                  from tool_filetime.c:22:
2020-10-14T09:28:52.1284920Z ../include/curl/system.h:199:42: note: format string is defined here
2020-10-14T09:28:52.1285409Z   199 | #  define CURL_FORMAT_CURL_OFF_T     "I64d"
2020-10-14T09:28:52.1286059Z tool_filetime.c:125:17: error: ISO C does not support the 'I' printf flag [-Werror=format=]
2020-10-14T09:28:52.1286627Z   125 |                 "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
2020-10-14T09:28:52.1287160Z       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
2020-10-14T09:28:52.1288135Z tool_filetime.c:125:17: error: format '%d' expects argument of type 'int', but argument 3 has type 'curl_off_t' {aka 'long long int'} [-Werror=format=]
2020-10-14T09:28:52.1288779Z In file included from ../include/curl/curl.h:38,
2020-10-14T09:28:52.1289263Z                  from ../lib/curl_setup.h:152,
2020-10-14T09:28:52.1289676Z                  from tool_setup.h:36,
2020-10-14T09:28:52.1290151Z                  from tool_filetime.h:24,
2020-10-14T09:28:52.1290580Z                  from tool_filetime.c:22:
2020-10-14T09:28:52.1291117Z ../include/curl/system.h:199:42: note: format string is defined here
2020-10-14T09:28:52.1291639Z   199 | #  define CURL_FORMAT_CURL_OFF_T     "I64d"
2020-10-14T09:28:52.1292167Z tool_filetime.c:133:15: error: ISO C does not support the 'I' printf flag [-Werror=format=]
2020-10-14T09:28:52.1292771Z   133 |               "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
2020-10-14T09:28:52.1293359Z       |               ^~~~~~~~~~~~~~~~~~~~~~~~~~
2020-10-14T09:28:52.1294375Z tool_filetime.c:133:15: error: format '%d' expects argument of type 'int', but argument 3 has type 'curl_off_t' {aka 'long long int'} [-Werror=format=]
2020-10-14T09:28:52.1295116Z In file included from ../include/curl/curl.h:38,
2020-10-14T09:28:52.1295549Z                  from ../lib/curl_setup.h:152,
2020-10-14T09:28:52.1296015Z                  from tool_setup.h:36,
2020-10-14T09:28:52.1296439Z                  from tool_filetime.h:24,
2020-10-14T09:28:52.1296959Z                  from tool_filetime.c:22:
2020-10-14T09:28:52.1297501Z ../include/curl/system.h:199:42: note: format string is defined here
2020-10-14T09:28:52.1297983Z   199 | #  define CURL_FORMAT_CURL_OFF_T     "I64d"
2020-10-14T09:28:52.1550855Z cc1.exe: all warnings being treated as errors
@bagder
Copy link
Member

bagder commented Oct 14, 2020

This confuses me.

We've used that formatting for mingw for decades and now suddenly they changed and no longer support that way of printf()ing ? Doesn't it that break like numerous apps?

If they changed, shouldn't we then adapt and instead switch mingw builds to use the "classic" printf() formatting?

If they didn't change, why does this warn on our code? Isn't this then a mingw/gcc bug? If it's a bug, shouldn't we try to just silence it with -Wno-format ?

@bagder bagder added build CI Continuous Integration labels Oct 14, 2020
@MarcelRaad MarcelRaad added the Windows Windows-specific label Oct 14, 2020
@MarcelRaad
Copy link
Member

MarcelRaad commented Oct 14, 2020

As I mentioned in #5891 (comment), I do believe this is a compiler bug and we do already suppress this warning. The suppression works in all other places.

@bagder
Copy link
Member

bagder commented Oct 14, 2020

So this log is shown even with -Wno-format used? Can you link an example build with this problem?

@bagder
Copy link
Member

bagder commented Oct 14, 2020

this build for example, shows this error but rather sets -Wformat=2...

bagder added a commit that referenced this issue Oct 14, 2020
With GCC 10 (at least) on mingw, we get false positive warnings
when using this option. Never use it for mingw.

Fixes #6079
@MarcelRaad
Copy link
Member

Right, what we do is specifically disable this warning with --wno-pedantic-ms-format instead of disabling all format warnings.

@bagder
Copy link
Member

bagder commented Oct 15, 2020

what we do is specifically disable this warning with --wno-pedantic-ms-format

Right, but since it clearly doesn't work here I think we need to level up a little! This take seems to work...

bagder added a commit that referenced this issue Oct 15, 2020
With GCC 10 (at least) on mingw, we get false positive warnings
when using this option. Never use it for mingw.

Fixes #6079
@bagder bagder closed this as completed in 7c88fe3 Oct 15, 2020
@mback2k
Copy link
Member Author

mback2k commented Oct 15, 2020

Thanks!

mback2k added a commit to mback2k/curl that referenced this issue Nov 1, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit to mback2k/curl that referenced this issue Nov 5, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit to mback2k/curl that referenced this issue Nov 5, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit to mback2k/curl that referenced this issue Nov 6, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit to mback2k/curl that referenced this issue Nov 6, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit to mback2k/curl that referenced this issue Nov 7, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.
Improve size_t to long conversion in imap-append.c example.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit to mback2k/curl that referenced this issue Nov 8, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.
Improve size_t to long conversion in imap-append.c example.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit to mback2k/curl that referenced this issue Nov 9, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.
Improve size_t to long conversion in imap-append.c example.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit to mback2k/curl that referenced this issue Dec 11, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.
Improve size_t to long conversion in imap-append.c example.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit to mback2k/curl that referenced this issue Dec 13, 2021
Some CIs already build them, let's do it on more of them.

Ignore -Wformat while using GCC on mingw to compile examples.
Improve size_t to long conversion in imap-append.c example.

Ref: curl#6079
Ref: curl#6082
Assisted-by: Jay Satiro

Follow up to curl#7690
Replaces curl#7591
Closes curl#7922
mback2k added a commit that referenced this issue Dec 14, 2021
Avoid CURL_FORMAT_CURL_OFF_T by using unsigned long instead.
Improve size_t to long conversion in imap-append.c example.

Ref: #6079
Ref: #6082
Assisted-by: Jay Satiro
Reviewed-by: Daniel Stenberg

Preparation of #7922
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build CI Continuous Integration Windows Windows-specific
Development

Successfully merging a pull request may close this issue.

3 participants