Skip to content

Commit 7f642c9

Browse files
authored
Fix build failure with Xcode/AppleClang 17 (#7699)
Addresses the issue reported in #7606 "Cannot build on MacOS". A header included from LLVM includes a reference to `std::iterator` which is deprecated in C++17; this trips a `deprecated-declarations` warning which becomes a compile error via `-Werror`. This patch selectively causes that warning to be ignored. Fixes #7606.
1 parent ea477c7 commit 7f642c9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/wasm/wasm-debug.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,22 @@
1818
#include "wasm.h"
1919

2020
#ifdef BUILD_LLVM_DWARF
21+
22+
#ifdef __clang__
23+
// DWARFEmitter.h transitively includes llvm/ADT/iterator.h, which uses
24+
// std::iterator, which is deprecated in C++17. This can trigger a deprecation
25+
// warning which if -Werror is enabled can cause the build to fail. That warning
26+
// is suppressed while including DWARFEmitter.h to allow the build to succeed.
27+
#pragma clang diagnostic push
28+
#pragma clang diagnostic warning "-Wdeprecated-declarations"
29+
#endif
30+
2131
#include "llvm/ObjectYAML/DWARFEmitter.h"
32+
33+
#ifdef __clang__
34+
#pragma clang diagnostic pop
35+
#endif
36+
2237
#include "llvm/ObjectYAML/DWARFYAML.h"
2338
#include "llvm/include/llvm/DebugInfo/DWARFContext.h"
2439

0 commit comments

Comments
 (0)