From 6493c695297ecb8c90d8b5592ed9c01eb8239378 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 20 Oct 2018 13:16:31 +0000 Subject: [PATCH] Replace setFeature macro with lambda to fix MSVC "shift count negative or too big" warnings. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344843 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/Host.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Support/Host.cpp b/lib/Support/Host.cpp index ebf03cc176f..91e98a33b37 100644 --- a/lib/Support/Host.cpp +++ b/lib/Support/Host.cpp @@ -884,15 +884,16 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf, unsigned Features3 = 0; unsigned EAX, EBX; -#define setFeature(F) \ - do { \ - if (F < 32) \ - Features |= 1 << F; \ - else if (F < 64) \ - Features2 |= 1 << (F - 32); \ - else if (F < 96) \ - Features3 |= 1 << (F - 64); \ - } while (0) + auto setFeature = [&](unsigned F) { + if (F < 32) + Features |= 1 << F; + else if (F < 64) + Features2 |= 1 << (F - 32); + else if (F < 96) + Features3 |= 1 << (F - 64); + else + llvm_unreachable("Unexpected FeatureBit"); + }; if ((EDX >> 15) & 1) setFeature(X86::FEATURE_CMOV); @@ -1004,7 +1005,6 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf, *FeaturesOut = Features; *Features2Out = Features2; *Features3Out = Features3; -#undef setFeature } StringRef sys::getHostCPUName() { -- 2.11.0