GCC objects to the two sides of a conditional expression having different enum
authorMatt Beaumont-Gay <matthewbg@google.com>
Tue, 21 Dec 2010 23:43:23 +0000 (23:43 +0000)
committerMatt Beaumont-Gay <matthewbg@google.com>
Tue, 21 Dec 2010 23:43:23 +0000 (23:43 +0000)
types, but they're just getting converted to unsigned anyway, so cast first
(and ask questions later).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122377 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MachObjectWriter.cpp

index 3a15d242d0782b7f77078fedf218973863fe4eb6..386f4517b65ec82389c72e43b282bf4c6dbb8a88 100644 (file)
@@ -765,8 +765,8 @@ public:
       // Note that there is no longer any semantic difference between these two
       // relocation types from the linkers point of view, this is done solely
       // for pedantic compatibility with 'as'.
-      Type = A_SD->isExternal() ? macho::RIT_Difference :
-        macho::RIT_Generic_LocalDifference;
+      Type = A_SD->isExternal() ? (unsigned)macho::RIT_Difference :
+        (unsigned)macho::RIT_Generic_LocalDifference;
       Value2 = getSymbolAddress(B_SD, Layout);
       FixedValue -= getSectionAddress(B_SD->getFragment()->getParent());
     }