Remove PRIx64 usage completely #3735

pull laanwj wants to merge 2 commits into bitcoin:master from laanwj:2014_02_remove_PRIx64_completely changing 14 files +39 −47
  1. laanwj commented at 8:17 AM on February 24, 2014: member

    Amend to #3729.

    It turns out that BerkelyDB was including inttypes.h indirectly, so our definition collided with the system header definition. We cannot fix this with just macro redefinition so we need to change the usage sites.

    First commit: apply the following script to all .cpp and .h files:

    # Middle
    sed -i 's/"PRIx64"/x/g' "$1"
    sed -i 's/"PRIu64"/u/g' "$1"
    sed -i 's/"PRId64"/d/g' "$1"
    # Initial
    sed -i 's/PRIx64"/"x/g' "$1"
    sed -i 's/PRIu64"/"u/g' "$1"
    sed -i 's/PRId64"/"d/g' "$1"
    # Trailing
    sed -i 's/"PRIx64/x"/g' "$1"
    sed -i 's/"PRIu64/u"/g' "$1"
    sed -i 's/"PRId64/d"/g' "$1"
    

    Second commit removes the definitions from util.h. The remaining definitions PRIsz/PRIpd are our own, so keep them to not generate too much diff noise...

  2. Get rid of C99 PRI?64 usage in source files
    Amend to d5f1e72. It turns out that BerkelyDB was including inttypes.h
    indirectly, so we cannot fix this with just macros.
    
    Trivial commit: apply the following script to all .cpp and .h files:
    
        # Middle
        sed -i 's/"PRIx64"/x/g' "$1"
        sed -i 's/"PRIu64"/u/g' "$1"
        sed -i 's/"PRId64"/d/g' "$1"
        # Initial
        sed -i 's/PRIx64"/"x/g' "$1"
        sed -i 's/PRIu64"/"u/g' "$1"
        sed -i 's/PRId64"/"d/g' "$1"
        # Trailing
        sed -i 's/"PRIx64/x"/g' "$1"
        sed -i 's/"PRIu64/u"/g' "$1"
        sed -i 's/"PRId64/d"/g' "$1"
    
    After this commit, `git grep` for PRI.64 should turn up nothing except
    the defines in util.h.
    f48742c2bf
  3. Remove definition of PRI?64 in util.h
    This was a bad idea. This can't be solved with macros as any
    other library that includes inttypes.h will get in the way.
    
    The parent commit has removed all usages from the source, this commit
    removes the definition.
    2f5da74362
  4. laanwj referenced this in commit 4fd082ded7 on Feb 24, 2014
  5. BitcoinPullTester commented at 8:40 AM on February 24, 2014: none

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

  6. Diapolo commented at 10:17 AM on February 24, 2014: none

    Currently trying to build with this patch...

    ACK, all warnings gone.

  7. laanwj commented at 11:47 AM on February 24, 2014: member

    @Diapolo Can you paste the test_bitcoin output here? I tried with my gitian build in wine and all tests were OK, but I'd like confirmation from another mingw build.

  8. laanwj added this to the milestone 0.9.0 on Feb 24, 2014
  9. Diapolo commented at 3:19 PM on February 26, 2014: none

    I can't use the test_bitcoin.exe from @BitcoinPullTester as it still produces invalid executables. But I verified that all 3 test-cases are true, so still ACK :).

  10. gavinandresen commented at 5:15 PM on February 26, 2014: contributor

    ACK, compiles on OSX with no warnings, unit and regression tests pass.

  11. gavinandresen referenced this in commit e3e65d29b7 on Feb 26, 2014
  12. gavinandresen merged this on Feb 26, 2014
  13. gavinandresen closed this on Feb 26, 2014

  14. laanwj deleted the branch on Apr 9, 2014
  15. laanwj referenced this in commit 783b182c8f on May 6, 2014
  16. laanwj referenced this in commit 72ae546dd4 on May 12, 2014
  17. MathyV referenced this in commit 14fe5f56b6 on Nov 3, 2014
  18. DrahtBot 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-04-13 15:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me