2
0
Эх сурвалжийг харах

[linux-port] Resolve ternary ambiguities (#1278)

A few ternary operators took different types in the second and
third position, which some compilers refuse to resolve. By casting
the second operand to the type of the assigned variable and make
it match the third operand which was already cast.
Greg Roth 7 жил өмнө
parent
commit
a62836b6dc

+ 1 - 1
lib/Transforms/IPO/Inliner.cpp

@@ -83,7 +83,7 @@ Inliner::Inliner(char &ID)
 
 
 Inliner::Inliner(char &ID, int Threshold, bool InsertLifetime)
 Inliner::Inliner(char &ID, int Threshold, bool InsertLifetime)
   : CallGraphSCCPass(ID), InlineThreshold(InlineLimit.getNumOccurrences() > 0 ?
   : CallGraphSCCPass(ID), InlineThreshold(InlineLimit.getNumOccurrences() > 0 ?
-                                          InlineLimit : Threshold),
+                                          unsigned(InlineLimit) : Threshold),
     InsertLifetime(InsertLifetime) {}
     InsertLifetime(InsertLifetime) {}
 
 
 /// For this class, we declare that we require and preserve the call graph.
 /// For this class, we declare that we require and preserve the call graph.

+ 4 - 4
lib/Transforms/Scalar/LoopUnrollPass.cpp

@@ -101,13 +101,13 @@ namespace {
   public:
   public:
     static char ID; // Pass ID, replacement for typeid
     static char ID; // Pass ID, replacement for typeid
     LoopUnroll(int T = -1, int C = -1, int P = -1, int R = -1) : LoopPass(ID) {
     LoopUnroll(int T = -1, int C = -1, int P = -1, int R = -1) : LoopPass(ID) {
-      CurrentThreshold = (T == -1) ? UnrollThreshold : unsigned(T);
+      CurrentThreshold = (T == -1) ? unsigned(UnrollThreshold) : unsigned(T);
       CurrentPercentDynamicCostSavedThreshold =
       CurrentPercentDynamicCostSavedThreshold =
           UnrollPercentDynamicCostSavedThreshold;
           UnrollPercentDynamicCostSavedThreshold;
       CurrentDynamicCostSavingsDiscount = UnrollDynamicCostSavingsDiscount;
       CurrentDynamicCostSavingsDiscount = UnrollDynamicCostSavingsDiscount;
-      CurrentCount = (C == -1) ? UnrollCount : unsigned(C);
-      CurrentAllowPartial = (P == -1) ? UnrollAllowPartial : (bool)P;
-      CurrentRuntime = (R == -1) ? UnrollRuntime : (bool)R;
+      CurrentCount = (C == -1) ? unsigned(UnrollCount) : unsigned(C);
+      CurrentAllowPartial = (P == -1) ? (bool)UnrollAllowPartial : (bool)P;
+      CurrentRuntime = (R == -1) ? (bool)UnrollRuntime : (bool)R;
 
 
       UserThreshold = (T != -1) || (UnrollThreshold.getNumOccurrences() > 0);
       UserThreshold = (T != -1) || (UnrollThreshold.getNumOccurrences() > 0);
       UserPercentDynamicCostSavedThreshold =
       UserPercentDynamicCostSavedThreshold =