Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-2015

Fix warnings under g++ 4.7.2 with -Wall

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 2.8.0
    • 2.8.0
    • None

    Description

      SchemaAttDef.hpp and SchemaElementDecl.hpp both trigger warnings under -Wall with g++ 4.7.2. In our environment, since we use -Werror for validation, these become a more serious issue.

      There are 2 categories of fixes - a signed/unsigned comparison mismatch in SchemaElementDecl::isGlobalDecl, and some missing parens in if statements in SchemaAttDef::getMemberTypeAnonymous() and bool SchemaElementDecl::isTypeDefinitionUnion().

      Here's a patch:


      src/xercesc/validators/schema/SchemaAttDef.hpp | 4 ++--
      src/xercesc/validators/schema/SchemaElementDecl.hpp | 6 +++---
      2 files changed, 5 insertions, 5 deletions

      diff --git a/src/xercesc/validators/schema/SchemaAttDef.hpp b/src/xercesc/validators/schema/SchemaAttDef.hpp
      index 7648de0..2c069b7 100644
      — a/src/xercesc/validators/schema/SchemaAttDef.hpp
      +++ b/src/xercesc/validators/schema/SchemaAttDef.hpp
      @@ -401,8 +401,8 @@ inline bool SchemaAttDef::getMemberTypeAnonymous() const {
      }

      inline bool SchemaAttDef::isTypeDefinitionUnion() const

      { - if(fAnyDatatypeValidator && fAnyDatatypeValidator->getType() == DatatypeValidator::Union || - fDatatypeValidator && fDatatypeValidator->getType() == DatatypeValidator::Union) + if( (fAnyDatatypeValidator && fAnyDatatypeValidator->getType() == DatatypeValidator::Union) + || (fDatatypeValidator && fDatatypeValidator->getType() == DatatypeValidator::Union)) return true; return false; }

      diff --git a/src/xercesc/validators/schema/SchemaElementDecl.hpp b/src/xercesc/validators/schema/SchemaElementDecl.hpp
      index 9ffc2f2..5f9ad8f 100644
      — a/src/xercesc/validators/schema/SchemaElementDecl.hpp
      +++ b/src/xercesc/validators/schema/SchemaElementDecl.hpp
      @@ -506,7 +506,7 @@ inline SchemaAttDef* SchemaElementDecl::getAttWildCard() {

      inline bool SchemaElementDecl::isGlobalDecl() const

      { - return (fEnclosingScope == Grammar::TOP_LEVEL_SCOPE); + return (static_cast<unsigned int>(fEnclosingScope) == Grammar::TOP_LEVEL_SCOPE); }

      inline SchemaElementDecl*
      @@ -591,8 +591,8 @@ inline bool SchemaElementDecl::getMemberTypeAnonymous() const {
      inline bool SchemaElementDecl::isTypeDefinitionUnion() const

      { // removing fXsi* references would break DOMTypeInfo implementation completely; // will have to wait for now - if(fXsiSimpleTypeInfo && fXsiSimpleTypeInfo->getType() == DatatypeValidator::Union || - fDatatypeValidator && fDatatypeValidator->getType() == DatatypeValidator::Union) + if( (fXsiSimpleTypeInfo && fXsiSimpleTypeInfo->getType() == DatatypeValidator::Union) + || (fDatatypeValidator && fDatatypeValidator->getType() == DatatypeValidator::Union)) return true; return false; }

      Attachments

        1. xercesc-2015.patch
          2 kB
          Mike Giroux

        Activity

          People

            Unassigned Unassigned
            mgiroux Mike Giroux
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: