From ff49d09ed9b740b43923950ce2a70fa418e1b834 Mon Sep 17 00:00:00 2001 From: yukatayu Date: Wed, 26 Aug 2020 14:58:09 +0900 Subject: [PATCH 1/3] fix: make suitable for msvc, clang --- src/target/llvm/codegen_hexagon.cc | 5 ++++- src/te/autodiff/ad_simplify.cc | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/target/llvm/codegen_hexagon.cc b/src/target/llvm/codegen_hexagon.cc index eefd17c18a9f..10ca6ce9b71d 100644 --- a/src/target/llvm/codegen_hexagon.cc +++ b/src/target/llvm/codegen_hexagon.cc @@ -636,7 +636,10 @@ bool UsesExportABI(const PrimFunc& f) { return false; } -__attribute__((unused)) std::ostream& operator<<(std::ostream& os, const llvm::Module& m) { +#ifdef __GNUC__ +__attribute__((unused)) +#endif +std::ostream& operator<<(std::ostream& os, const llvm::Module& m) { std::string ms; llvm::raw_string_ostream sos(ms); sos << m; diff --git a/src/te/autodiff/ad_simplify.cc b/src/te/autodiff/ad_simplify.cc index 3860c0038568..641aae0c62a4 100644 --- a/src/te/autodiff/ad_simplify.cc +++ b/src/te/autodiff/ad_simplify.cc @@ -54,6 +54,7 @@ #include #include +#include #include "ad_util.h" From e5cfc9b5688b9b220d73ee65f9bf2c4d571b2456 Mon Sep 17 00:00:00 2001 From: yukatayu Date: Wed, 26 Aug 2020 16:00:41 +0900 Subject: [PATCH 2/3] clang-format --- src/target/llvm/codegen_hexagon.cc | 3 ++- src/te/autodiff/ad_simplify.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/target/llvm/codegen_hexagon.cc b/src/target/llvm/codegen_hexagon.cc index 10ca6ce9b71d..2ca9076aaab9 100644 --- a/src/target/llvm/codegen_hexagon.cc +++ b/src/target/llvm/codegen_hexagon.cc @@ -639,7 +639,8 @@ bool UsesExportABI(const PrimFunc& f) { #ifdef __GNUC__ __attribute__((unused)) #endif -std::ostream& operator<<(std::ostream& os, const llvm::Module& m) { +std::ostream& +operator<<(std::ostream& os, const llvm::Module& m) { std::string ms; llvm::raw_string_ostream sos(ms); sos << m; diff --git a/src/te/autodiff/ad_simplify.cc b/src/te/autodiff/ad_simplify.cc index 641aae0c62a4..874e8ca2eefc 100644 --- a/src/te/autodiff/ad_simplify.cc +++ b/src/te/autodiff/ad_simplify.cc @@ -52,9 +52,9 @@ #include #include +#include #include #include -#include #include "ad_util.h" From 54e9add058c5c6deeb99961dc20b0dda2f22fb2f Mon Sep 17 00:00:00 2001 From: yukatayu Date: Wed, 26 Aug 2020 16:51:35 +0900 Subject: [PATCH 3/3] refactor: use DMLC_ATTRIBUTE --- src/target/llvm/codegen_hexagon.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/target/llvm/codegen_hexagon.cc b/src/target/llvm/codegen_hexagon.cc index 2ca9076aaab9..c77215dec74b 100644 --- a/src/target/llvm/codegen_hexagon.cc +++ b/src/target/llvm/codegen_hexagon.cc @@ -636,11 +636,7 @@ bool UsesExportABI(const PrimFunc& f) { return false; } -#ifdef __GNUC__ -__attribute__((unused)) -#endif -std::ostream& -operator<<(std::ostream& os, const llvm::Module& m) { +DMLC_ATTRIBUTE_UNUSED std::ostream& operator<<(std::ostream& os, const llvm::Module& m) { std::string ms; llvm::raw_string_ostream sos(ms); sos << m;