Use type-safe formatting for strprintf and logging #3549

pull laanwj wants to merge 2 commits into bitcoin:master from laanwj:2014_01_tinyformat changing 26 files +1299 −338
  1. laanwj commented at 3:59 PM on January 16, 2014: member

    Switch to tinyformat-based formatting. Alternative to #3271.

    Tinyformat is a typesafe drop-in replacement for C99 printf functions: https://github.com/c42f/tinyformat

    Removes need for real_strprintf and other macro hacks. Also removes the need for the -D__USE_MINGW_ANSI_STDIO hack for mingw.

    Second commit removes now-redundant c_str()s as the new formatting function can take std::strings directly. This commit has a much larger diff and is optional. It's just a cleanup.

    Edit: should also fix "gnu_printf" warnings when building for MacOSX

  2. laanwj cross-referenced this on Jan 16, 2014 from issue Use C++ streams instead of C-style printf functions by brandondahler
  3. sipa commented at 7:39 PM on January 16, 2014: member

    ACK, both commits. Seems to work fine.

  4. kiddouk commented at 10:15 AM on January 23, 2014: none

    Just tested with LLVM, the patch is working correctly.

    $> g++ --version                                                                                                                                     [10:59]
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
    Target: x86_64-apple-darwin13.0.0
    Thread model: posix
    
  5. Typesafe strprintf/error/LogPrint functions
    Switch to tinyformat-based formatting.
    
    Tinyformat is a typesafe drop-in replacement for C99 printf functions:
    https://github.com/c42f/tinyformat
    b77dfdc9e3
  6. Remove redundant .c_str()s
    After the tinyformat switch sprintf() family functions support passing
    actual std::string objects.
    
    Remove unnecessary c_str calls (236 of them) in logging and formatting.
    7d9d134bf9
  7. BitcoinPullTester commented at 3:36 PM on January 23, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/7d9d134bf95cb6a2ce9623c7e6a3535432a61af2 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.

  8. laanwj cross-referenced this on Jan 23, 2014 from issue Mavericks compile with clang: build warnings and test fail. by da2ce7
  9. laanwj referenced this in commit 6403c6c835 on Jan 23, 2014
  10. laanwj merged this on Jan 23, 2014
  11. laanwj closed this on Jan 23, 2014

  12. laanwj deleted the branch on Apr 9, 2014
  13. rebroad cross-referenced this on May 20, 2014 from issue Remove extraneous c_str by rebroad
  14. denravonska cross-referenced this on Jul 14, 2017 from issue Switch to tinyformat by denravonska
  15. TheCharlatan cross-referenced this on Mar 7, 2018 from issue Switch to Tinyformat by TheCharlatan
  16. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:55 UTC