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

Noel Grandin noel at peralex.com
Wed Aug 17 06:44:08 UTC 2016


 compilerplugins/clang/unusedenumvalues.cxx |    1 
 compilerplugins/clang/unusedenumvalues.py  |   21 ++++++++----
 sw/inc/calc.hxx                            |    1 
 sw/inc/docufld.hxx                         |    8 ----
 sw/inc/flddat.hxx                          |   48 -----------------------------
 sw/inc/frmfmt.hxx                          |    3 -
 sw/inc/modcfg.hxx                          |    9 ++---
 sw/inc/swtypes.hxx                         |   10 ++----
 sw/inc/view.hxx                            |    3 -
 sw/source/core/inc/pagefrm.hxx             |    7 ----
 sw/source/filter/html/parcss1.hxx          |    4 --
 sw/source/filter/inc/fltshell.hxx          |    4 --
 sw/source/uibase/inc/wrtsh.hxx             |    3 -
 13 files changed, 28 insertions(+), 94 deletions(-)

New commits:
commit 95be297746fda812f5a64e5fd53c753dfd9b249c
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Aug 12 12:08:50 2016 +0200

    loplugin:unusedenumvalues in sw
    
    Change-Id: Ia5faa65cd7824183cead2634edab96b5d23a6c02
    Reviewed-on: https://gerrit.libreoffice.org/28072
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/compilerplugins/clang/unusedenumvalues.cxx b/compilerplugins/clang/unusedenumvalues.cxx
index a478dfd..6e3c874 100644
--- a/compilerplugins/clang/unusedenumvalues.cxx
+++ b/compilerplugins/clang/unusedenumvalues.cxx
@@ -78,6 +78,7 @@ public:
     }
 
     bool shouldVisitTemplateInstantiations () const { return true; }
+    bool shouldVisitImplicitCode() const { return true; }
 
     bool VisitEnumDecl( const EnumDecl* );
     bool VisitDeclRefExpr( const DeclRefExpr* );
diff --git a/compilerplugins/clang/unusedenumvalues.py b/compilerplugins/clang/unusedenumvalues.py
index 746abe2..f601275c 100755
--- a/compilerplugins/clang/unusedenumvalues.py
+++ b/compilerplugins/clang/unusedenumvalues.py
@@ -7,9 +7,17 @@ import io
 definitionSet = set()
 definitionToSourceLocationMap = dict()
 touchSet = set()
-# things we need to exclude for reasons like :
-# - it's a weird template thingy that confuses the plugin
-exclusionSet = set([
+# exclude some stuff, mostly because they are some kind of definition of external file formats
+excludedSourceFiles = set([
+    "include/svx/msdffdef.hxx",
+    "sw/source/filter/ww8/fields.hxx",
+    "sw/source/filter/inc/wwstyles.hxx",
+    "sw/inc/toxe.hxx",
+    "sw/inc/poolfmt.hxx",
+    "sw/inc/hintids.hxx",
+    ])
+excludedTypes = set([
+    "SwVarFormat", "RES_FIELDS", "SwFillOrder", "SwIoDetect", "SwDocumentSettingsPropertyHandles"
     ])
 
 # clang does not always use exactly the same numbers in the type-parameter vars it generates
@@ -69,14 +77,13 @@ for d in definitionSet:
         or srcLoc.startswith("include/typelib/")
         or srcLoc.startswith("include/uno/")):
         continue
-    # definitions of external file formats
-    if (srcLoc.startswith("include/svx/msdffdef.hxx"):
+    if srcLoc in excludedSourceFiles or d[0] in excludedTypes:
         continue
     # used in templates to find the last member of an enum
-    if (d1.endswith("LAST"):
+    if d[1] == "LAST" or d[1].endswith("_END"):
         continue
     # used to aid in alignment of enum values
-    if (d1.endswith("FORCE_EQUAL_SIZE"):
+    if d[1].endswith("FORCE_EQUAL_SIZE"):
         continue
         
     untouchedSet.add((clazz, srcLoc))
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 79b2be0..de39a1c 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -42,7 +42,6 @@ enum SwCalcOper
     CALC_DIV='/',           CALC_PRINT=';',         CALC_ASSIGN='=',
     CALC_LP='(',            CALC_RP=')',            CALC_PHD='%',
     CALC_POW='^',
-    CALC_LISTOP = cListDelim,
     CALC_NOT=256,           CALC_AND=257,           CALC_OR=258,
     CALC_XOR=259,           CALC_EQ=260,            CALC_NEQ=261,
     CALC_LEQ=262,           CALC_GEQ=263,           CALC_LES=264,
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index f14b3b7..7f4090b 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -84,14 +84,6 @@ namespace nsSwDocInfoSubType
     const SwDocInfoSubType DI_SUB_MASK      = 0xff00;
 }
 
-enum RegInfoFormat  ///< Only for loading of old documents!!!
-{
-    RF_AUTHOR,
-    RF_TIME,
-    RF_DATE,
-    RF_ALL
-};
-
 enum SwPageNumSubType
 {
     PG_RANDOM,
diff --git a/sw/inc/flddat.hxx b/sw/inc/flddat.hxx
index 8eb39ca..e4f7643 100644
--- a/sw/inc/flddat.hxx
+++ b/sw/inc/flddat.hxx
@@ -26,54 +26,6 @@ class DateTime;
 class Date;
 namespace tools { class Time; }
 
-enum SwDateFormat
-{
-    DF_BEGIN,
-    // new formats
-    DFF_SSYS = DF_BEGIN,
-    DFF_LSYS ,
-    DFF_DMY ,
-    DFF_DMYY ,
-    DFF_DMMY ,
-    DFF_DMMYY,
-    DFF_DMMMY ,
-    DFF_DMMMYY,
-    DFF_DDMMY ,
-    DFF_DDMMMY ,
-    DFF_DDMMMYY ,
-    DFF_DDDMMMY ,
-    DFF_DDDMMMYY ,
-    DFF_MY ,
-    DFF_MD ,
-    DFF_YMD ,
-    DFF_YYMD ,
-    DF_END ,
-    // Compatibility
-    DF_SSYS     = DFF_SSYS,
-    DF_LSYS     = DFF_LSYS,
-    DF_SHORT    = DFF_DMY,
-    DF_SCENT    = DFF_DMYY,
-    DF_LMON     = DFF_DMMYY,
-    DF_LMONTH   = DFF_DMMMYY,
-    DF_LDAYMON  = DFF_DDMMMYY,
-    DF_LDAYMONTH= DFF_DDDMMMYY
-};
-
-enum SwTimeFormat
-{
-    TF_BEGIN,
-    TF_SYSTEM=TF_BEGIN,
-    TF_SSMM_24,
-    TF_SSMM_12,
-    TF_END
-};
-
-enum SwTimeSubFormat
-{
-    TIME_FIX,
-    TIME_VAR
-};
-
 enum SwDateSubFormat
 {
     DATE_FIX,
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 4291ced..75b139e 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -112,8 +112,7 @@ public:
     {
         HORI_L2R,
         HORI_R2L,
-        VERT_R2L,
-        VERT_L2R    ///< Not supported yet.
+        VERT_R2L
     };
 
     virtual SwFrameFormat::tLayoutDir GetLayoutDir() const;
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 8cec996..73f2a43 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -41,14 +41,13 @@ class InsCaptionOpt;
 enum class MailTextFormats
 {
     NONE      = 0x00,
-    ASCII     = 0x01,
-    HTML      = 0x02,
-    RTF       = 0x04,
-    OFFICE    = 0x08
+    HTML      = 0x01,
+    RTF       = 0x02,
+    OFFICE    = 0x04
 };
 namespace o3tl
 {
-    template<> struct typed_flags<MailTextFormats> : is_typed_flags<MailTextFormats, 0x0f> {};
+    template<> struct typed_flags<MailTextFormats> : is_typed_flags<MailTextFormats, 0x07> {};
 }
 
 
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index eb17dbe..d339199 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -186,17 +186,16 @@ enum class SetAttrMode
     /// when using this need to pay attention to ignore start/end flags of hint
     NOHINTADJUST    = 0x0008,  // No merging of ranges.
     NOFORMATATTR    = 0x0010,  // Do not change into format attribute.
-    DONTCHGNUMRULE  = 0x0020,  // Do not change NumRule.
-    APICALL         = 0x0040,  // Called from API (all UI related
+    APICALL         = 0x0020,  // Called from API (all UI related
                                                         // functionality will be disabled).
     /// Force hint expand (only matters for hints with CH_TXTATR).
-    FORCEHINTEXPAND = 0x0080,
+    FORCEHINTEXPAND = 0x0040,
     /// The inserted item is a copy -- intended for use in ndtxt.cxx.
-    IS_COPY         = 0x0100
+    IS_COPY         = 0x0080
 };
 namespace o3tl
 {
-    template<> struct typed_flags<SetAttrMode> : is_typed_flags<SetAttrMode, 0x1ff> {};
+    template<> struct typed_flags<SetAttrMode> : is_typed_flags<SetAttrMode, 0x0ff> {};
 }
 
 #define SW_ISPRINTABLE( c ) ( c >= ' ' && 127 != c )
@@ -273,7 +272,6 @@ enum PrepareHint
                             // Direction is communicated via pVoid:
                             //     MoveFwd: pVoid == 0
                             //     MoveBwd: pVoid == pOldPage
-    PREP_SWAP,              // Swap graphic; for graphics in visible area.
     PREP_REGISTER,          // Invalidate frames with registers.
     PREP_FTN_GONE,          // A Follow loses its footnote, possibly its first line can move up.
     PREP_MOVEFTN,           // A footnote changes its page. Its contents receives at first a
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 2493d96..891fdd8 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -115,8 +115,7 @@ enum ShellModes
     SHELL_MODE_MEDIA,
     SHELL_MODE_EXTRUDED_CUSTOMSHAPE,
     SHELL_MODE_FONTWORK,
-    SHELL_MODE_POSTIT,
-    SHELL_MODE_NAVIGATION
+    SHELL_MODE_POSTIT
 };
 
 // apply a template
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index dcd3b7e..caace3c 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -36,13 +36,6 @@ namespace vcl { class Font; }
 class SwSortedObjs;
 class SwAnchoredObject;
 
-enum SwPageChg
-{
-    CHG_NEWPAGE,
-    CHG_CUTPAGE,
-    CHG_CHGPAGE
-};
-
 /// A page of the document layout.
 class SwPageFrame: public SwFootnoteBossFrame
 {
diff --git a/sw/source/filter/html/parcss1.hxx b/sw/source/filter/html/parcss1.hxx
index 4485acd..51be361 100644
--- a/sw/source/filter/html/parcss1.hxx
+++ b/sw/source/filter/html/parcss1.hxx
@@ -24,7 +24,6 @@
 enum CSS1Token
 {
     CSS1_NULL,
-    CSS1_UNKNOWN,
 
     CSS1_IDENT,
     CSS1_STRING,
@@ -60,8 +59,7 @@ enum CSS1Token
 enum CSS1ParserState
 {
     CSS1_PAR_ACCEPTED = 0,
-    CSS1_PAR_WORKING,
-    CSS1_PAR_ERROR
+    CSS1_PAR_WORKING
 };
 
 enum CSS1SelectorType
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index f8558d1..61a4587 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -165,9 +165,7 @@ public:
         BOOK_TO_VAR_REF,
         BOOK_AND_REF,
         TAGS_IN_TEXT,
-        ALLOW_FLD_CR,
-        NO_FLD_CR,
-        DONT_HARD_PROTECT
+        ALLOW_FLD_CR
     };
 
     SwFltControlStack(SwDoc* pDo, sal_uLong nFieldFl);
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 0f8ccda..6b3b016 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -593,8 +593,7 @@ private:
     {
         BOOKMARK_INDEX,
         BOOKMARK_NEXT,
-        BOOKMARK_PREV,
-        BOOKMARK_LAST_LAST_ENTRY
+        BOOKMARK_PREV
     };
 
     SAL_DLLPRIVATE bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=nullptr);


More information about the Libreoffice-commits mailing list