Sfoglia il codice sorgente

Merge pull request #7910 from richardkchapman/pragma-gcc

HPCC-14388 Force full warnings as errors for embedded C++

Reviewed-By: Jamie Noss <james.noss@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 anni fa
parent
commit
d9ea06195f
2 ha cambiato i file con 11 aggiunte e 11 eliminazioni
  1. 9 8
      ecl/hqlcpp/hqlcpp.cpp
  2. 2 3
      testing/regress/ecl/bloom2.ecl

+ 9 - 8
ecl/hqlcpp/hqlcpp.cpp

@@ -11676,20 +11676,21 @@ void HqlCppTranslator::buildCppFunctionDefinition(BuildCtx &funcctx, IHqlExpress
         startLine += memcount(body-start, start, '\n');
     }
 
-    funcctx.addQuotedCompound(proto);
     funcctx.addQuoted("#if defined(__clang__) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))\n"
-                      "#pragma GCC diagnostic error \"-Wall\"\n"
-                      "#pragma GCC diagnostic error \"-Wextra\"\n"
-                      "#endif\n");
+            "#pragma GCC diagnostic error \"-Wall\"\n"
+            "#pragma GCC diagnostic error \"-Wextra\"\n"
+            "#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n"  // Generated prototype tends to include ctx that is often not used
+            "#endif\n");
+
+    funcctx.addQuotedCompound(proto, "\n#if defined(__clang__) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))\n"
+            "#pragma GCC diagnostic ignored \"-Wall\"\n"
+            "#pragma GCC diagnostic ignored \"-Wextra\"\n"
+            "#endif\n");
     if (location)
         funcctx.addLine(locationFilename, startLine);
     funcctx.addQuoted(body);
     if (location)
         funcctx.addLine();
-    funcctx.addQuoted("#if defined(__clang__) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))\n"
-                      "#pragma GCC diagnostic ignored \"-Wall\"\n"
-                      "#pragma GCC diagnostic ignored \"-Wextra\"\n"
-                      "#endif\n");
 }
 
 void HqlCppTranslator::buildScriptFunctionDefinition(BuildCtx &funcctx, IHqlExpression * funcdef, const char *proto)

+ 2 - 3
testing/regress/ecl/bloom2.ecl

@@ -38,11 +38,10 @@ bloomFilter(UNSIGNED DECIMAL6_3 falsePositiveProbability,
         unsigned long long slot = 0;
         unsigned int shift      = 0;
         unsigned int mask       = 0;
-        unsigned int test       = 0;
         const int slotsize = 8;
         unsigned long long numbits = _tablesize * slotsize;
         byte * outbits = self + sizeof(unsigned);
-        for (int i=0; i< _numhashes; i++) {
+        for (unsigned i=0; i< _numhashes; i++) {
           // Kirsch and Mitzenmacher technique (Harvard U)
           bit   =  (hash1 + (i * hash2)) % numbits;
           slot  = bit / slotsize;
@@ -91,7 +90,7 @@ bloomFilter(UNSIGNED DECIMAL6_3 falsePositiveProbability,
         bool retval = true;
 
         // Test each bit in the char array
-        for (int i=0; i< _numhashes; i++) {
+        for (unsigned i=0; i< _numhashes; i++) {
             // Kirsch and Mitzenmacher technique (Harvard U)
             bit   =  (hash1 + (i * hash2)) % numbits;
             slot  = bit / 8;