[Libreoffice-commits] core.git: idlc/inc idlc/source

Stephan Bergmann sbergman at redhat.com
Mon May 18 01:16:26 PDT 2015


 idlc/inc/idlc/astoperation.hxx |    4 ++--
 idlc/inc/idlc/astsequence.hxx  |    6 +++---
 idlc/source/parser.y           |   41 ++++++++++++++---------------------------
 idlc/source/scanner.l          |   10 +++++-----
 4 files changed, 24 insertions(+), 37 deletions(-)

New commits:
commit 7079e88d6aaf14e3f2b4260ade6996c7bef62e2f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon May 18 10:15:58 2015 +0200

    idlc: fix warnings
    
    Change-Id: I2ef51fae0bc4425c5d2b6707d1df381888b427e7

diff --git a/idlc/inc/idlc/astoperation.hxx b/idlc/inc/idlc/astoperation.hxx
index 4eb5e2d..fd70cc3 100644
--- a/idlc/inc/idlc/astoperation.hxx
+++ b/idlc/inc/idlc/astoperation.hxx
@@ -30,7 +30,7 @@ class AstOperation : public AstDeclaration
                    , public AstScope
 {
 public:
-    AstOperation(AstType* pReturnType, const OString& name, AstScope* pScope)
+    AstOperation(AstType const * pReturnType, const OString& name, AstScope* pScope)
         : AstDeclaration(NT_operation, name, pScope)
         , AstScope(NT_operation)
         , m_pReturnType(pReturnType)
@@ -52,7 +52,7 @@ public:
     // scope management
     virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl) SAL_OVERRIDE;
 private:
-    AstType*    m_pReturnType;
+    AstType const * m_pReturnType;
     DeclList    m_exceptions;
 };
 
diff --git a/idlc/inc/idlc/astsequence.hxx b/idlc/inc/idlc/astsequence.hxx
index 6e0eb17..5deda36 100644
--- a/idlc/inc/idlc/astsequence.hxx
+++ b/idlc/inc/idlc/astsequence.hxx
@@ -24,7 +24,7 @@
 class AstSequence : public AstType
 {
 public:
-    AstSequence(AstType* pMemberType, AstScope* pScope)
+    AstSequence(AstType const * pMemberType, AstScope* pScope)
         : AstType(NT_sequence, OString("[]")+pMemberType->getScopedName(), pScope)
         , m_pMemberType(pMemberType)
         , m_pRelativName(NULL)
@@ -35,7 +35,7 @@ public:
             delete m_pRelativName;
     }
 
-    AstType* getMemberType() const
+    AstType const * getMemberType() const
         { return m_pMemberType; }
 
     virtual bool isUnsigned() const SAL_OVERRIDE
@@ -43,7 +43,7 @@ public:
 
     virtual const sal_Char* getRelativName() const SAL_OVERRIDE;
 private:
-    AstType*        m_pMemberType;
+    AstType const * m_pMemberType;
     mutable OString* m_pRelativName;
 };
 
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index c55c7c2..52bcdf8 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -332,7 +332,7 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
 
 %type <exval>   expression const_expr or_expr xor_expr and_expr
 %type <exval>   add_expr mult_expr unary_expr primary_expr shift_expr
-%type <exval>   literal positive_int_expr
+%type <exval>   literal
 
 %type <fdval>   declarator
 %type <dlval>   declarators at_least_one_declarator
@@ -464,7 +464,7 @@ module_dcl :
                     }
                 }
                 delete(pModule);
-                pModule = (AstModule*)pExists;
+                pModule = static_cast<AstModule*>(pExists);
             } else
             {
                 pScope->addDeclaration(pModule);
@@ -573,7 +573,7 @@ interface_dcl :
                  */
                 if (pDecl->getNodeType() == NT_interface)
                 {
-                    pForward = (AstInterface*)pDecl;
+                    pForward = static_cast<AstInterface*>(pDecl);
                     if ( !pForward->isDefined() )
                     {
                         /*
@@ -946,7 +946,7 @@ operation :
          */
         if ( pScope && $1 )
         {
-            AstType *pType = (AstType*)$1;
+            AstType const *pType = static_cast<AstType const *>($1);
             if ( !pType || (pType->getNodeType() == NT_exception) )
             {
                 // type ERROR
@@ -990,7 +990,7 @@ operation :
          */
         if ( pScope && pScope->getScopeNodeType() == NT_operation)
         {
-            pOp = (AstOperation*)pScope;
+            pOp = static_cast<AstOperation*>(pScope);
 
             if ( pOp )
                 pOp->setExceptions($11);
@@ -1288,7 +1288,7 @@ constants_dcl :
             {
                 pExists->setInMainfile(idlc()->isInMainFile());
                 delete(pConstants);
-                pConstants = (AstConstants*)pExists;
+                pConstants = static_cast<AstConstants*>(pExists);
             } else
             {
                 pScope->addDeclaration(pConstants);
@@ -1434,19 +1434,6 @@ literal :
     }
     ;
 
-positive_int_expr :
-    const_expr
-    {
-        $1->evaluate(EK_const);
-        if ( !$1->coerce(ET_ulong) )
-        {
-            ErrorHandler::coercionError($1, ET_ulong);
-            delete $1;
-            $$ = NULL;
-        }
-    }
-    ;
-
 const_type :
     integer_type
     | byte_type
@@ -1652,7 +1639,7 @@ service_export :
                         if ( ErrorHandler::checkPublished(pDecl, bOptional) )
                         {
                             pIMember = new AstInterfaceMember(
-                                $1, (AstInterface*)pDecl, *iter, pScope);
+                                $1, static_cast<AstInterface*>(pDecl), *iter, pScope);
                             pScope->addDeclaration(pIMember);
                         }
                     } else
@@ -1694,7 +1681,7 @@ service_export :
                     else if ( ErrorHandler::checkPublished(pDecl) )
                     {
                         pSMember = new AstServiceMember(
-                            $1, (AstService*)pDecl, *iter, pScope);
+                            $1, static_cast<AstService*>(pDecl), *iter, pScope);
                         pScope->addDeclaration(pSMember);
                     }
                 } else
@@ -1735,7 +1722,7 @@ service_export :
                     pDecl = pScope->lookupByName(*iter);
                     if ( pDecl && (pDecl->getNodeType() == NT_interface) )
                     {
-                        pObserves = new AstObserves((AstInterface*)pDecl, *iter, pScope);
+                        pObserves = new AstObserves(static_cast<AstInterface*>(pDecl), *iter, pScope);
                         pScope->addDeclaration(pObserves);
                     } else
                     {
@@ -1776,7 +1763,7 @@ service_export :
                     pDecl = pScope->lookupByName(*iter);
                     if ( pDecl && (pDecl->getNodeType() == NT_service) )
                     {
-                        pNeeds = new AstNeeds((AstService*)pDecl, *iter, pScope);
+                        pNeeds = new AstNeeds(static_cast<AstService*>(pDecl), *iter, pScope);
                         pScope->addDeclaration(pNeeds);
                     } else
                     {
@@ -2405,7 +2392,7 @@ sequence_type_spec :
 
         if ( $5 )
         {
-            AstType *pType = (AstType*)$5;
+            AstType const *pType = static_cast<AstType const *>($5);
             if ( pType )
             {
                 pSeq = new AstSequence(pType, pScope);
@@ -2672,7 +2659,7 @@ enum_type :
             $$ = NULL;
         else
         {
-            $$ = (AstEnum*)idlc()->scopes()->topNonNull();
+            $$ = static_cast<AstEnum*>(idlc()->scopes()->topNonNull());
             idlc()->scopes()->pop();
         }
     }
@@ -2706,7 +2693,7 @@ enumerator :
 
         if ( pScope && pScope->getScopeNodeType() == NT_enum)
         {
-            pEnum = (AstEnum*)pScope;
+            pEnum = static_cast<AstEnum*>(pScope);
             if (pEnum && $1)
             {
                 AstExpression* pExpr = new AstExpression(pEnum->getEnumValueCount());
@@ -2735,7 +2722,7 @@ enumerator :
             $3->evaluate(EK_const);
             if ( $3->coerce(ET_long) )
             {
-                pEnum = (AstEnum*)pScope;
+                pEnum = static_cast<AstEnum*>(pScope);
                 if (pEnum)
                 {
                     pEnumVal = new AstConstant(ET_long , NT_enum_val,
diff --git a/idlc/source/scanner.l b/idlc/source/scanner.l
index 5f9b7a2..16ee27a 100644
--- a/idlc/source/scanner.l
+++ b/idlc/source/scanner.l
@@ -105,7 +105,7 @@ static int asciiToInteger(char const * s, sal_Int64  * sval, sal_uInt64 * uval)
         // std::numeric_limits<sal_uInt64>::max() == SAL_MAX_UINT64:
         sal_uInt64 nval = val * base + n;
         if (nval < val) {
-            idlc()->error()->syntaxError(
+            ErrorHandler::syntaxError(
                 PS_NoState, idlc()->getLineNumber(),
                 "integral constant too large");
             val = 0;
@@ -120,7 +120,7 @@ static int asciiToInteger(char const * s, sal_Int64  * sval, sal_uInt64 * uval)
         } else if (val == SAL_CONST_UINT64(0x8000000000000000)) {
             *sval = SAL_MIN_INT64;
         } else {
-            idlc()->error()->syntaxError(
+            ErrorHandler::syntaxError(
                 PS_NoState, idlc()->getLineNumber(),
                 "negative integral constant too large");
             *sval = 0;
@@ -233,7 +233,7 @@ static void parseLineAndFile(sal_Char* pBuf)
 	else
 		idlc()->setFileName(::rtl::OString(h));
 
-	bIsInMain = (idlc()->getFileName() == idlc()->getRealFileName()) ? sal_True : sal_False;
+	bIsInMain = idlc()->getFileName() == idlc()->getRealFileName();
 	idlc()->setInMainfile(bIsInMain);		
 }	
 
@@ -439,7 +439,7 @@ published       return IDL_PUBLISHED;
 				{
                     if ( 0 != nIndex &&
                          (docu.getStr()[nIndex - 1] != '"' && docu.getStr()[nIndex - 1] != ':') )
-                        idlc()->error()->syntaxError(PS_NoState, idlc()->getLineNumber(),
+                        ErrorHandler::syntaxError(PS_NoState, idlc()->getLineNumber(),
                                                      "nested documentation strings are not allowed!");
 				}
 				idlc()->setDocumentation(docu);
@@ -456,7 +456,7 @@ published       return IDL_PUBLISHED;
 				{
                     if ( 0 != nIndex &&
                          (docu.getStr()[nIndex - 1] != '"' && docu.getStr()[nIndex - 1] != ':') )
-                        idlc()->error()->syntaxError(PS_NoState, idlc()->getLineNumber(),
+                        ErrorHandler::syntaxError(PS_NoState, idlc()->getLineNumber(),
                                                      "nested documentation strings are not allowed!");
 				}
 				idlc()->setDocumentation(docu);


More information about the Libreoffice-commits mailing list