Skip to content

Commit c79ad93

Browse files
committed
refactor: fix includes in src/compat
Add missing includes. Swap C headers for their C++ counterparts. Remove pointless / unmaintainable include comments. This is even more the case when we are actually using IWYU, as if anyone wants to see the comments they can just get IWYU to generate them.
1 parent 094d9fd commit c79ad93

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

src/compat/byteswap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <config/bitcoin-config.h>
1010
#endif
1111

12-
#include <stdint.h>
12+
#include <cstdint>
1313

1414
#if defined(HAVE_BYTESWAP_H)
1515
#include <byteswap.h>

src/compat/cpuid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#include <cpuid.h>
1212

13+
#include <cstdint>
14+
1315
// We can't use cpuid.h's __get_cpuid as it does not support subleafs.
1416
void static inline GetCPUID(uint32_t leaf, uint32_t subleaf, uint32_t& a, uint32_t& b, uint32_t& c, uint32_t& d)
1517
{

src/compat/endian.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include <compat/byteswap.h>
1313

14-
#include <stdint.h>
14+
#include <cstdint>
1515

1616
#if defined(HAVE_ENDIAN_H)
1717
#include <endian.h>

src/compat/glibcxx_sanity.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <list>
66
#include <locale>
77
#include <stdexcept>
8+
#include <string>
89

910
namespace
1011
{

src/compat/stdin.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,19 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#if defined(HAVE_CONFIG_H)
6-
#include <config/bitcoin-config.h>
7-
#endif
5+
#include <compat/stdin.h>
86

9-
#include <cstdio> // for fileno(), stdin
7+
#include <cstdio>
108

119
#ifdef WIN32
12-
#include <windows.h> // for SetStdinEcho()
13-
#include <io.h> // for isatty()
10+
#include <windows.h>
11+
#include <io.h>
1412
#else
15-
#include <termios.h> // for SetStdinEcho()
16-
#include <unistd.h> // for SetStdinEcho(), isatty()
17-
#include <poll.h> // for StdinReady()
13+
#include <termios.h>
14+
#include <unistd.h>
15+
#include <poll.h>
1816
#endif
1917

20-
#include <compat/stdin.h>
21-
2218
// https://stackoverflow.com/questions/1413445/reading-a-password-from-stdcin
2319
void SetStdinEcho(bool enable)
2420
{

0 commit comments

Comments
 (0)