Skip to content

Commit a2567f1

Browse files
committed
Fix direct includes
1 parent 86f9190 commit a2567f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+236
-37
lines changed

.clang-format

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ BraceWrapping:
4343
SplitEmptyRecord: 'false'
4444
SplitEmptyNamespace: 'false'
4545

46-
BreakBeforeConceptDeclarations: Always
46+
BreakBeforeConceptDeclarations: Always
4747
BreakBeforeTernaryOperators: 'true'
4848
BreakConstructorInitializers: BeforeColon
4949
BreakInheritanceList: BeforeColon

examples/command/main.cpp

+12-7
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,28 @@
3030

3131
/* c header */
3232
#include <cstdint> // std::int32_t
33+
#include <cstdlib> // EXIT_SUCCESS
3334

3435
/* stl header */
3536
#include <iostream>
37+
#include <string>
3638

3739
/* modern.cpp.core */
3840
#include <Exec.h>
3941

40-
static void checkResult( std::int32_t _code,
41-
const std::string &_pipe ) {
42+
namespace {
4243

43-
std::string result = "EXIT_SUCCESS";
44-
if ( _code != EXIT_SUCCESS ) {
44+
void checkResult( std::int32_t _code,
45+
const std::string &_pipe ) {
4546

46-
result = "EXIT_FAILURE";
47+
std::string result = "EXIT_SUCCESS";
48+
if ( _code != EXIT_SUCCESS ) {
49+
50+
result = "EXIT_FAILURE";
51+
}
52+
std::cout << "'" << _pipe << "'" << std::endl;
53+
std::cout << "Result: " << result << std::endl;
4754
}
48-
std::cout << "'" << _pipe << "'" << std::endl;
49-
std::cout << "Result: " << result << std::endl;
5055
}
5156

5257
std::int32_t main() {

examples/cpuinfo/main.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
/* c header */
3232
#include <cstdint> // std::int32_t
33+
#include <cstdlib> // EXIT_SUCCESS
3334

3435
/* stl header */
3536
#include <iostream>

examples/double/main.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@
2929
*/
3030

3131
/* c header */
32+
#include <cstddef> // std::size_t
3233
#include <cstdint> // std::int32_t
34+
#include <cstdlib> // EXIT_SUCCESS
3335

3436
/* stl header */
3537
#include <iostream>
3638
#include <limits>
39+
#include <utility> // std::pair
3740

3841
/* modern.cpp.core */
3942
#include <FloatingPoint.h>

examples/logger/main.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,29 @@
3030

3131
/* c header */
3232
#include <cstdint> // std::int32_t
33+
#include <cstdlib> // EXIT_SUCCESS
3334

3435
/* stl header */
36+
#include <any>
37+
#include <array>
38+
#include <chrono>
3539
#include <format>
3640
#include <iostream>
41+
#include <list>
42+
#include <map>
3743
#include <memory> // std::unique_ptr
44+
#include <optional>
45+
#include <set>
46+
#include <string>
47+
#include <string_view>
48+
#include <tuple>
49+
#include <unordered_map>
50+
#include <utility> // std::pair
51+
#include <variant>
52+
#include <vector>
53+
54+
/* magic enum */
55+
#include <magic_enum.hpp>
3856

3957
/* modern.cpp.core */
4058
#include <Logger.h>

examples/pipe/main.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
*/
3030

31+
/* c header */
32+
#include <cstdint> // std::int32_t
33+
#include <cstdio> // fprintf, printf
34+
#include <cstdlib> // EXIT_FAILURE
35+
3136
/* stl header */
3237
#include <iostream>
3338
#ifdef HAVE_SPAN

examples/threadqueue/Item.h

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
/* stl header */
3737
#include <string>
38+
#include <utility> // std::move
3839

3940
class Item {
4041

examples/threadqueue/main.cpp

+22-11
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,19 @@
3030

3131
/* c header */
3232
#include <cstdint> // std::int32_t
33+
#include <cstdlib> // EXIT_SUCCESS
3334

3435
/* stl header */
3536
#include <algorithm>
37+
#include <exception>
38+
#include <functional> // std::ref
3639
#include <iostream>
40+
#include <memory>
41+
#include <new> // std::bad_alloc
3742
#include <ranges>
43+
#include <thread>
44+
#include <tuple>
45+
#include <vector>
3846

3947
/* modern.cpp.core */
4048
#include <SharedQueue.h>
@@ -47,23 +55,26 @@ constexpr std::int32_t intervalSeconds = 1;
4755
constexpr std::int32_t secondsToMilliseconds = 100;
4856
constexpr std::int32_t exitInterval = 30;
4957

50-
static inline void process( vx::SharedQueue<Item *> &_queue,
51-
std::int32_t _threadId ) {
58+
namespace {
5259

53-
std::cout << "Start Thread: " << _threadId << std::endl;
54-
while ( true ) {
60+
inline void process( vx::SharedQueue<Item *> &_queue,
61+
std::int32_t _threadId ) {
5562

56-
std::unique_ptr<Item> item { _queue.front() };
57-
if ( item && item->getMessage() == "STOP" ) {
63+
std::cout << "Start Thread: " << _threadId << std::endl;
64+
while ( true ) {
5865

59-
break;
60-
}
61-
if ( item ) {
66+
std::unique_ptr<Item> item { _queue.front() };
67+
if ( item && item->getMessage() == "STOP" ) {
68+
69+
break;
70+
}
71+
if ( item ) {
6272

63-
std::cout << _threadId << ": received item: " << item->getMessage() << " " << item->getNumber() << std::endl;
73+
std::cout << _threadId << ": received item: " << item->getMessage() << " " << item->getNumber() << std::endl;
74+
}
6475
}
76+
std::cout << "Ended Thread: " << _threadId << std::endl;
6577
}
66-
std::cout << "Ended Thread: " << _threadId << std::endl;
6778
}
6879

6980
std::int32_t main() {

examples/timer/main.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
/* c header */
3232
#include <cstdint> // std::int32_t
33+
#include <cstdlib> // EXIT_SUCCESS
3334

3435
/* stl header */
3536
#include <iostream>

examples/timing/main.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030

3131
/* c header */
3232
#include <cstdint> // std::int32_t
33-
34-
/* stl header */
35-
#include <iostream>
33+
#include <cstdlib> // EXIT_SUCCESS
3634

3735
/* modern.cpp.core */
3836
#include <Logger.h>

source/CPU.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
/* c header */
3232
#include <cstdint> // std::int32_t
3333

34+
/* stl header */
35+
#include <utility>
36+
3437
/* windows header */
3538
#ifdef _MSC_VER
3639
#include <intrin.h>

source/CPU.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,17 @@
3535

3636
/* stl header */
3737
#include <array>
38+
#ifdef __cpp_lib_to_underlying
39+
#include <utility> // std::underlaying
40+
#endif
3841

3942
/* magic enum */
4043
#include <magic_enum.hpp>
4144

4245
/* local header */
43-
#include "Cpp23.h"
46+
#ifndef __cpp_lib_to_underlying
47+
#include "Cpp23.h"
48+
#endif
4449

4550
/**
4651
* @brief vx (VX APPS) namespace.

source/Demangle.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@
2929
*/
3030

3131
/* c header */
32+
#include <cstdint> // std::int32_t
33+
#include <cstdlib> // std::free
3234
#ifndef _WIN32
3335
#include <cxxabi.h>
3436
#endif
3537

3638
/* stl header */
39+
#include <exception>
3740
#include <memory>
41+
#include <new> // std::bad_alloc
42+
#include <string>
43+
#include <string_view>
44+
#include <vector>
3845

3946
/* re2 header */
4047
#include <re2/re2.h>

source/Exec.cpp

+15-3
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,31 @@
2828
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
*/
3030

31+
/* c header */
32+
#include <cstdint> // std::int32_t
33+
#include <cstdio> // std::gets, std::FILE, pclose, popen
34+
35+
/* system header */
36+
#ifndef _MSC_VER
37+
#include <sys/wait.h>
38+
#endif
39+
3140
/* stl header */
3241
#include <array>
3342
#include <iostream>
3443
#include <memory>
35-
#include <sstream>
44+
#include <string>
3645

3746
/* local header */
3847
#include "Exec.h"
3948

4049
namespace vx::exec {
4150

42-
/** @brief Global result of executable. */
43-
static std::int32_t m_resultCode = 0; // NOSONAR const is not possible here.
51+
namespace {
52+
53+
/** @brief Global result of executable. */
54+
std::int32_t m_resultCode = 0; // NOSONAR const is not possible here.
55+
}
4456

4557
/** @brief Buffer size to read stdout. */
4658
constexpr std::int32_t bufferSize = 128;

source/Exec.h

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#pragma once
3232

3333
/* c header */
34+
#include <cstdint> // std::int32_t
3435
#include <cstdio> // std::FILE
3536

3637
/* stl header */

source/Keyboard.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@
3030

3131
/* c header */
3232
#include <cstdint> // std::int32_t, std::uint32_t, std::int64_t
33-
#include <cstring> // strerror_r
33+
#ifdef __linux__
34+
#include <cstring> // strerror_r
35+
#endif
3436

3537
/* stl header */
36-
#include <vector>
38+
#ifdef __linux__
39+
#include <vector>
40+
#endif
3741

3842
#ifdef _MSC_VER
3943
#include <Windows.h>

source/Logger.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@
2828
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
*/
3030

31+
/* c header */
32+
#include <cstddef> // std::size_t
33+
#include <cstdint> // std::int8_t
34+
#include <ctime> // std::time
35+
3136
/* stl header */
3237
#include <algorithm>
3338
#include <iomanip>
3439
#include <iostream> // std::streambuf, std::cout
40+
#include <source_location.hpp>
41+
#include <string>
42+
#include <string_view>
3543
#include <sstream>
3644

3745
/* magic enum */

source/Logger.h

+5
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,22 @@
3131
#pragma once
3232

3333
/* c header */
34+
#include <cstddef> // std::size_t
3435
#include <cstdint> // std::int8_t, std::int32_t
36+
#include <ctime>
3537

3638
/* stl header */
3739
#include <chrono>
40+
#include <ios>
41+
#include <limits>
3842
#include <optional>
3943
#include <ostream>
4044
#include <ratio>
4145
#include <source_location.hpp>
4246
#include <string>
4347
#include <string_view>
4448
#include <tuple>
49+
#include <type_traits>
4550
#include <variant>
4651

4752
/* local header */

source/Logger_any.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,24 @@
3131
#pragma once
3232

3333
/* c header */
34+
#include <cstddef> // std::size_t
3435
#include <cstdint> // std::int8_t, std::int32_t
3536

3637
/* stl header */
3738
#include <any>
38-
#include <array>
3939
#include <functional>
4040
#include <list>
41-
#include <map>
42-
#include <optional>
4341
#include <set>
4442
#include <string>
4543
#include <string_view>
46-
#include <tuple>
4744
#include <typeindex>
4845
#include <unordered_map>
4946
#include <utility> // std::pair
50-
#include <variant>
5147
#include <vector>
5248

5349
/* local header */
5450
#include "Demangle.h"
51+
#include "Logger.h"
5552
#include "Logger_container.h"
5653

5754
/**

source/Logger_container.h

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131
#pragma once
3232

33+
/* c header */
34+
#include <cstddef> // std::size_t
35+
3336
/* stl header */
3437
#include <array>
3538
#include <functional>

source/Logger_enum.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#pragma once
3232

3333
/* stl header */
34-
#include <optional>
34+
#include <type_traits>
3535

3636
/* magic_enum */
3737
#include <magic_enum.hpp>

0 commit comments

Comments
 (0)