Skip to content

Commit 3c33fb0

Browse files
committed
Bugfix: using iosfwd instead of predefines to avoid issues on macos
1 parent abdcf2e commit 3c33fb0

File tree

7 files changed

+42
-43
lines changed

7 files changed

+42
-43
lines changed

.vscode/settings.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,24 @@
9797
"span": "cpp",
9898
"typeindex": "cpp",
9999
"valarray": "cpp",
100-
"regex": "cpp"
100+
"regex": "cpp",
101+
"__config": "cpp",
102+
"__bit_reference": "cpp",
103+
"__bits": "cpp",
104+
"__debug": "cpp",
105+
"__errc": "cpp",
106+
"__hash_table": "cpp",
107+
"__locale": "cpp",
108+
"__mutex_base": "cpp",
109+
"__node_handle": "cpp",
110+
"__nullptr": "cpp",
111+
"__split_buffer": "cpp",
112+
"__string": "cpp",
113+
"__threading_support": "cpp",
114+
"__tree": "cpp",
115+
"__tuple": "cpp",
116+
"stack": "cpp",
117+
"__functional_base": "cpp"
101118
},
102119
"cmake.buildDirectory": "${workspaceFolder}/build/windows"
103120
}

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,23 @@ build/linux/Makefile: Makefile
1111
linux: build/linux/Makefile
1212
cmake --build build/linux -j `nproc`
1313

14-
build/windows/ZeroErr.sln:
14+
build/windows/ZeroErr.sln: Makefile
1515
mkdir -p build/windows
1616
cmake.exe -B build/windows -S . \
1717
-DBUILD_EXAMPLES=ON -DBUILD_TEST=ON -DDISABLE_CUDA_BUILD=OFF -T host=x64 -A x64
1818

1919
windows: build/windows/ZeroErr.sln
2020
cmake.exe --build build/windows --config Debug -j `nproc`
2121

22+
build/macosx/Makefile: Makefile
23+
mkdir -p build/macosx
24+
cmake -B build/macosx -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=11 \
25+
-DBUILD_EXAMPLES=ON -DBUILD_TEST=ON -DUSE_MOLD=ON -DDISABLE_CUDA_BUILD=OFF -DENABLE_FUZZING=OFF \
26+
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
27+
28+
macosx: build/macosx/Makefile
29+
cmake --build build/macosx -j 4
30+
2231
test: linux-test windows-test fuzz-test
2332

2433
cuda-test: windows
@@ -39,6 +48,8 @@ reporter: linux
3948
windows-test: windows
4049
cd build/windows/test && ../examples/Debug/2_log.exe --testcase="parsing test"
4150

51+
macosx-test: macosx
52+
cd build/macosx/test && ./unittest
4253

4354
build/linux-release/Makefile: Makefile
4455
mkdir -p build/linux-release

include/zeroerr/internal/debugbreak.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ __attribute__((always_inline)) __inline__ static bool isDebuggerActive() {
175175
return false;
176176
}
177177
#elif defined(__APPLE__)
178+
#include <sys/sysctl.h>
179+
#include <unistd.h>
180+
#include <iostream>
178181
// The following function is taken directly from the following technical note:
179182
// https://developer.apple.com/library/archive/qa/qa1361/_index.html
180183
// Returns true if the current process is being debugged (either

include/zeroerr/internal/typetraits.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,10 @@
66
#include <string>
77
#include <tuple> // this should be removed
88
#include <type_traits>
9+
#include <iosfwd>
910

1011
ZEROERR_SUPPRESS_COMMON_WARNINGS_PUSH
1112

12-
// those predefines can help to avoid include too many headers
13-
namespace std {
14-
template <typename T>
15-
class complex;
16-
17-
template <class T, class Deleter>
18-
class unique_ptr;
19-
20-
template <class T>
21-
class shared_ptr;
22-
23-
template <class T>
24-
class weak_ptr;
25-
26-
} // namespace std
27-
2813

2914
namespace zeroerr {
3015

include/zeroerr/log.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@
1212
#include <map>
1313
#include <string>
1414
#include <vector>
15+
#include <iosfwd>
1516

1617
ZEROERR_SUPPRESS_COMMON_WARNINGS_PUSH
1718

1819
extern const char* ZEROERR_LOG_CATEGORY;
1920

20-
namespace std {
21-
class mutex;
22-
}
23-
2421
namespace zeroerr {
2522

2623
// clang-format off

include/zeroerr/print.h

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

44
#include "zeroerr/color.h"
55
#include "zeroerr/internal/typetraits.h"
6-
6+
#include <complex>
77

88
#ifdef __GNUG__
99
#include <cxxabi.h>

zeroerr.hpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,9 @@ __attribute__((always_inline)) __inline__ static bool isDebuggerActive() {
643643
return false;
644644
}
645645
#elif defined(__APPLE__)
646+
#include <sys/sysctl.h>
647+
#include <unistd.h>
648+
#include <iostream>
646649
// The following function is taken directly from the following technical note:
647650
// https://developer.apple.com/library/archive/qa/qa1361/_index.html
648651
// Returns true if the current process is being debugged (either
@@ -724,25 +727,11 @@ __attribute__((always_inline)) __inline__ static bool isDebuggerActive() { retur
724727
#include <string>
725728
#include <tuple> // this should be removed
726729
#include <type_traits>
730+
#include <iosfwd>
727731

728732
ZEROERR_SUPPRESS_COMMON_WARNINGS_PUSH
729733

730734
// those predefines can help to avoid include too many headers
731-
namespace std {
732-
template <typename T>
733-
class complex;
734-
735-
template <class T, class Deleter>
736-
class unique_ptr;
737-
738-
template <class T>
739-
class shared_ptr;
740-
741-
template <class T>
742-
class weak_ptr;
743-
744-
} // namespace std
745-
746735

747736
namespace zeroerr {
748737

@@ -1302,7 +1291,7 @@ ZEROERR_SUPPRESS_COMMON_WARNINGS_POP
13021291

13031292

13041293

1305-
1294+
#include <complex>
13061295

13071296
#ifdef __GNUG__
13081297
#include <cxxabi.h>
@@ -3402,15 +3391,12 @@ std::string format(const char* fmt, T... args) {
34023391
#include <map>
34033392
#include <string>
34043393
#include <vector>
3394+
#include <iosfwd>
34053395

34063396
ZEROERR_SUPPRESS_COMMON_WARNINGS_PUSH
34073397

34083398
extern const char* ZEROERR_LOG_CATEGORY;
34093399

3410-
namespace std {
3411-
class mutex;
3412-
}
3413-
34143400
namespace zeroerr {
34153401

34163402
// clang-format off

0 commit comments

Comments
 (0)