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

2021-09-22 Thread Stephan Bergmann (via logerrit)
 idlc/inc/idlc.hxx   |2 +-
 idlc/source/astscope.cxx|6 --
 idlc/source/idlccompile.cxx |5 +++--
 3 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 4706eb93350b2613b1fe6b98afa1243415c40577
Author: Stephan Bergmann 
AuthorDate: Wed Sep 22 22:19:43 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 23 07:27:14 2021 +0200

Extend loplugin:stringviewparam to starts/endsWith: idlc

Change-Id: Ib9c97576746b6acfddeacec658a2ae994aa28516
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122497
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/idlc/inc/idlc.hxx b/idlc/inc/idlc.hxx
index 8995ead72de4..1be11b1457da 100644
--- a/idlc/inc/idlc.hxx
+++ b/idlc/inc/idlc.hxx
@@ -147,7 +147,7 @@ void removeIfExists(std::string_view pathname);
 bool copyFile(const OString* source, const OString& target);
 // a null source means stdin
 
-bool isFileUrl(const OString& fileName);
+bool isFileUrl(std::string_view fileName);
 OString convertToAbsoluteSystemPath(const OString& fileName);
 OString convertToFileUrl(const OString& fileName);
 
diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx
index d4c0f954367c..ca6214129c87 100644
--- a/idlc/source/astscope.cxx
+++ b/idlc/source/astscope.cxx
@@ -20,17 +20,19 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 
-static bool isGlobal(const OString& scopedName)
+static bool isGlobal(std::string_view scopedName)
 {
-return scopedName.isEmpty() || scopedName.startsWith(":");
+return scopedName.empty() || o3tl::starts_with(scopedName, ":");
 }
 
 AstScope::AstScope(NodeType nodeType)
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 1902d63e0cad..6db9a615d316 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -52,9 +53,9 @@ extern int yydebug;
 
 static char tmpFilePattern[512];
 
-bool isFileUrl(const OString& fileName)
+bool isFileUrl(std::string_view fileName)
 {
-return fileName.startsWith("file://");
+return o3tl::starts_with(fileName, "file://");
 }
 
 OString convertToAbsoluteSystemPath(const OString& fileName)


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

2020-09-21 Thread Andrea Gelmini (via logerrit)
 idlc/inc/idlctypes.hxx   |2 +-
 idlc/source/errorhandler.cxx |4 ++--
 idlc/source/parser.y |2 +-
 idlc/test/parser/attribute.tests |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit fec332602976676e1689a45ed846488f2484c89e
Author: Andrea Gelmini 
AuthorDate: Sat Aug 22 18:40:29 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Sep 21 15:24:43 2020 +0200

Fix typo in code

Change-Id: Ib026080d70fb7cf97f7f90079dbb4e1f6d77a05e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101197
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
Reviewed-by: Stephan Bergmann 

diff --git a/idlc/inc/idlctypes.hxx b/idlc/inc/idlctypes.hxx
index 639360509968..c7247be6c86d 100644
--- a/idlc/inc/idlctypes.hxx
+++ b/idlc/inc/idlctypes.hxx
@@ -154,7 +154,7 @@ enum ParseState
 PS_BoundSeen,   // Seen BOUND  keyword
 PS_ConstrainedSeen, // Seen CONSTRAINED keyword
 PS_TransientSeen,   // Seen TRANSIENT keyword
-PS_MayBeAmbigiousSeen,  // Seen MAYBEAMBIGIOUS keyword
+PS_MayBeAmbiguousSeen,  // Seen MAYBEAMBIGUOUS keyword
 PS_MayBeDefaultSeen,// Seen MAYBEDEFAULT keyword
 PS_RemoveableSeen,  // Seen REMOVABLE keyword
 
diff --git a/idlc/source/errorhandler.cxx b/idlc/source/errorhandler.cxx
index 6d2d92ea35e5..1e09bb995302 100644
--- a/idlc/source/errorhandler.cxx
+++ b/idlc/source/errorhandler.cxx
@@ -293,8 +293,8 @@ static const char* parseStateToMessage(ParseState state)
 return "Illegal syntax after CONSTRAINED keyword";
 case PS_TransientSeen:
 return "Illegal syntax after TRANSIENT keyword";
-case PS_MayBeAmbigiousSeen:
-return "Illegal syntax after MAYBEAMBIGIOUS keyword";
+case PS_MayBeAmbiguousSeen:
+return "Illegal syntax after MAYBEAMBIGUOUS keyword";
 case PS_MayBeDefaultSeen:
 return "Illegal syntax after MAYBEDEFAULT keyword";
 case PS_RemoveableSeen:
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index 1d81492562d5..5238f3b5c879 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -805,7 +805,7 @@ opt_attrflag :
 }
 | IDL_MAYBEAMBIGUOUS
 {
-idlc()->setParseState(PS_MayBeAmbigiousSeen);
+idlc()->setParseState(PS_MayBeAmbiguousSeen);
 $$ = AF_MAYBEAMBIGUOUS;
 }
 | IDL_MAYBEDEFAULT
diff --git a/idlc/test/parser/attribute.tests b/idlc/test/parser/attribute.tests
index 73b9d348501a..dd0b85bde9c5 100644
--- a/idlc/test/parser/attribute.tests
+++ b/idlc/test/parser/attribute.tests
@@ -182,7 +182,7 @@ interface I1 {
 
 EXPECT FAILURE "attribute.tests 21":
 interface I1 {
-[attribute, maybeambigious] long a;
+[attribute, maybeambiguous] long a;
 };
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: idlc/inc idlc/source io/source io/test javaunohelper/source jvmfwk/inc jvmfwk/plugins jvmfwk/source l10ntools/source lingucomponent/source linguistic/source linguistic/

2019-12-19 Thread Noel Grandin (via logerrit)
 idlc/inc/astdeclaration.hxx |2 -
 idlc/inc/astexpression.hxx  |2 -
 idlc/inc/astsequence.hxx|2 -
 idlc/inc/errorhandler.hxx   |4 +--
 idlc/source/astdump.cxx |2 -
 idlc/source/astexpression.cxx   |2 -
 idlc/source/errorhandler.cxx|   10 
 idlc/source/idlccompile.cxx |2 -
 idlc/source/parser.y|2 -
 idlc/source/scanner.l   |   14 ++--
 io/source/TextOutputStream/TextOutputStream.cxx |2 -
 io/source/services.cxx  |2 -
 io/test/stm/testfactreg.cxx |2 -
 io/test/testcomponent.cxx   |2 -
 javaunohelper/source/javaunohelper.cxx  |4 +--
 jvmfwk/inc/libxmlutil.hxx   |2 -
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx  |   10 
 jvmfwk/source/elements.cxx  |2 -
 jvmfwk/source/framework.cxx |2 -
 l10ntools/source/helper.cxx |2 -
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx   |2 -
 lingucomponent/source/languageguessing/guesslang.cxx|2 -
 lingucomponent/source/lingutil/lingutil.cxx |2 -
 lingucomponent/source/lingutil/lingutil.hxx |2 -
 lingucomponent/source/numbertext/numbertext.cxx |2 -
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |2 -
 lingucomponent/source/spellcheck/spell/sspellimp.cxx|2 -
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx |2 -
 linguistic/source/convdiclist.cxx   |2 -
 linguistic/source/dicimp.cxx|   14 ++--
 linguistic/source/dlistimp.cxx  |2 -
 linguistic/source/gciterator.cxx|2 -
 linguistic/source/lngopt.cxx|2 -
 linguistic/source/lngreg.cxx|2 -
 linguistic/source/lngreg.hxx|   10 
 linguistic/source/lngsvcmgr.cxx |   10 
 linguistic/workben/sreg.cxx |4 +--
 linguistic/workben/sspellimp.cxx|2 -
 38 files changed, 69 insertions(+), 69 deletions(-)

New commits:
commit c1a4554c67fc975ead3f79b3511a76617e4615b3
Author: Noel Grandin 
AuthorDate: Thu Dec 19 09:46:58 2019 +0200
Commit: Noel Grandin 
CommitDate: Thu Dec 19 09:56:51 2019 +0100

sal_Char->char in idlc..linguistic

Change-Id: Ib30fe34123ad7e5d892e8db9c742e08c4ca8fcd2
Reviewed-on: https://gerrit.libreoffice.org/85477
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/idlc/inc/astdeclaration.hxx b/idlc/inc/astdeclaration.hxx
index aca098d16bbd..ce8f9740a745 100644
--- a/idlc/inc/astdeclaration.hxx
+++ b/idlc/inc/astdeclaration.hxx
@@ -70,7 +70,7 @@ public:
 { return m_scopedName; }
 const OString&   getFullName() const
 { return m_fullName; }
-virtual const sal_Char* getRelativName() const
+virtual const char* getRelativName() const
 { return m_fullName.getStr()+1; }
 AstScope* getScope()
 { return m_pScope; }
diff --git a/idlc/inc/astexpression.hxx b/idlc/inc/astexpression.hxx
index ae96dff602ea..b146e9c85a07 100644
--- a/idlc/inc/astexpression.hxx
+++ b/idlc/inc/astexpression.hxx
@@ -85,7 +85,7 @@ struct AstExprValue
 ExprType et;
 };
 
-const sal_Char* exprTypeToString(ExprType t);
+const char* exprTypeToString(ExprType t);
 
 class AstExpression final
 {
diff --git a/idlc/inc/astsequence.hxx b/idlc/inc/astsequence.hxx
index 0a8efc77b4f8..6c2143267532 100644
--- a/idlc/inc/astsequence.hxx
+++ b/idlc/inc/astsequence.hxx
@@ -35,7 +35,7 @@ public:
 virtual bool isUnsigned() const override
 { return m_pMemberType != nullptr && m_pMemberType->isUnsigned(); }
 
-virtual const sal_Char* getRelativName() const override;
+virtual const char* getRelativName() const override;
 private:
 AstType const * m_pMemberType;
 mutable o3tl::optional m_xRelativName;
diff --git a/idlc/inc/errorhandler.hxx b/idlc/inc/errorhandler.hxx
index 6a26497f042b..9b49f5df441a 100644
--- a/idlc/inc/errorhandler.hxx
+++ b/idlc/inc/errorhandler.hxx
@@ -83,10 +83,10 @@ public:
 static void error3(ErrorCode e, AstDeclaration const * d1, AstDeclaration 
const * d2, AstDeclaration const * d3);
 
 // Warning
-static void warning0(WarningCode e, const sal_Char* warningmsg);
+static void 

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

2018-12-21 Thread Libreoffice Gerrit user
 idlc/inc/astexpression.hxx|5 +++--
 idlc/inc/astsequence.hxx  |2 +-
 idlc/source/astdump.cxx   |8 
 idlc/source/astexpression.cxx |   15 ---
 4 files changed, 16 insertions(+), 14 deletions(-)

New commits:
commit 03fcb4aae62a9403f22ec3671b61555419d02514
Author: Noel Grandin 
AuthorDate: Fri Dec 21 14:35:37 2018 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 22 08:16:55 2018 +0100

idlc: no need to store single OString objects on the heap

Change-Id: I26586ed643d34690b56e40691df9b493a34afa16
Reviewed-on: https://gerrit.libreoffice.org/65536
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/idlc/inc/astexpression.hxx b/idlc/inc/astexpression.hxx
index 68f8c4e4a937..03e47004c232 100644
--- a/idlc/inc/astexpression.hxx
+++ b/idlc/inc/astexpression.hxx
@@ -24,6 +24,7 @@
 #include 
 
 #include "idlc.hxx"
+#include 
 
 // Enum to define all the different operators to combine expressions
 enum class ExprComb
@@ -133,8 +134,8 @@ private:
 m_subExpr2;
 std::unique_ptr
 m_exprValue;
-std::unique_ptr
-m_pSymbolicName;
+boost::optional
+m_xSymbolicName;
 };
 
 #endif // INCLUDED_IDLC_INC_ASTEXPRESSION_HXX
diff --git a/idlc/inc/astsequence.hxx b/idlc/inc/astsequence.hxx
index 5daedf1476d6..229b17dbd2f7 100644
--- a/idlc/inc/astsequence.hxx
+++ b/idlc/inc/astsequence.hxx
@@ -38,7 +38,7 @@ public:
 virtual const sal_Char* getRelativName() const override;
 private:
 AstType const * m_pMemberType;
-mutable std::unique_ptr m_pRelativName;
+mutable boost::optional m_xRelativName;
 };
 
 #endif // INCLUDED_IDLC_INC_ASTSEQUENCE_HXX
diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx
index f3e82bda03a0..6038c4af7997 100644
--- a/idlc/source/astdump.cxx
+++ b/idlc/source/astdump.cxx
@@ -406,14 +406,14 @@ void AstAttribute::dumpExceptions(
 
 const sal_Char* AstSequence::getRelativName() const
 {
-if ( !m_pRelativName )
+if ( !m_xRelativName )
 {
-m_pRelativName.reset( new OString("[]") );
+m_xRelativName = OString("[]");
 AstDeclaration const * pType = resolveTypedefs( m_pMemberType );
-*m_pRelativName += pType->getRelativName();
+*m_xRelativName += pType->getRelativName();
 }
 
-return m_pRelativName->getStr();
+return m_xRelativName->getStr();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx
index 67277376832b..f9f91a719435 100644
--- a/idlc/source/astexpression.cxx
+++ b/idlc/source/astexpression.cxx
@@ -91,8 +91,9 @@ AstExpression::AstExpression(double d)
 
 AstExpression::AstExpression(OString* scopedName)
 : m_combOperator(ExprComb::Symbol)
-, m_pSymbolicName(scopedName)
 {
+if (scopedName)
+m_xSymbolicName = *scopedName;
 fillDefinitionDetails();
 }
 
@@ -877,7 +878,7 @@ std::unique_ptr AstExpression::eval_symbol()
 /*
  * Is there a symbol stored?
  */
-if (m_pSymbolicName == nullptr)
+if (!m_xSymbolicName)
 {
 ErrorHandler::evalError(this);
 return nullptr;
@@ -889,16 +890,16 @@ std::unique_ptr AstExpression::eval_symbol()
 pScope = idlc()->scopes()->topNonNull();
 if ( !pScope )
 {
-ErrorHandler::lookupError(*m_pSymbolicName);
+ErrorHandler::lookupError(*m_xSymbolicName);
 return nullptr;
 }
 /*
  * Do lookup
  */
-pDecl = pScope->lookupByName(*m_pSymbolicName);
+pDecl = pScope->lookupByName(*m_xSymbolicName);
 if (pDecl == nullptr)
 {
-ErrorHandler::lookupError(*m_pSymbolicName);
+ErrorHandler::lookupError(*m_xSymbolicName);
 return nullptr;
 }
 /*
@@ -907,7 +908,7 @@ std::unique_ptr AstExpression::eval_symbol()
 if (pDecl->getNodeType() != NT_const &&
 pDecl->getNodeType() != NT_enum_val)
 {
-ErrorHandler::constantExpected(pDecl, *m_pSymbolicName);
+ErrorHandler::constantExpected(pDecl, *m_xSymbolicName);
 return nullptr;
 }
 if (!ErrorHandler::checkPublished(pDecl))
@@ -927,7 +928,7 @@ OString AstExpression::toString()
 {
 OString exprStr;
 if ( m_combOperator == ExprComb::Symbol )
-return m_pSymbolicName ? *m_pSymbolicName : OString("");
+return m_xSymbolicName ? *m_xSymbolicName : OString("");
 
 if ( m_exprValue )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-02-01 Thread Mike Kaganski
 idlc/inc/idlctypes.hxx |4 
 idlc/source/parser.y   |3 +--
 idlc/source/scanner.l  |1 -
 3 files changed, 1 insertion(+), 7 deletions(-)

New commits:
commit e9073eadef4e7635ab86316d1a68be5023632c78
Author: Mike Kaganski 
Date:   Wed Jan 31 15:32:48 2018 +0300

idlc: MSVC: pragma warning: make more specific, remove obsolete

Change-Id: I0fbba0c1b12f9ade703ceee477dae4056fe9d31e
Reviewed-on: https://gerrit.libreoffice.org/48994
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/idlc/inc/idlctypes.hxx b/idlc/inc/idlctypes.hxx
index 6d013f834e75..273429e530f8 100644
--- a/idlc/inc/idlctypes.hxx
+++ b/idlc/inc/idlctypes.hxx
@@ -39,10 +39,6 @@ class AstScope;
 AstDeclaration* scopeAsDecl(AstScope* pScope);
 AstScope* declAsScope(AstDeclaration* pDecl);
 
-#ifdef _MSC_VER
-#pragma warning( disable : 4541 )
-#endif
-
 // flags used for attributes, properties and services
 #define AF_INVALID  0x
 #define AF_READONLY 0x0001
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index aa8302cac46f..0fe8eb8049c1 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -208,8 +208,7 @@ bool includes(AstDeclaration const * type1, AstDeclaration 
const * type2) {
 
 // Suppress any warnings from generated code:
 #if defined _MSC_VER
-#pragma warning(push, 1)
-#pragma warning(disable: 4273 4701 4702)
+#pragma warning(disable: 4702) // unreachable code
 #endif
 %}
 /*
diff --git a/idlc/source/scanner.l b/idlc/source/scanner.l
index 4c78ab968bd7..180381c3ff38 100644
--- a/idlc/source/scanner.l
+++ b/idlc/source/scanner.l
@@ -252,7 +252,6 @@ static void parseLineAndFile(sal_Char* pBuf)
 #pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-label"
 #elif defined _MSC_VER
-#pragma warning(push, 1)
 /**/
 #ifdef yywrap
 #undef  yywrap
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-17 Thread Noel Grandin
 idlc/inc/idlc.hxx|9 +
 idlc/source/idlc.cxx |   19 ---
 2 files changed, 13 insertions(+), 15 deletions(-)

New commits:
commit 6ae487db5a1045d000c14604503e9c8f3bf24e30
Author: Noel Grandin 
Date:   Wed Jan 17 15:12:55 2018 +0200

fix use of std::unique_ptr in Idlc

I removed the deletes in the destructor in

commit b27fee9e0ebb445ce82baeade3b249807dca392b
Date:   Wed Jan 10 11:44:28 2018 +0200
loplugin:useuniqueptr cppu,idlc,io,ucbhelper

but forgot to do the actual conversion

Change-Id: Icb03070e1d8a2b10ccf892f01e9b44cc6bf0156f

diff --git a/idlc/inc/idlc.hxx b/idlc/inc/idlc.hxx
index 881078303e4a..42f16836adbb 100644
--- a/idlc/inc/idlc.hxx
+++ b/idlc/inc/idlc.hxx
@@ -22,6 +22,7 @@
 #include "idlctypes.hxx"
 #include "aststack.hxx"
 #include "options.hxx"
+#include 
 
 #ifdef SAL_UNX
 #define SEPARATOR '/'
@@ -51,9 +52,9 @@ public:
 Options* getOptions()
 { return m_pOptions; }
 AstStack* scopes()
-{ return m_pScopes; }
+{ return m_pScopes.get(); }
 AstModule* getRoot()
-{ return m_pRoot; }
+{ return m_pRoot.get(); }
 const OString& getFileName() const
 { return m_fileName; }
 void setFileName(const OString& fileName)
@@ -115,8 +116,8 @@ public:
 void reset();
 private:
 Options*m_pOptions;
-AstStack*   m_pScopes;
-AstModule*  m_pRoot;
+std::unique_ptr  m_pScopes;
+std::unique_ptr m_pRoot;
 OString  m_fileName;
 OString  m_mainFileName;
 OString  m_realFileName;
diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx
index 2e7467b8ac59..5e530968cb9b 100644
--- a/idlc/source/idlc.cxx
+++ b/idlc/source/idlc.cxx
@@ -209,7 +209,7 @@ Idlc::Idlc(Options* pOptions)
 , m_offsetEnd(0)
 , m_parseState(PS_NoState)
 {
-m_pScopes = new AstStack();
+m_pScopes.reset( new AstStack() );
 // init root object after construction
 m_pRoot = nullptr;
 m_bGenerateDoc = m_pOptions->isValid("-C");
@@ -221,13 +221,12 @@ Idlc::~Idlc()
 
 void Idlc::init()
 {
-delete m_pRoot;
-m_pRoot = new AstModule(NT_root, OString(), nullptr);
+m_pRoot.reset(new AstModule(NT_root, OString(), nullptr));
 
 // push the root node on the stack
-m_pScopes->push(m_pRoot);
-initializePredefinedTypes(m_pRoot);
-predefineXInterface(m_pRoot);
+m_pScopes->push(m_pRoot.get());
+initializePredefinedTypes(m_pRoot.get());
+predefineXInterface(m_pRoot.get());
 }
 
 void Idlc::reset()
@@ -247,13 +246,11 @@ void Idlc::reset()
 m_documentation.clear();
 
 m_pScopes->clear();
-delete m_pRoot;
-
-m_pRoot = new AstModule(NT_root, OString(), nullptr);
+m_pRoot.reset( new AstModule(NT_root, OString(), nullptr) );
 
 // push the root node on the stack
-m_pScopes->push(m_pRoot);
-initializePredefinedTypes(m_pRoot);
+m_pScopes->push(m_pRoot.get());
+initializePredefinedTypes(m_pRoot.get());
 
 m_includes.clear();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-13 Thread Noel Grandin
 idlc/inc/astsequence.hxx |7 +--
 idlc/inc/fehelper.hxx|   10 ++
 idlc/source/astdump.cxx  |2 +-
 3 files changed, 4 insertions(+), 15 deletions(-)

New commits:
commit 37464a0fb7f3bafe72126e65d34f2c15377a3964
Author: Noel Grandin 
Date:   Thu Jan 11 16:03:46 2018 +0200

loplugin:useuniqueptr in idlc

Change-Id: Iccc50462ca115546422824b6814abf16a029f005
Reviewed-on: https://gerrit.libreoffice.org/47793
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/idlc/inc/astsequence.hxx b/idlc/inc/astsequence.hxx
index 20dac9b4fdc0..1a7a2073f763 100644
--- a/idlc/inc/astsequence.hxx
+++ b/idlc/inc/astsequence.hxx
@@ -29,11 +29,6 @@ public:
 , m_pMemberType(pMemberType)
 , m_pRelativName(nullptr)
 {}
-virtual ~AstSequence() override
-{
-if ( m_pRelativName )
-delete m_pRelativName;
-}
 
 AstType const * getMemberType() const
 { return m_pMemberType; }
@@ -44,7 +39,7 @@ public:
 virtual const sal_Char* getRelativName() const override;
 private:
 AstType const * m_pMemberType;
-mutable OString* m_pRelativName;
+mutable std::unique_ptr m_pRelativName;
 };
 
 #endif // INCLUDED_IDLC_INC_ASTSEQUENCE_HXX
diff --git a/idlc/inc/fehelper.hxx b/idlc/inc/fehelper.hxx
index 11668e6946be..be401defcaa1 100644
--- a/idlc/inc/fehelper.hxx
+++ b/idlc/inc/fehelper.hxx
@@ -46,16 +46,10 @@ public:
 NodeType nodeType, OString* pName, OString const * pInherits,
 std::vector< OString > const * typeParameters);
 
-~FeInheritanceHeader()
-{
-if ( m_pName )
-delete m_pName;
-}
-
 NodeType getNodeType() const
 { return m_nodeType; }
 OString* getName()
-{ return m_pName; }
+{ return m_pName.get(); }
 AstDeclaration* getInherits()
 { return m_pInherits; }
 
@@ -66,7 +60,7 @@ private:
 void initializeInherits(OString const * pinherits);
 
 NodeTypem_nodeType;
-OString* m_pName;
+std::unique_ptr m_pName;
 AstDeclaration* m_pInherits;
 std::vector< OString > m_typeParameters;
 };
diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx
index 945060bce392..7b869b7564dc 100644
--- a/idlc/source/astdump.cxx
+++ b/idlc/source/astdump.cxx
@@ -411,7 +411,7 @@ const sal_Char* AstSequence::getRelativName() const
 {
 if ( !m_pRelativName )
 {
-m_pRelativName = new OString("[]");
+m_pRelativName.reset( new OString("[]") );
 AstDeclaration const * pType = resolveTypedefs( m_pMemberType );
 *m_pRelativName += pType->getRelativName();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-08-06 Thread Noel Grandin
 idlc/inc/astexception.hxx   |2 +-
 idlc/inc/fehelper.hxx   |4 ++--
 idlc/source/fehelper.cxx|4 ++--
 sw/inc/AnnotationWin.hxx|4 ++--
 sw/inc/PostItMgr.hxx|2 +-
 sw/inc/dbmgr.hxx|2 +-
 sw/inc/docsh.hxx|4 ++--
 sw/inc/mdiexp.hxx   |   20 ++--
 sw/inc/swmodule.hxx |4 ++--
 sw/inc/viewopt.hxx  |2 +-
 sw/source/core/doc/docedt.cxx   |2 +-
 sw/source/filter/html/htmlflywriter.cxx |2 +-
 sw/source/filter/html/htmlftn.cxx   |2 +-
 sw/source/filter/html/htmltab.cxx   |4 ++--
 sw/source/filter/html/wrthtml.hxx   |2 +-
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |   14 +++---
 sw/source/filter/xml/XMLRedlineImportHelper.hxx |2 +-
 sw/source/filter/xml/swxml.cxx  |4 ++--
 sw/source/filter/xml/xmlimp.cxx |2 +-
 sw/source/filter/xml/xmlimp.hxx |2 +-
 sw/source/filter/xml/xmlimpit.cxx   |2 +-
 sw/source/uibase/app/appenv.cxx |2 +-
 sw/source/uibase/app/docsh.cxx  |4 ++--
 sw/source/uibase/app/docsh2.cxx |2 +-
 sw/source/uibase/app/docstyle.cxx   |4 ++--
 sw/source/uibase/app/mainwn.cxx |   10 +-
 sw/source/uibase/app/swmodul1.cxx   |6 +++---
 sw/source/uibase/config/viewopt.cxx |2 +-
 sw/source/uibase/dbui/dbmgr.cxx |4 ++--
 sw/source/uibase/dbui/mailmergehelper.cxx   |4 ++--
 sw/source/uibase/dbui/mmconfigitem.cxx  |4 ++--
 sw/source/uibase/dialog/regionsw.cxx|2 +-
 sw/source/uibase/docvw/AnchorOverlayObject.cxx  |2 +-
 sw/source/uibase/docvw/AnchorOverlayObject.hxx  |2 +-
 sw/source/uibase/docvw/AnnotationWin.cxx|2 +-
 sw/source/uibase/docvw/AnnotationWin2.cxx   |4 ++--
 sw/source/uibase/docvw/OverlayRanges.cxx|2 +-
 sw/source/uibase/docvw/OverlayRanges.hxx|2 +-
 sw/source/uibase/docvw/PostItMgr.cxx|2 +-
 sw/source/uibase/docvw/ShadowOverlayObject.cxx  |2 +-
 sw/source/uibase/docvw/ShadowOverlayObject.hxx  |2 +-
 sw/source/uibase/docvw/edtwin.cxx   |   12 ++--
 sw/source/uibase/docvw/edtwin3.cxx  |   12 ++--
 sw/source/uibase/docvw/romenu.cxx   |2 +-
 sw/source/uibase/docvw/romenu.hxx   |2 +-
 sw/source/uibase/envelp/labelcfg.cxx|2 +-
 sw/source/uibase/fldui/fldmgr.cxx   |2 +-
 sw/source/uibase/inc/basesh.hxx |2 +-
 sw/source/uibase/inc/edtwin.hxx |2 +-
 sw/source/uibase/inc/fldmgr.hxx |2 +-
 sw/source/uibase/inc/hyp.hxx|2 +-
 sw/source/uibase/inc/mailmergehelper.hxx|4 ++--
 sw/source/uibase/inc/mmconfigitem.hxx   |4 ++--
 sw/source/uibase/inc/redlndlg.hxx   |2 +-
 sw/source/uibase/lingu/hyp.cxx  |2 +-
 sw/source/uibase/misc/redlndlg.cxx  |2 +-
 56 files changed, 102 insertions(+), 102 deletions(-)

New commits:
commit 8ef6be73325dbb6761b247ff187c709ba0f81bfb
Author: Noel Grandin 
Date:   Sat Aug 5 15:20:21 2017 +0200

loplugin:constparams in sw part6

Change-Id: Ic82946cf9be50d9d9c43338b86dfb700ce5b354c
Reviewed-on: https://gerrit.libreoffice.org/40786
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/idlc/inc/astexception.hxx b/idlc/inc/astexception.hxx
index b69f26f52ff9..12bb642c4004 100644
--- a/idlc/inc/astexception.hxx
+++ b/idlc/inc/astexception.hxx
@@ -24,7 +24,7 @@
 class AstException : public AstStruct
 {
 public:
-AstException(const OString& name, AstException* pBaseType, AstScope* 
pScope)
+AstException(const OString& name, AstException const * pBaseType, 
AstScope* pScope)
 : AstStruct(NT_exception, name, pBaseType, pScope)
 {}
 };
diff --git a/idlc/inc/fehelper.hxx b/idlc/inc/fehelper.hxx
index 730aa05607a1..8ebc1c9f44ce 100644
--- a/idlc/inc/fehelper.hxx
+++ b/idlc/inc/fehelper.hxx
@@ -43,8 +43,8 @@ class FeInheritanceHeader final
 {
 public:
 FeInheritanceHeader(
-NodeType nodeType, OString* pName, OString* pInherits,
-std::vector< OString > * typeParameters);
+NodeType nodeType, OString* pName, OString const * pInherits,
+std::vector< OString > const * typeParameters);
 
 ~FeInheritanceHeader()
 {
diff --git a/idlc/source/fehelper.cxx b/idlc/source/fehelper.cxx
index 1d3fc4154b1b..3a3e5324e303 100644
--- 

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

2017-07-16 Thread Stephan Bergmann
 idlc/inc/astexpression.hxx|2 +-
 idlc/source/astexpression.cxx |8 +---
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit c52cd532b6eea9f32d6d6745818b27adcbf91b16
Author: Stephan Bergmann 
Date:   Sun Jul 16 21:22:13 2017 +0200

Fix lifecycle issue

...as shown by ASan/UBSan build use-after-free report at
 after
8e39ef66928a3e37c618d3a70a631e71266db274 "extend loplugin useuniqueptr to 
POD
types"

Change-Id: Ic42e408c2c4b2901cdf5d681b332543ec8f445ef

diff --git a/idlc/inc/astexpression.hxx b/idlc/inc/astexpression.hxx
index eec117379b6f..e9e92600bad8 100644
--- a/idlc/inc/astexpression.hxx
+++ b/idlc/inc/astexpression.hxx
@@ -122,7 +122,7 @@ private:
 std::unique_ptr eval_bin_op();
 std::unique_ptr eval_bit_op();
 std::unique_ptr eval_un_op();
-AstExprValue* eval_symbol();
+std::unique_ptr eval_symbol();
 
 OString  m_fileName; // fileName defined in
 
diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx
index 0840ccf756d9..8ec1f63b49df 100644
--- a/idlc/source/astexpression.cxx
+++ b/idlc/source/astexpression.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -817,7 +818,7 @@ void AstExpression::evaluate()
 m_exprValue = eval_un_op();
 break;
 case ExprComb::Symbol:
-m_exprValue.reset( eval_symbol() );
+m_exprValue = eval_symbol();
 break;
 case ExprComb::NONE:
 break;
@@ -945,7 +946,7 @@ std::unique_ptr AstExpression::eval_un_op()
 return retval;
 }
 
-AstExprValue* AstExpression::eval_symbol()
+std::unique_ptr AstExpression::eval_symbol()
 {
 AstScope*pScope = nullptr;
 AstDeclaration  *pDecl;
@@ -996,7 +997,8 @@ AstExprValue* AstExpression::eval_symbol()
  */
 pConst = static_cast< AstConstant* >(pDecl);
 pConst->getConstValue()->evaluate();
-return pConst->getConstValue()->getExprValue();
+auto const val = pConst->getConstValue()->getExprValue();
+return val == nullptr ? nullptr : o3tl::make_unique(*val);
 }
 
 OString AstExpression::toString()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-20 Thread Stephan Bergmann
 idlc/inc/idlc.hxx|1 -
 idlc/source/idlc.cxx |2 --
 2 files changed, 3 deletions(-)

New commits:
commit e972d6bb36efaa14eb4983c835491cbcd6283e91
Author: Stephan Bergmann 
Date:   Tue Feb 21 07:37:08 2017 +0100

Idlc::m_pErrorHandler is unused

Change-Id: I41fea5e08381e21dff12f61142a4d54f07a502f4

diff --git a/idlc/inc/idlc.hxx b/idlc/inc/idlc.hxx
index 20665ba..2811c6b 100644
--- a/idlc/inc/idlc.hxx
+++ b/idlc/inc/idlc.hxx
@@ -117,7 +117,6 @@ private:
 Options*m_pOptions;
 AstStack*   m_pScopes;
 AstModule*  m_pRoot;
-ErrorHandler*   m_pErrorHandler;
 OString  m_fileName;
 OString  m_mainFileName;
 OString  m_realFileName;
diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx
index 74e4c35..2d2a94a 100644
--- a/idlc/source/idlc.cxx
+++ b/idlc/source/idlc.cxx
@@ -212,7 +212,6 @@ Idlc::Idlc(Options* pOptions)
 m_pScopes = new AstStack();
 // init root object after construction
 m_pRoot = nullptr;
-m_pErrorHandler = new ErrorHandler();
 m_bGenerateDoc = m_pOptions->isValid("-C");
 }
 
@@ -220,7 +219,6 @@ Idlc::~Idlc()
 {
 delete m_pRoot;
 delete m_pScopes;
-delete m_pErrorHandler;
 }
 
 void Idlc::init()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-10-13 Thread Asela Dasanayaka
 idlc/inc/idlc.hxx   |2 +-
 idlc/inc/idlctypes.hxx  |3 ---
 idlc/inc/options.hxx|4 ++--
 idlc/source/idlcmain.cxx|4 ++--
 idlc/source/idlcproduce.cxx |8 
 idlc/source/parser.y|   22 +++---
 6 files changed, 20 insertions(+), 23 deletions(-)

New commits:
commit 4f0f1b6b5554f49dfe8cca1088d3e5b342b4fd2a
Author: Asela Dasanayaka 
Date:   Thu Oct 13 14:42:16 2016 +0530

tdf#96099 Reduce no of typedefs used for trivial containers

Removed various pinter typedefs in idlc module

Change-Id: Id850558a4550085d47a5e1122b1ce871f15956f2
Reviewed-on: https://gerrit.libreoffice.org/29754
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/idlc/inc/idlc.hxx b/idlc/inc/idlc.hxx
index 56fda18..468bec2 100644
--- a/idlc/inc/idlc.hxx
+++ b/idlc/inc/idlc.hxx
@@ -132,7 +132,7 @@ private:
 sal_uInt32  m_offsetStart;
 sal_uInt32  m_offsetEnd;
 ParseState  m_parseState;
-StringSet   m_includes;
+std::set< OString >   m_includes;
 };
 
 
diff --git a/idlc/inc/idlctypes.hxx b/idlc/inc/idlctypes.hxx
index 12c665c..931afbf 100644
--- a/idlc/inc/idlctypes.hxx
+++ b/idlc/inc/idlctypes.hxx
@@ -30,9 +30,6 @@
 #include 
 #include 
 
-typedef ::std::list< OString >   StringList;
-typedef ::std::vector< OString > StringVector;
-typedef ::std::set< OString >StringSet;
 
 class AstDeclaration;
 
diff --git a/idlc/inc/options.hxx b/idlc/inc/options.hxx
index 3fbfc45..709cfc6 100644
--- a/idlc/inc/options.hxx
+++ b/idlc/inc/options.hxx
@@ -64,14 +64,14 @@ public:
 const OString&   getOption(const OString& option)
 throw( IllegalArgument );
 
-const StringVector& getInputFiles() const { return m_inputFiles; }
+const std::vector< OString >& getInputFiles() const { return m_inputFiles; 
}
 bool readStdin() const { return m_stdin; }
 bool verbose() const { return m_verbose; }
 bool quiet() const { return m_quiet; }
 
 protected:
 OString  m_program;
-StringVectorm_inputFiles;
+std::vector< OString >m_inputFiles;
 boolm_stdin;
 boolm_verbose;
 boolm_quiet;
diff --git a/idlc/source/idlcmain.cxx b/idlc/source/idlcmain.cxx
index d610246..59a656a 100644
--- a/idlc/source/idlcmain.cxx
+++ b/idlc/source/idlcmain.cxx
@@ -72,14 +72,14 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 }
 idlc()->reset();
 }
-StringVector const & files = options.getInputFiles();
+std::vector< OString > const & files = options.getInputFiles();
 if ( options.verbose() )
 {
 fprintf( stdout, "%s: compiling %i source files ... \n",
 options.getProgramName().getStr(), (int)files.size() );
 fflush( stdout );
 }
-for (StringVector::const_iterator i(files.begin());
+for (std::vector< OString >::const_iterator i(files.begin());
  i != files.end() && nErrors == 0; ++i)
 {
 OString sysFileName( convertToAbsoluteSystemPath(*i) );
diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx
index 1588dd3..32e53db 100644
--- a/idlc/source/idlcproduce.cxx
+++ b/idlc/source/idlcproduce.cxx
@@ -39,7 +39,7 @@
 
 using namespace ::osl;
 
-StringList* pCreatedDirectories = nullptr;
+std::list< OString >* pCreatedDirectories = nullptr;
 
 static bool checkOutputPath(const OString& completeName)
 {
@@ -83,7 +83,7 @@ static bool checkOutputPath(const OString& completeName)
 } else
 {
 if ( !pCreatedDirectories )
-pCreatedDirectories = new StringList();
+pCreatedDirectories = new std::list< OString >();
 pCreatedDirectories->push_front(buffer.getStr());
 }
 }
@@ -96,8 +96,8 @@ static bool cleanPath()
 {
 if ( pCreatedDirectories )
 {
-StringList::iterator iter = pCreatedDirectories->begin();
-StringList::iterator end = pCreatedDirectories->end();
+std::list< OString >::iterator iter = pCreatedDirectories->begin();
+std::list< OString >::iterator end = pCreatedDirectories->end();
 while ( iter != end )
 {
 //#ifdef SAL_UNX
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index c045916..6e7bf78 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -235,7 +235,7 @@ bool includes(AstDeclaration const * type1, AstDeclaration 
const * type2) {
 sal_uInt32  ulval;  /* sal_uInt32 value */
 double  dval;   /* double value */
 float   fval;   /* float value */
-StringList* slval;  /* StringList value */
+std::list< OString >* slval;  /* StringList value */
 AttributeExceptions::Part 

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

2016-10-06 Thread Stephan Bergmann
 idlc/inc/astexpression.hxx|4 ++--
 idlc/source/astenum.cxx   |2 +-
 idlc/source/astexpression.cxx |   29 +
 3 files changed, 4 insertions(+), 31 deletions(-)

New commits:
commit f8ecdb7619cad29a6187004e28075efd928bd8aa
Author: Stephan Bergmann 
Date:   Thu Oct 6 16:36:26 2016 +0200

Simplify AstExpression::compare

...to only work with LONG values, as it is only used to compare enumerator
values.  (But keep its general defensive-programming air that's so prevalent
across the idlc code base; not sure whether it could rightfully be 
tightened, or
whether this might be needed in parser's error recovery.)

Change-Id: I15f1700834f9397f3c2e0ffdb00e2abeecb734f9

diff --git a/idlc/inc/astexpression.hxx b/idlc/inc/astexpression.hxx
index ca060719..9bc1b90 100644
--- a/idlc/inc/astexpression.hxx
+++ b/idlc/inc/astexpression.hxx
@@ -114,8 +114,8 @@ public:
 // Evaluate then store value inside this AstExpression
 void evaluate();
 
-// Compare to AstExpressions
-bool compare(AstExpression *pExpr);
+// Compare LONG AstExpression values
+bool compareLong(AstExpression *pExpr);
 
 OString toString();
 private:
diff --git a/idlc/source/astenum.cxx b/idlc/source/astenum.cxx
index f006f61..ece9609 100644
--- a/idlc/source/astenum.cxx
+++ b/idlc/source/astenum.cxx
@@ -43,7 +43,7 @@ AstConstant* AstEnum::checkValue(AstExpression* pExpr)
 AstDeclaration* pDecl = *iter;
 AstConstant* pConst = static_cast(pDecl);
 
-if (pConst->getConstValue()->compare(pExpr))
+if (pConst->getConstValue()->compareLong(pExpr))
 return pConst;
 
 ++iter;
diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx
index 4e583b3..0953c9b 100644
--- a/idlc/source/astexpression.cxx
+++ b/idlc/source/astexpression.cxx
@@ -758,7 +758,7 @@ bool AstExpression::coerce(ExprType t)
 return m_exprValue != nullptr;
 }
 
-bool AstExpression::compare(AstExpression *pExpr)
+bool AstExpression::compareLong(AstExpression *pExpr)
 {
 bool bRet = false;
 if (m_combOperator != pExpr->getCombOperator())
@@ -771,36 +771,9 @@ bool AstExpression::compare(AstExpression *pExpr)
 return bRet;
 switch (m_exprValue->et)
 {
-case ET_short:
-bRet = m_exprValue->u.sval == pExpr->getExprValue()->u.sval;
-break;
-case ET_ushort:
-bRet = m_exprValue->u.usval == pExpr->getExprValue()->u.usval;
-break;
 case ET_long:
 bRet = m_exprValue->u.lval == pExpr->getExprValue()->u.lval;
 break;
-case ET_ulong:
-bRet = m_exprValue->u.ulval == pExpr->getExprValue()->u.ulval;
-break;
-case ET_hyper:
-bRet = m_exprValue->u.hval == pExpr->getExprValue()->u.hval;
-break;
-case ET_uhyper:
-bRet = m_exprValue->u.uhval == pExpr->getExprValue()->u.uhval;
-break;
-case ET_float:
-bRet = m_exprValue->u.fval == pExpr->getExprValue()->u.fval;
-break;
-case ET_double:
-bRet = m_exprValue->u.dval == pExpr->getExprValue()->u.dval;
-break;
-case ET_byte:
-bRet = m_exprValue->u.byval == pExpr->getExprValue()->u.byval;
-break;
-case ET_boolean:
-bRet = m_exprValue->u.lval == pExpr->getExprValue()->u.lval;
-break;
 default:
 OSL_ASSERT(false);
 bRet = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-30 Thread Stephan Bergmann
 idlc/inc/idlc/fehelper.hxx |   13 ++---
 idlc/source/fehelper.cxx   |   14 +++---
 idlc/source/parser.y   |   12 ++--
 3 files changed, 11 insertions(+), 28 deletions(-)

New commits:
commit 0555447cd09fa2851e51cd63543ebc7db0a72a1a
Author: Stephan Bergmann 
Date:   Mon Nov 30 14:53:59 2015 +0100

FD_complex is unused

...since 8e71d9400bd350d63723c5489ddaadb3d3610baf "Remove UNOIDL 'array' and
'union' vaporware from idlc"

Change-Id: Id4cdef900667cdac466a41e47c189e2d25a62065

diff --git a/idlc/inc/idlc/fehelper.hxx b/idlc/inc/idlc/fehelper.hxx
index 6256648..1af6456 100644
--- a/idlc/inc/idlc/fehelper.hxx
+++ b/idlc/inc/idlc/fehelper.hxx
@@ -27,23 +27,14 @@
 class FeDeclarator
 {
 public:
-// Enum to denote types of declarators
-enum DeclaratorType
-{
-FD_simple,  // Simple declarator
-FD_complex  // Complex declarator (complex_part field used)
-};
-
-FeDeclarator(const OString& name, DeclaratorType declType, AstDeclaration* 
pComplPart);
+FeDeclarator(const OString& name);
 virtual ~FeDeclarator();
 const OString& getName()
 { return m_name; }
 bool checkType(AstDeclaration const * pType);
-AstType const * compose(AstDeclaration const * pDecl);
+static AstType const * compose(AstDeclaration const * pDecl);
 private:
-AstDeclaration* m_pComplexPart;
 OString  m_name;
-DeclaratorType  m_declType;
 };
 
 typedef ::std::list< FeDeclarator* > FeDeclList;
diff --git a/idlc/source/fehelper.cxx b/idlc/source/fehelper.cxx
index 4e4c549..704c953 100644
--- a/idlc/source/fehelper.cxx
+++ b/idlc/source/fehelper.cxx
@@ -21,10 +21,8 @@
 #include 
 #include "idlc/idlc.hxx"
 
-FeDeclarator::FeDeclarator(const OString& name, DeclaratorType declType, 
AstDeclaration* pComplPart)
-: m_pComplexPart(pComplPart)
-, m_name(name)
-, m_declType(declType)
+FeDeclarator::FeDeclarator(const OString& name)
+: m_name(name)
 {
 }
 
@@ -47,8 +45,6 @@ bool FeDeclarator::checkType(AstDeclaration const * type)
 
 AstType const * FeDeclarator::compose(AstDeclaration const * pDecl)
 {
-const AstType*pType;
-
 if ( pDecl == nullptr )
 {
 return nullptr;
@@ -58,11 +54,7 @@ AstType const * FeDeclarator::compose(AstDeclaration const * 
pDecl)
 ErrorHandler::noTypeError(pDecl);
 return nullptr;
 }
-pType = static_cast(pDecl);
-if (m_declType == FD_simple || m_pComplexPart == nullptr)
-return pType;
-
-return nullptr; // return through this statement should not happen
+return static_cast(pDecl);
 }
 
 FeInheritanceHeader::FeInheritanceHeader(
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index c449aa7..8296ac4 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -733,7 +733,7 @@ attribute :
 AstInterface * scope = static_cast< AstInterface * >(
 idlc()->scopes()->top());
 AstAttribute * attr = new AstAttribute(
-$1, $4->compose($2), $4->getName(), scope);
+$1, FeDeclarator::compose($2), $4->getName(), scope);
 delete $4;
 AstInterface::DoubleMemberDeclarations doubleMembers(
 scope->checkMemberClashes(attr));
@@ -1053,7 +1053,7 @@ parameter :
  */
 if ( pScope && $5 && $8 )
 {
-AstType const * pType = $8->compose($5);
+AstType const * pType = FeDeclarator::compose($5);
 if ( pType )
 {
 if (pScope->isConstructor() && $2 != DIR_IN) {
@@ -1570,7 +1570,7 @@ property :
 continue;
 }
 
-pType = pDecl->compose($2);
+pType = FeDeclarator::compose($2);
 
 if ( !pType )
 {
@@ -2047,7 +2047,7 @@ type_declarator :
 continue;
 }
 
-pType = pDecl->compose($1);
+pType = FeDeclarator::compose($1);
 
 if ( !pType )
 {
@@ -2122,7 +2122,7 @@ declarator :
 checkIdentifier($1);
 }
 
-$$ = new FeDeclarator(*$1, FeDeclarator::FD_simple, NULL);
+$$ = new FeDeclarator(*$1);
 delete $1;
 }
 ;
@@ -2556,7 +2556,7 @@ member :
 continue;
 }
 
-pType = pDecl->compose($1);
+pType = FeDeclarator::compose($1);
 
 if ( !pType )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-09-26 Thread Stephan Bergmann
 idlc/inc/idlc/astexpression.hxx |   19 +++--
 idlc/source/astexpression.cxx   |   79 +---
 idlc/source/parser.y|2 -
 3 files changed, 34 insertions(+), 66 deletions(-)

New commits:
commit bc1fdb79b0a7eba791bf7f5749a8a45ad6a94bff
Author: Stephan Bergmann 
Date:   Sat Sep 26 21:54:07 2015 +0200

The only EvalKind actually used is EK_const

Change-Id: Ide451d1e287eeb8666b9ddcce312b9a753761c50

diff --git a/idlc/inc/idlc/astexpression.hxx b/idlc/inc/idlc/astexpression.hxx
index 1e38895..327cbe9 100644
--- a/idlc/inc/idlc/astexpression.hxx
+++ b/idlc/inc/idlc/astexpression.hxx
@@ -41,13 +41,6 @@ enum ExprComb
 EC_symbol   // a symbol (function or constant name)
 };
 
-// Enum to define the different kinds of evaluation possible
-enum EvalKind
-{
-EK_const,   // Must evaluate to constant
-EK_positive_int // Must evaluate to positive integer
-};
-
 // Enum to define expression type
 enum ExprType
 {
@@ -118,7 +111,7 @@ public:
 AstExprValue* coerce(ExprType type, bool bAssign=true);
 
 // Evaluate then store value inside this AstExpression
-void evaluate(EvalKind ek);
+void evaluate();
 
 // Compare to AstExpressions
 bool operator==(AstExpression *pExpr);
@@ -129,12 +122,12 @@ private:
 // Fill out the lineno, filename and definition scope details
 voidfillDefinitionDetails();
 // Internal evaluation
-AstExprValue* eval_internal(EvalKind ek);
+AstExprValue* eval_internal();
 // Evaluate different sets of operators
-AstExprValue* eval_bin_op(EvalKind ek);
-AstExprValue* eval_bit_op(EvalKind ek);
-AstExprValue* eval_un_op(EvalKind ek);
-AstExprValue* eval_symbol(EvalKind ek);
+AstExprValue* eval_bin_op();
+AstExprValue* eval_bit_op();
+AstExprValue* eval_un_op();
+AstExprValue* eval_symbol();
 
 AstScope*   m_pScope;   // scope defined in
 sal_Int32   m_lineNo;   // line number defined in
diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx
index ceda954..3bde391 100644
--- a/idlc/source/astexpression.cxx
+++ b/idlc/source/astexpression.cxx
@@ -685,24 +685,6 @@ coerce_value(AstExprValue *ev, ExprType t)
 }
 }
 
-/*
- * Evaluate the expression with the evaluation kind requested. Supported
- * evaluation kinds are
- * - EK_const:  The expression must evaluate to a constant
- * - EK_positive_int:   The expression must further evaluate to a
- *  positive integer
- */
-static AstExprValue *
-eval_kind(AstExprValue *ev, EvalKind ek)
-{
-if (ek == EK_const)
-return ev;
-if (ek == EK_positive_int)
-return coerce_value(ev, ET_ulong);
-
-return NULL;
-}
-
 AstExprValue* AstExpression::coerce(ExprType t, bool bAssign)
 {
 AstExprValue *copy;
@@ -718,7 +700,7 @@ AstExprValue* AstExpression::coerce(ExprType t, bool 
bAssign)
  * First, evaluate it, then try to coerce result type
  * If already evaluated, return the result
  */
-m_exprValue = eval_internal(EK_const);
+m_exprValue = eval_internal();
 if (m_exprValue == NULL)
 return NULL;
 
@@ -775,10 +757,9 @@ AstExprValue* AstExpression::coerce(ExprType t, bool 
bAssign)
 return coerced;
 }
 
-void AstExpression::evaluate(EvalKind ek)
+void AstExpression::evaluate()
 {
-m_exprValue = eval_internal(ek);
-m_exprValue = eval_kind(m_exprValue, ek);
+m_exprValue = eval_internal();
 }
 
 bool AstExpression::operator==(AstExpression *pExpr)
@@ -786,8 +767,8 @@ bool AstExpression::operator==(AstExpression *pExpr)
 bool bRet = false;
 if (m_combOperator != pExpr->getCombOperator())
 return bRet;
-evaluate(EK_const);
-pExpr->evaluate(EK_const);
+evaluate();
+pExpr->evaluate();
 if (m_exprValue == NULL || pExpr->getExprValue() == NULL)
 return bRet;
 if (m_exprValue->et != pExpr->getExprValue()->et)
@@ -838,8 +819,8 @@ bool AstExpression::compare(AstExpression *pExpr)
 bool bRet = false;
 if (m_combOperator != pExpr->getCombOperator())
 return bRet;
-evaluate(EK_const);
-pExpr->evaluate(EK_const);
+evaluate();
+pExpr->evaluate();
 if (m_exprValue == NULL || pExpr->getExprValue() == NULL)
 return bRet;
 if (m_exprValue->et != pExpr->getExprValue()->et)
@@ -891,13 +872,13 @@ void AstExpression::fillDefinitionDetails()
 m_fileName = idlc()->getFileName();
 }
 
-AstExprValue* AstExpression::eval_internal(EvalKind ek)
+AstExprValue* AstExpression::eval_internal()
 {
 /*
  * Already evaluated?
  */
 if ( m_exprValue != NULL )
-return eval_kind(m_exprValue, ek);
+return m_exprValue;
 /*
  * OK, must evaluate operator
  */
@@ -908,23 +889,23 @@ AstExprValue* AstExpression::eval_internal(EvalKind ek)
 case EC_mul:
 case EC_div:
 case EC_mod:
-m_exprValue = eval_bin_op(ek);
-   

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

2015-05-18 Thread Stephan Bergmann
 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 sberg...@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;
 DeclListm_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_castAstModule*(pExists);
 } else
 {
 pScope-addDeclaration(pModule);
@@ -573,7 +573,7 @@ interface_dcl :
  */
 if (pDecl-getNodeType() == NT_interface)
 {
-pForward = (AstInterface*)pDecl;
+pForward = static_castAstInterface*(pDecl);
 if ( !pForward-isDefined() )
 {
 /*
@@ -946,7 +946,7 @@ operation :
  */
 if ( pScope  $1 )
 {
-AstType *pType = (AstType*)$1;
+AstType const *pType = static_castAstType 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_castAstOperation*(pScope);
 
 if ( pOp )
 pOp-setExceptions($11);
@@ -1288,7 +1288,7 @@ constants_dcl :
 {
 pExists-setInMainfile(idlc()-isInMainFile());
 delete(pConstants);
-pConstants = (AstConstants*)pExists;
+pConstants = static_castAstConstants*(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(
-