From 7079e88d6aaf14e3f2b4260ade6996c7bef62e2f Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 18 May 2015 10:15:58 +0200 Subject: idlc: fix warnings Change-Id: I2ef51fae0bc4425c5d2b6707d1df381888b427e7 --- 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(-) diff --git a/idlc/inc/idlc/astoperation.hxx b/idlc/inc/idlc/astoperation.hxx index 4eb5e2dafa9d..fd70cc39675d 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 6e0eb173693b..5deda3673cc1 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 c55c7c2f089e..52bcdf862b7f 100644 --- a/idlc/source/parser.y +++ b/idlc/source/parser.y @@ -332,7 +332,7 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) { %type expression const_expr or_expr xor_expr and_expr %type add_expr mult_expr unary_expr primary_expr shift_expr -%type literal positive_int_expr +%type literal %type declarator %type declarators at_least_one_declarator @@ -464,7 +464,7 @@ module_dcl : } } delete(pModule); - pModule = (AstModule*)pExists; + pModule = static_cast(pExists); } else { pScope->addDeclaration(pModule); @@ -573,7 +573,7 @@ interface_dcl : */ if (pDecl->getNodeType() == NT_interface) { - pForward = (AstInterface*)pDecl; + pForward = static_cast(pDecl); if ( !pForward->isDefined() ) { /* @@ -946,7 +946,7 @@ operation : */ if ( pScope && $1 ) { - AstType *pType = (AstType*)$1; + AstType const *pType = static_cast($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(pScope); if ( pOp ) pOp->setExceptions($11); @@ -1288,7 +1288,7 @@ constants_dcl : { pExists->setInMainfile(idlc()->isInMainFile()); delete(pConstants); - pConstants = (AstConstants*)pExists; + pConstants = static_cast(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(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(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(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(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($5); if ( pType ) { pSeq = new AstSequence(pType, pScope); @@ -2672,7 +2659,7 @@ enum_type : $$ = NULL; else { - $$ = (AstEnum*)idlc()->scopes()->topNonNull(); + $$ = static_cast(idlc()->scopes()->topNonNull()); idlc()->scopes()->pop(); } } @@ -2706,7 +2693,7 @@ enumerator : if ( pScope && pScope->getScopeNodeType() == NT_enum) { - pEnum = (AstEnum*)pScope; + pEnum = static_cast(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(pScope); if (pEnum) { pEnumVal = new AstConstant(ET_long , NT_enum_val, diff --git a/idlc/source/scanner.l b/idlc/source/scanner.l index 5f9b7a222029..16ee27a93fe4 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::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); -- cgit v1.2.3