[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kconfig_compiler
From:       David Faure <faure () kde ! org>
Date:       2009-03-19 23:29:45
Message-ID: 1237505385.549965.32359.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 941567 by dfaure:

I disagree with Andreas Pakulat, this compiler warning in code generated by \
                kconfig_compiler is fixable ;-) Proof below.
BUG: 187579


 M  +16 -7     kconfig_compiler.cpp  


--- trunk/KDE/kdelibs/kdecore/kconfig_compiler/kconfig_compiler.cpp #941566:941567
@@ -781,6 +781,13 @@
   return result;
 }
 
+static bool isUnsigned(const QString& type)
+{
+    if ( type == "UInt" )        return true;
+    if ( type == "ULongLong" )   return true;
+    return false;
+}
+
 /**
   Return parameter declaration for given type.
 */
@@ -1075,13 +1082,15 @@
 
   if (!e->minValue().isEmpty())
   {
-    out << "if (v < " << e->minValue() << ")" << endl;
-    out << "{" << endl;
-    out << "  kDebug() << \"" << setFunction(n);
-    out << ": value \" << v << \" is less than the minimum value of ";
-    out << e->minValue()<< "\" << endl;" << endl;
-    out << "  v = " << e->minValue() << ";" << endl;
-    out << "}" << endl;
+    if (e->minValue() != "0" || !isUnsigned(t)) { // skip writing "if uint<0" \
(#187579) +      out << "if (v < " << e->minValue() << ")" << endl;
+      out << "{" << endl;
+      out << "  kDebug() << \"" << setFunction(n);
+      out << ": value \" << v << \" is less than the minimum value of ";
+      out << e->minValue()<< "\" << endl;" << endl;
+      out << "  v = " << e->minValue() << ";" << endl;
+      out << "}" << endl;
+    }
   }
 
   if (!e->maxValue().isEmpty())


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic