- the warnings are related to MinGWs inttypes.h (observed with MinGW based on GCC version 4.8.1 (rev5, Built by MinGW-W64 project) and likely other version also suffer from this)
- fixes #3236
Silence inttypes.h compiler warnings on Windows #3237
pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:silence changing 1 files +10 −0-
Diapolo commented at 9:53 PM on November 11, 2013: none
-
387f2c5e7a
Silence inttypes.h compiler warnings on Windows
- the warnings are related to MinGWs inttypes.h (observed with MinGW based on GCC version 4.8.1 (rev5, Built by MinGW-W64 project) and likely other version also suffer from this) - fixes #3236
-
BitcoinPullTester commented at 10:26 PM on November 11, 2013: none
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/387f2c5e7a14f7d8773dda0d72d85f5563c7347d for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
-
wtogami commented at 3:30 AM on November 12, 2013: contributor
Please verify that it continues to build and work as expected with the Precise 12.04-based win32 gitian which has mingw based on gcc-4.6.x.
-
laanwj commented at 8:38 AM on November 12, 2013: member
Maybe we should add some sprintf tests to catch problems with this in the pulltester.
-
Diapolo commented at 5:02 PM on November 12, 2013: none
I'll check this out tomorrow... thanks for helping out.
-
brandondahler commented at 4:55 AM on November 13, 2013: contributor
@Diapolo this only coincidentally fixes most instances of the warning because util.h is depended on by almost every file (indirectly at least). The inttypes.h include is spread across all of the files that use PRI[xdu]64 directly.
I would rather spend some time getting rid of all of the *printf functions and replace them with [i,o][,f,string]streams where appropriate. Once that is done, there will be no dependence on inttypes.h anywhere.
-
laanwj commented at 7:26 AM on November 13, 2013: member
It is quite urgent to fix this because it breaks strprintf on Windows XP and earlier (see http://sourceforge.net/apps/trac/mingw-w64/wiki/gnu%20printf) @brandondahler have you checked how much strprintf is used? There's at least 130 direct usages. Converting that all to iostreams would be a massive endavour. Had I realized that inttypes.h was C99 I would not have ACKed your refactor :/ `
So unless we revert all those changes it forces us into the C99 route for the short term even on Windows. Thus to define
__USE_MINGW_ANSI_STDIOand use the mingw C99 equivalent functions. I'd rather not have because this burns all the bridges to MSVC support, but no one cared about that anyway so it's not much of a loss.In the longer term
boost::formatis a typesafe printf-backward-compatible function that natively uses std::strings, so I think that would be the way to go to replace strprintf. The syntax is different though (http://www.boost.org/doc/libs/1_55_0/libs/format/doc/format.html) so this still implies quite a lot of work. - laanwj closed this on Nov 13, 2013
- Diapolo deleted the branch on Nov 13, 2013
- Bushstar referenced this in commit 0c9c27c6fd on Apr 8, 2020
- DrahtBot locked this on Sep 8, 2021