From 1a44da0fef430ff46c39cd56b0545089b9a573d1 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 1 Oct 2021 12:54:53 -0700 Subject: Remove use of std::iterator (#4199) It's deprecated in C++17 --- src/wasm-type.h | 13 ++++++++----- src/wasm/CMakeLists.txt | 5 ++++- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/wasm-type.h b/src/wasm-type.h index 48dbaf61b..542d26263 100644 --- a/src/wasm-type.h +++ b/src/wasm-type.h @@ -263,11 +263,14 @@ public: std::string toString() const; - struct Iterator : std::iterator { + struct Iterator { + // Iterator traits + using iterator_category = std::random_access_iterator_tag; + using value_type = Type; + using difference_type = long; + using pointer = const Type*; + using reference = const Type&; + const Type* parent; size_t index; Iterator(const Type* parent, size_t index) : parent(parent), index(index) {} diff --git a/src/wasm/CMakeLists.txt b/src/wasm/CMakeLists.txt index 5547e0741..20fc2e9fb 100644 --- a/src/wasm/CMakeLists.txt +++ b/src/wasm/CMakeLists.txt @@ -6,7 +6,6 @@ set(wasm_SOURCES wasm-binary.cpp wasm-debug.cpp wasm-emscripten.cpp - wasm-debug.cpp wasm-interpreter.cpp wasm-io.cpp wasm-s-parser.cpp @@ -15,4 +14,8 @@ set(wasm_SOURCES wasm-validator.cpp ${wasm_HEADERS} ) +# wasm-debug.cpp includes LLVM header using std::iterator (deprecated in C++17) +if (NOT MSVC) + set_source_files_properties(wasm-debug.cpp PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations) +endif() add_library(wasm OBJECT ${wasm_SOURCES}) -- cgit v1.2.3