[llvm] r344843 - Replace setFeature macro with lambda to fix MSVC "shift count negative or too big" warnings. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 20 06:16:31 PDT 2018
Author: rksimon
Date: Sat Oct 20 06:16:31 2018
New Revision: 344843
URL: http://llvm.org/viewvc/llvm-project?rev=344843&view=rev
Log:
Replace setFeature macro with lambda to fix MSVC "shift count negative or too big" warnings. NFCI.
Modified:
llvm/trunk/lib/Support/Host.cpp
Modified: llvm/trunk/lib/Support/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Host.cpp?rev=344843&r1=344842&r2=344843&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Host.cpp (original)
+++ llvm/trunk/lib/Support/Host.cpp Sat Oct 20 06:16:31 2018
@@ -884,15 +884,16 @@ static void getAvailableFeatures(unsigne
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(unsigne
*FeaturesOut = Features;
*Features2Out = Features2;
*Features3Out = Features3;
-#undef setFeature
}
StringRef sys::getHostCPUName() {
More information about the llvm-commits
mailing list