[Libreoffice-commits] core.git: compilerplugins/clang connectivity/source cui/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Feb 6 09:14:02 UTC 2017


 compilerplugins/clang/unusedenumconstants.py          |    1 +
 connectivity/source/commontools/RowFunctionParser.cxx |   14 +++++++-------
 connectivity/source/drivers/mork/MQueryHelper.hxx     |   15 +++++++--------
 connectivity/source/inc/RowFunctionParser.hxx         |    9 ++++-----
 cui/source/inc/cuitabarea.hxx                         |    1 -
 5 files changed, 19 insertions(+), 21 deletions(-)

New commits:
commit c9c3cb5446bfeb621d5fee5d50d19c8e030e3087
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Feb 6 08:54:44 2017 +0200

    loplugin:unusedenumconstants in connectivity..cui
    
    Convert ExpressionFunct to scoped enum and drop FUNC_CONST value.
    Convert MQueryExpressionBase::node_type to scoped enum and drop Unknown
    value.
    Dop PageType::Color value
    
    Change-Id: Icb1f5503c230fb91329acc7d9e1da665fa28d95e
    Reviewed-on: https://gerrit.libreoffice.org/33948
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py
index 89c35db..03b9071 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -90,6 +90,7 @@ for d in definitionSet:
          "sw/source/filter/ww8/fields.hxx",
          "vcl/source/fontsubset/cff.cxx",
          "include/vcl/settings.hxx", # stored in a setting, can't remove it without potentially triggering UBSAN
+         "basic/source/inc/opcodes.hxx", # can't touch this without breaking unit tests, not sure why
         # unit test code
          "cppu/source/uno/check.cxx",
         # general weird nonsense going on
diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx
index b44713f..dd7d05f 100644
--- a/connectivity/source/commontools/RowFunctionParser.cxx
+++ b/connectivity/source/commontools/RowFunctionParser.cxx
@@ -93,13 +93,13 @@ public:
         ORowSetValueDecoratorRef aRet;
         switch(meFunct)
         {
-            case ENUM_FUNC_EQUATION:
+            case ExpressionFunct::Equation:
                 aRet = new ORowSetValueDecorator( mpFirstArg->evaluate(_aRow )->getValue() == mpSecondArg->evaluate(_aRow )->getValue() );
                 break;
-            case ENUM_FUNC_AND:
+            case ExpressionFunct::And:
                 aRet = new ORowSetValueDecorator( mpFirstArg->evaluate(_aRow )->getValue().getBool() && mpSecondArg->evaluate(_aRow )->getValue().getBool() );
                 break;
-            case ENUM_FUNC_OR:
+            case ExpressionFunct::Or:
                 aRet = new ORowSetValueDecorator( mpFirstArg->evaluate(_aRow )->getValue().getBool() || mpSecondArg->evaluate(_aRow )->getValue().getBool() );
                 break;
             default:
@@ -111,7 +111,7 @@ public:
     {
         switch(meFunct)
         {
-            case ENUM_FUNC_EQUATION:
+            case ExpressionFunct::Equation:
                 (*mpFirstArg->evaluate(_aRow )) = mpSecondArg->evaluate(_aRow )->getValue();
                 break;
             default:
@@ -334,18 +334,18 @@ public:
 
             assignment =
                     unaryFunction >> ch_p('=') >> argument
-                                [ BinaryFunctionFunctor( ENUM_FUNC_EQUATION,  self.getContext()) ]
+                                [ BinaryFunctionFunctor( ExpressionFunct::Equation,  self.getContext()) ]
                ;
 
             andExpression =
                     assignment
                 |   ( '(' >> orExpression >> ')' )
-                |   ( assignment >> AND_ >> assignment )  [ BinaryFunctionFunctor( ENUM_FUNC_AND,  self.getContext()) ]
+                |   ( assignment >> AND_ >> assignment )  [ BinaryFunctionFunctor( ExpressionFunct::And,  self.getContext()) ]
                 ;
 
             orExpression =
                     andExpression
-                |   ( orExpression >> OR_ >> andExpression ) [ BinaryFunctionFunctor( ENUM_FUNC_OR,  self.getContext()) ]
+                |   ( orExpression >> OR_ >> andExpression ) [ BinaryFunctionFunctor( ExpressionFunct::Or,  self.getContext()) ]
                 ;
 
             basicExpression =
diff --git a/connectivity/source/drivers/mork/MQueryHelper.hxx b/connectivity/source/drivers/mork/MQueryHelper.hxx
index 1871b45..3861b57 100644
--- a/connectivity/source/drivers/mork/MQueryHelper.hxx
+++ b/connectivity/source/drivers/mork/MQueryHelper.hxx
@@ -47,11 +47,10 @@ namespace connectivity
 
         class MQueryExpressionBase {
         public:
-            typedef enum {
-                Unknown,
+            enum class node_type {
                 StringExpr,
                 Expr
-            } node_type;
+            };
 
         protected:
             node_type   m_eNodeType;
@@ -61,8 +60,8 @@ namespace connectivity
         public:
             virtual ~MQueryExpressionBase() {}
 
-            bool   isStringExpr( ) const { return m_eNodeType == StringExpr; }
-            bool   isExpr( ) const { return m_eNodeType == Expr; }
+            bool   isStringExpr( ) const { return m_eNodeType == node_type::StringExpr; }
+            bool   isExpr( ) const { return m_eNodeType == node_type::Expr; }
         };
 
         class MQueryExpressionString : public MQueryExpressionBase {
@@ -76,7 +75,7 @@ namespace connectivity
             MQueryExpressionString( const OUString&     lhs,
                                     MQueryOp::cond_type cond,
                                     const OUString&     rhs )
-                : MQueryExpressionBase( MQueryExpressionBase::StringExpr )
+                : MQueryExpressionBase( MQueryExpressionBase::node_type::StringExpr )
                 , m_aName( lhs )
                 , m_aBooleanCondition( cond )
                 , m_aValue( rhs )
@@ -85,7 +84,7 @@ namespace connectivity
 
             MQueryExpressionString( const OUString&     lhs,
                                     MQueryOp::cond_type cond )
-                : MQueryExpressionBase( MQueryExpressionBase::StringExpr )
+                : MQueryExpressionBase( MQueryExpressionBase::node_type::StringExpr )
                 , m_aName( lhs )
                 , m_aBooleanCondition( cond )
                 , m_aValue( OUString() )
@@ -123,7 +122,7 @@ namespace connectivity
             bool_cond getExpressionCondition( ) const
                             { return m_aExprCondType; }
 
-            MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::Expr ),
+            MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::node_type::Expr ),
                                  m_aExprCondType( OR )
                             {}
 
diff --git a/connectivity/source/inc/RowFunctionParser.hxx b/connectivity/source/inc/RowFunctionParser.hxx
index ed547ed..df2c7ba 100644
--- a/connectivity/source/inc/RowFunctionParser.hxx
+++ b/connectivity/source/inc/RowFunctionParser.hxx
@@ -29,12 +29,11 @@
 namespace connectivity
 {
 
-enum ExpressionFunct
+enum class ExpressionFunct
 {
-    FUNC_CONST,
-    ENUM_FUNC_EQUATION,
-    ENUM_FUNC_AND,
-    ENUM_FUNC_OR
+    Equation,
+    And,
+    Or
 };
 
 #define EXPRESSION_FLAG_SUMANGLE_MODE 1
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 3af9dd9..b8f7e16 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -90,7 +90,6 @@ enum class PageType
     Gradient,
     Hatch,
     Bitmap,
-    Color,
     Shadow,
     Transparence,
 };


More information about the Libreoffice-commits mailing list