From fcb3b718a521b1229e7431bb662bd8874170eb17 Mon Sep 17 00:00:00 2001 From: Stella Laurenzo Date: Wed, 6 Sep 2023 00:43:50 -0700 Subject: [PATCH] Properly guard clang-specific pragma. Avoids unsupported pragma warning on GCC. --- lib/Dialect/Torch/Transforms/AbstractInterpLibrary.cpp | 4 ++-- .../importer/jit_ir/build_tools/abstract_interp_lib_gen.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Dialect/Torch/Transforms/AbstractInterpLibrary.cpp b/lib/Dialect/Torch/Transforms/AbstractInterpLibrary.cpp index 12ec2d61c..4ed92b85b 100644 --- a/lib/Dialect/Torch/Transforms/AbstractInterpLibrary.cpp +++ b/lib/Dialect/Torch/Transforms/AbstractInterpLibrary.cpp @@ -17,7 +17,7 @@ using namespace mlir; StringRef mlir::torch::Torch::getAbstractInterpLibrary() { -#ifndef _MSC_VER +#if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverlength-strings" #endif @@ -10984,7 +10984,7 @@ StringRef mlir::torch::Torch::getAbstractInterpLibrary() { "}\n" ""; // clang-format on -#ifndef _MSC_VER +#if defined(__clang__) #pragma clang diagnostic pop #endif } diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py b/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py index 837058533..6c1d59f25 100644 --- a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py +++ b/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py @@ -3563,14 +3563,14 @@ f"""//===-------------------------------------------------------------*- C++-*-= using namespace mlir; StringRef mlir::torch::Torch::getAbstractInterpLibrary() {{ -#ifndef _MSC_VER +#if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverlength-strings" #endif // clang-format off return {asm}; // clang-format on -#ifndef _MSC_VER +#if defined(__clang__) #pragma clang diagnostic pop #endif }}""")