Преглед на файлове

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

Turn off the unused-parameter warning - it's common to not use the ctx, for
example.

Fix a couple of warnings in the bloom2 example's C++ code.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman преди 9 години
родител
ревизия
191cc7a96b
променени са 2 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 1 0
      ecl/hqlcpp/hqlcpp.cpp
  2. 2 3
      testing/regress/ecl/bloom2.ecl

+ 1 - 0
ecl/hqlcpp/hqlcpp.cpp

@@ -11679,6 +11679,7 @@ void HqlCppTranslator::buildCppFunctionDefinition(BuildCtx &funcctx, IHqlExpress
     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"
+            "#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"

+ 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;