فهرست منبع

Fix some Clang -Wstring-conversion warnings

Some false positives, but some flagged faulty asserts
where the ! was inside the string instead of outside.
Sean McBride 11 سال پیش
والد
کامیت
2e92570bda

+ 1 - 1
Source/cmGeneratorExpression.cxx

@@ -447,7 +447,7 @@ std::string cmGeneratorExpression::Preprocess(const std::string &input,
     return stripExportInterface(input, context, resolveRelative);
     }
 
-  assert(!"cmGeneratorExpression::Preprocess called with invalid args");
+  assert(0 && "cmGeneratorExpression::Preprocess called with invalid args");
   return std::string();
 }
 

+ 2 - 2
Source/cmGeneratorExpressionEvaluator.cxx

@@ -1429,7 +1429,7 @@ cmPolicies::PolicyStatus statusForTarget(cmTarget const* tgt,
 
 #undef RETURN_POLICY
 
-  assert("!Unreachable code. Not a valid policy");
+  assert(0 && "Unreachable code. Not a valid policy");
   return cmPolicies::WARN;
 }
 
@@ -1445,7 +1445,7 @@ cmPolicies::PolicyID policyForString(const char *policy_id)
 
 #undef RETURN_POLICY_ID
 
-  assert("!Unreachable code. Not a valid policy");
+  assert(0 && "Unreachable code. Not a valid policy");
   return cmPolicies::CMP0002;
 }
 

+ 2 - 2
Source/cmGeneratorExpressionParser.cxx

@@ -292,11 +292,11 @@ void cmGeneratorExpressionParser::ParseContent(
         }
       else
         {
-          assert(!"Got unexpected syntax token.");
+          assert(0 && "Got unexpected syntax token.");
         }
       assert(this->it != this->Tokens.end());
       ++this->it;
       return;
     }
-    assert(!"Unhandled token in generator expression.");
+    assert(0 && "Unhandled token in generator expression.");
 }

+ 1 - 1
Source/cmInstallTargetGenerator.cxx

@@ -95,7 +95,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
     case cmTarget::INTERFACE_LIBRARY:
       // Not reachable. We never create a cmInstallTargetGenerator for
       // an INTERFACE_LIBRARY.
-      assert(!"INTERFACE_LIBRARY targets have no installable outputs.");
+      assert(0 && "INTERFACE_LIBRARY targets have no installable outputs.");
       break;
     case cmTarget::OBJECT_LIBRARY:
     case cmTarget::UTILITY:

+ 6 - 6
Source/cmTarget.cxx

@@ -4856,7 +4856,7 @@ std::pair<bool, const char*> consistentProperty(const char *lhs,
   switch(t)
   {
   case BoolType:
-    assert(!"consistentProperty for strings called with BoolType");
+    assert(0 && "consistentProperty for strings called with BoolType");
     return std::pair<bool, const char*>(false, null_ptr);
   case StringType:
     return consistentStringProperty(lhs, rhs);
@@ -4864,7 +4864,7 @@ std::pair<bool, const char*> consistentProperty(const char *lhs,
   case NumberMaxType:
     return consistentNumberProperty(lhs, rhs, t);
   }
-  assert(!"Unreachable!");
+  assert(0 && "Unreachable!");
   return std::pair<bool, const char*>(false, null_ptr);
 }
 
@@ -4949,7 +4949,7 @@ std::string compatibilityType(CompatibleType t)
     case NumberMinType:
       return "Numeric minimum compatibility";
     }
-  assert(!"Unreachable!");
+  assert(0 && "Unreachable!");
   return "";
 }
 
@@ -4965,7 +4965,7 @@ std::string compatibilityAgree(CompatibleType t, bool dominant)
     case NumberMinType:
       return dominant ? "(Dominant)\n" : "(Ignored)\n";
     }
-  assert(!"Unreachable!");
+  assert(0 && "Unreachable!");
   return "";
 }
 
@@ -6578,7 +6578,7 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
   switch(t)
   {
   case BoolType:
-    assert(!"String compatibility check function called for boolean");
+    assert(0 && "String compatibility check function called for boolean");
     return 0;
   case StringType:
     return tgt->GetLinkInterfaceDependentStringProperty(prop, config);
@@ -6587,7 +6587,7 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
   case NumberMaxType:
     return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config);
   }
-  assert(!"Unreachable!");
+  assert(0 && "Unreachable!");
   return 0;
 }