build: disable -Wself-assign #6744

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2015_10_clang_self_assignment_warning changing 1 files +1 −1
  1. laanwj commented at 4:43 PM on October 1, 2015: member

    Prevent these warnings in clang 3.6:

    ./serialize.h:96:9: warning: explicitly assigning value of variable of type 'uint64_t' (aka 'unsigned long') to itself [-Wself-assign]
        obj = (obj);
        ~~~ ^  ~~~
    

    This happens because obj = htole64(obj);, and htoleXX are no-op on little-endian thus get optimized away. More localized solutions are welcome, but I think pragmas are ugly too.

  2. build: disable -Wself-assign
    Prevent these warnings in clang 3.6:
    
        ./serialize.h:96:9: warning: explicitly assigning value of variable of type 'uint64_t' (aka 'unsigned long') to itself [-Wself-assign]
            obj = (obj);
            ~~~ ^  ~~~
    bb24835aed
  3. laanwj added the label Build system on Oct 1, 2015
  4. jonasschnelli commented at 4:45 PM on October 1, 2015: contributor

    ACK.

  5. paveljanik commented at 6:00 PM on October 2, 2015: contributor

    ACK

  6. fanquake commented at 3:17 AM on October 3, 2015: member

    utACK

  7. dcousens commented at 11:51 PM on October 4, 2015: contributor

    IMHO the pragma would be better than disabling this throughout, this is a localized problem, and in general the warning might be useful.

  8. laanwj commented at 11:43 AM on October 5, 2015: member

    Problem is that pragmas are per compiler, so it will become a forest of #junk that way.

    I don't think this warning is generally very useful, either.

  9. laanwj merged this on Oct 5, 2015
  10. laanwj closed this on Oct 5, 2015

  11. laanwj referenced this in commit a75c67364d on Oct 5, 2015
  12. dcousens commented at 8:46 PM on October 5, 2015: contributor

    Problem is that pragmas are per compiler

    True, ACK

  13. MarcoFalke 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 18:15 UTC

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