Browse Source

HPCC-10977 Minor changes following code review

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 11 years ago
parent
commit
6b56e439e5
4 changed files with 12 additions and 6 deletions
  1. 2 1
      ecl/hql/hqlerror.cpp
  2. 0 1
      ecl/hql/hqlgram.hpp
  3. 9 2
      ecl/hql/hqlgram2.cpp
  4. 1 2
      ecl/hqlcpp/hqlttcpp.cpp

+ 2 - 1
ecl/hql/hqlerror.cpp

@@ -412,7 +412,8 @@ void checkEclVersionCompatible(Shared<IErrorReceiver> & errors, const char * ecl
             else if (minor != LANGUAGE_VERSION_MINOR)
             {
                 VStringBuffer msg("Mismatch in minor version number (%s v %s)", eclVersion, LANGUAGE_VERSION);
-                errors->reportWarning(CategoryUnexpected, SeverityInfo, msg.str(), NULL, 0, 0, 0);
+                Owned<IECLError> warning = createECLError(CategoryUnexpected, SeverityInfo, HQLERR_VersionMismatch, msg.str(), NULL, 0, 0);
+                errors.setown(new ErrorInserter(*errors, warning));
             }
             else if (subminor != LANGUAGE_VERSION_SUB)
             {

+ 0 - 1
ecl/hql/hqlgram.hpp

@@ -583,7 +583,6 @@ public:
     virtual void reportError(int errNo, const char *msg, const char *filename=NULL, int lineno=0, int column=0, int pos=0);
     virtual void report(IECLError * error);
     virtual IECLError * mapError(IECLError * error);
-
     void reportWarning(WarnErrorCategory category, int warnNo, const char *msg, const char *filename=NULL, int lineno=0, int column=0, int pos=0);
     virtual size32_t errCount();
     virtual size32_t warnCount();

+ 9 - 2
ecl/hql/hqlgram2.cpp

@@ -54,6 +54,7 @@
 //#define USE_WHEN_FOR_SIDEEFFECTS
 #define MANYFIELDS_THRESHOLD                        2000
 #define MAX_SENSIBLE_FIELD_LENGTH                   1000000000
+#define MAX_POSSIBLE_FIELD_LENGTH                   (INFINITE_LENGTH-1)
 
 struct TokenMap
 {
@@ -2434,8 +2435,14 @@ void HqlGram::addField(const attribute &errpos, IIdAtom * name, ITypeInfo *_type
         }
     }
 
-    if ((fieldType->getSize() != UNKNOWN_LENGTH) && (fieldType->getSize() > MAX_SENSIBLE_FIELD_LENGTH))
-        reportWarning(CategoryEfficiency, SeverityError, ERR_BAD_FIELD_SIZE, errpos.pos, "Field %s is too large", name->str());
+    size32_t fieldSize = fieldType->getSize();
+    if (fieldSize != UNKNOWN_LENGTH)
+    {
+        if (fieldSize > MAX_SENSIBLE_FIELD_LENGTH)
+            reportWarning(CategoryEfficiency, SeverityError, ERR_BAD_FIELD_SIZE, errpos.pos, "Field %s is larger than max sensible size", name->str());
+        else if (fieldSize > MAX_POSSIBLE_FIELD_LENGTH)
+            reportError(ERR_BAD_FIELD_SIZE, errpos.pos, "Field %s is too large", name->str());
+    }
 
     OwnedHqlExpr newField = createField(name, fieldType.getClear(), value.getClear(), attrs);
     OwnedHqlExpr annotated = createLocationAnnotation(LINK(newField), errpos.pos);

+ 1 - 2
ecl/hqlcpp/hqlttcpp.cpp

@@ -10327,10 +10327,9 @@ IHqlExpression * NestedCompoundTransformer::createTransformed(IHqlExpression * e
                     location = queryActiveLocation();
                 if (!isSimpleSideeffect(sideEffect))
                 {
-                    //MORE: This should be an error, but there are still occasional false positives e.g., OUTPUT(ds1.childds)
+                    //MORE: This should possibly be an error, but there are still false positives e.g., OUTPUT(ds1.childds)
                     //so needs to stay a warning.
 //                  translator.ERRORAT1(location, HQLERR_GlobalSideEffectDependent, s.str());
-                    //GH: Make this a default error severity
                     translator.WARNINGAT1(CategoryUnexpected, location, HQLWRN_GlobalSideEffectDependent, s.str());
                 }
                 break;