Remove unreferenced boost headers #14718

pull murrayn wants to merge 1 commits into bitcoin:master from murrayn:clang_warnings changing 5 files +0 −6
  1. murrayn commented at 12:55 pm on November 13, 2018: contributor

    Building with clang (e.g. on FreeBSD) is very noisy due to -Wthread-safety-analysis warnings regarding boost. This change removes a number of unnecessary boost includes, and silences the rest of the warnings when building with clang. This allows more potentially interesting warnings to surface from the noise.

    Tested on FreeBSD 11.2

  2. fanquake added the label Refactoring on Nov 13, 2018
  3. DrahtBot commented at 3:18 pm on November 13, 2018: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #13339 (wallet: Replace %w by wallet name in -walletnotify script by promag)
    • #12833 ([qt] move QSettings to bitcoin_rw.conf where possible by Sjors)
    • #11082 (Add new bitcoin_rw.conf file that is used for settings modified by this software itself by luke-jr)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. MarcoFalke commented at 4:30 pm on November 13, 2018: member
    ACK on removing the unneeded headers. NACK on the verbose annotations to silence warnings. They should instead be fixed in the broken compiler or broken library.
  5. practicalswift commented at 4:54 pm on November 13, 2018: contributor

    @murrayn Can you post a few of the warnings? Could it be that you’re using an old version of Boost? :-)

    ACK on removing the redundant headers

  6. promag commented at 5:43 pm on November 13, 2018: member
    +1 remove headers.
  7. murrayn commented at 0:34 am on November 14, 2018: contributor

    @murrayn Can you post a few of the warnings? Could it be that you’re using an old version of Boost? :-) @practicalswift I was originally using boost-libs-1.66.0_1, updated to boost-libs-1.68.0_3 with no improvement.

    Here is the warning output from compiling one of the files:

    https://0bin.net/paste/JAxYnpYsxSSxXz+4#-ObZEDfUOHpeAnguOYhkZMW5xL9Co7ea8E5E+evc9Zv

  8. practicalswift commented at 7:13 am on November 14, 2018: contributor
    @murrayn Could you limit this PR to the header removal only? That change seems to have consensus ACK and will likely be a quick merge :-)
  9. murrayn force-pushed on Nov 14, 2018
  10. murrayn force-pushed on Nov 14, 2018
  11. murrayn renamed this:
    Remove unreferenced boost headers and quieten remaining clang warnings
    Remove unreferenced boost headers
    on Nov 14, 2018
  12. in src/init.cpp:62 in c5e6cd4591 outdated
    58@@ -59,8 +59,7 @@
    59 #include <boost/algorithm/string/classification.hpp>
    60 #include <boost/algorithm/string/replace.hpp>
    61 #include <boost/algorithm/string/split.hpp>
    62-#include <boost/bind.hpp>
    63-#include <boost/thread.hpp>
    64+
    


    MarcoFalke commented at 3:47 pm on November 14, 2018:
    This file uses boost::bind and boost::thread*

    murrayn commented at 7:35 am on November 15, 2018:
    Looks like boost/thread.h is included in scheduler.h

    MarcoFalke commented at 5:06 pm on November 15, 2018:
    Please revert, #14718 (review)
  13. MarcoFalke commented at 4:06 pm on November 14, 2018: member
    ACK c5e6cd459197f0829069641d109b7b7b2f4042f8 (checked that the bitcoind size reduces by about 1%)
  14. PastaPastaPasta approved
  15. in src/wallet/db.cpp:21 in c5e6cd4591 outdated
    16@@ -17,8 +17,6 @@
    17 #include <sys/stat.h>
    18 #endif
    19 
    20-#include <boost/thread.hpp>
    21-
    


    ken2812221 commented at 8:12 am on November 15, 2018:
    This header is used by boost::this_thread::interruption_point()
  16. in src/index/txindex.cpp:12 in c5e6cd4591 outdated
     7@@ -8,8 +8,6 @@
     8 #include <util/system.h>
     9 #include <validation.h>
    10 
    11-#include <boost/thread.hpp>
    12-
    


    ken2812221 commented at 8:13 am on November 15, 2018:
    This header is used by boost::this_thread::interruption_point()

    murrayn commented at 8:57 am on November 15, 2018:
    boost/thread.hpp is already included by util/system.h

    ken2812221 commented at 9:20 am on November 15, 2018:
    I only saw it include boost/thread/condition_variable in util/system.h. You can take a look at appveyor ci error message.

    murrayn commented at 9:30 am on November 15, 2018:
    Oh cool, good to know for future reference. I’ve undone the changes to those files.

    sipa commented at 4:35 pm on November 15, 2018:
    You should always include all headers whose symbols are being used, even if another include already indirectly includes them. Otherwise random failures can occur when refactoring. Furthermore, it makes semantic dependencies clearer (“can this file be used without that file”).
  17. ken2812221 commented at 8:14 am on November 15, 2018: contributor
    Concept ACK.
  18. murrayn force-pushed on Nov 15, 2018
  19. murrayn force-pushed on Nov 15, 2018
  20. murrayn force-pushed on Nov 15, 2018
  21. in src/wallet/walletdb.cpp:22 in 77aab9dd27 outdated
    18@@ -19,8 +19,6 @@
    19 #include <atomic>
    20 #include <string>
    21 
    22-#include <boost/thread.hpp>
    


    MarcoFalke commented at 2:35 am on November 16, 2018:
    This header is used
  22. in src/util/time.cpp:13 in 77aab9dd27 outdated
     9@@ -10,7 +10,6 @@
    10 #include <util/time.h>
    11 
    12 #include <atomic>
    13-#include <boost/date_time/posix_time/posix_time.hpp>
    


    MarcoFalke commented at 2:35 am on November 16, 2018:
    Same
  23. in src/torcontrol.cpp:18 in 77aab9dd27 outdated
    14@@ -15,7 +15,6 @@
    15 #include <set>
    16 #include <stdlib.h>
    17 
    18-#include <boost/bind.hpp>
    


    MarcoFalke commented at 2:35 am on November 16, 2018:
    Same
  24. in src/scheduler.h:13 in 77aab9dd27 outdated
     9@@ -10,7 +10,6 @@
    10 // boost::thread / boost::chrono should be ported to std::thread / std::chrono
    11 // when we support C++11.
    12 //
    13-#include <boost/chrono/chrono.hpp>
    


    MarcoFalke commented at 2:36 am on November 16, 2018:
    same
  25. in src/scheduler.cpp:11 in 77aab9dd27 outdated
     7@@ -8,7 +8,6 @@
     8 #include <reverselock.h>
     9 
    10 #include <assert.h>
    11-#include <boost/bind.hpp>
    


    MarcoFalke commented at 2:36 am on November 16, 2018:
    same
  26. in src/rpc/server.cpp:17 in 77aab9dd27 outdated
    13@@ -14,7 +14,6 @@
    14 #include <util/system.h>
    15 #include <util/strencodings.h>
    16 
    17-#include <boost/bind.hpp>
    


    MarcoFalke commented at 2:37 am on November 16, 2018:
    Same
  27. MarcoFalke changes_requested
  28. MarcoFalke commented at 2:38 am on November 16, 2018: member
    I looked at a few and they seem to be used some others weren’t used. Please make sure you only remove unused ones
  29. murrayn force-pushed on Nov 16, 2018
  30. Remove unreferenced boost headers c54e5a41c4
  31. in src/key_io.cpp:14 in ce28832b5f outdated
     8@@ -9,9 +9,6 @@
     9 #include <script/script.h>
    10 #include <util/strencodings.h>
    11 
    12-#include <boost/variant/apply_visitor.hpp>
    13-#include <boost/variant/static_visitor.hpp>
    14-
    


    MarcoFalke commented at 3:17 am on November 16, 2018:
    This header is used.
  32. murrayn force-pushed on Nov 16, 2018
  33. MarcoFalke commented at 3:44 am on November 16, 2018: member
    utACK c54e5a41c4ae0f50a27b93bda0c7d8f128101670
  34. practicalswift commented at 7:41 am on November 16, 2018: contributor
    utACK c54e5a41c4ae0f50a27b93bda0c7d8f128101670
  35. MarcoFalke referenced this in commit 09f1d7fe72 on Nov 19, 2018
  36. MarcoFalke merged this on Nov 19, 2018
  37. MarcoFalke closed this on Nov 19, 2018

  38. Sjors commented at 7:25 pm on November 19, 2018: member

    On master:

    0test/lint/lint-includes.sh
    1Good job! The Boost dependency "boost/filesystem/fstream.hpp" is no longer used.
    2Please remove it from EXPECTED_BOOST_INCLUDES in test/lint/lint-includes.sh
    3to make sure this dependency is not accidentally reintroduced.
    

    I’ll make a PR.

  39. in src/fs.h:15 in c54e5a41c4
    11@@ -12,7 +12,6 @@
    12 #endif
    13 
    14 #include <boost/filesystem.hpp>
    15-#include <boost/filesystem/fstream.hpp>
    


    laanwj commented at 9:02 am on November 20, 2018:
    Next time you’re removing a header please check carefully that it’s not used; we’re also using includes to signal dependencies; so it being included indirectly, somehow, is not a good reason to remove it at the direct use site.
  40. laanwj referenced this in commit 1b99d153d0 on Nov 20, 2018
  41. deadalnix referenced this in commit 4d562db5ae on Mar 20, 2020
  42. ftrader referenced this in commit 2084301181 on May 19, 2020
  43. Munkybooty referenced this in commit 8545d0a78e on Jul 29, 2021
  44. Munkybooty referenced this in commit 5ee0ec4f56 on Jul 29, 2021
  45. Munkybooty referenced this in commit 01c9c0111d on Aug 3, 2021
  46. Munkybooty referenced this in commit eba469e3b0 on Aug 3, 2021
  47. Munkybooty referenced this in commit 5cd4800400 on Aug 5, 2021
  48. Munkybooty referenced this in commit eb9a3965c3 on Aug 5, 2021
  49. Munkybooty referenced this in commit 9bb659ecf2 on Aug 8, 2021
  50. Munkybooty referenced this in commit 526fb543ca on Aug 8, 2021
  51. Munkybooty referenced this in commit 7eb9e73134 on Aug 9, 2021
  52. Munkybooty referenced this in commit e1c365e257 on Aug 9, 2021
  53. Munkybooty referenced this in commit 138dbb5854 on Aug 11, 2021
  54. Munkybooty referenced this in commit de5d8af15d on Aug 11, 2021
  55. 5tefan referenced this in commit d897859585 on Aug 12, 2021
  56. 5tefan referenced this in commit 6e92792f59 on Aug 12, 2021
  57. 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: 2024-12-22 06:12 UTC

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