summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-08-12 12:08:50 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-08-17 06:43:45 +0000
commit95be297746fda812f5a64e5fd53c753dfd9b249c (patch)
tree4765cbcc1c825480d58d236f2011b895e06101d5
parente0a3269183bf145511361a3968dca07824923dd4 (diff)
loplugin:unusedenumvalues in sw
Change-Id: Ia5faa65cd7824183cead2634edab96b5d23a6c02 Reviewed-on: https://gerrit.libreoffice.org/28072 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--compilerplugins/clang/unusedenumvalues.cxx1
-rwxr-xr-xcompilerplugins/clang/unusedenumvalues.py21
-rw-r--r--sw/inc/calc.hxx1
-rw-r--r--sw/inc/docufld.hxx8
-rw-r--r--sw/inc/flddat.hxx48
-rw-r--r--sw/inc/frmfmt.hxx3
-rw-r--r--sw/inc/modcfg.hxx9
-rw-r--r--sw/inc/swtypes.hxx10
-rw-r--r--sw/inc/view.hxx3
-rw-r--r--sw/source/core/inc/pagefrm.hxx7
-rw-r--r--sw/source/filter/html/parcss1.hxx4
-rw-r--r--sw/source/filter/inc/fltshell.hxx4
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx3
13 files changed, 28 insertions, 94 deletions
diff --git a/compilerplugins/clang/unusedenumvalues.cxx b/compilerplugins/clang/unusedenumvalues.cxx
index a478dfd5a570..6e3c87402a00 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 746abe26d5d0..f601275ca453 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 79b2be0d1ed4..de39a1c105f0 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 f14b3b7b00b6..7f4090b319fd 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 8eb39ca43292..e4f7643a2d56 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 4291ced05f6e..75b139ec2313 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 8cec996dab2c..73f2a43f7594 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 eb17dbe47156..d3391992d2b6 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 2493d96ce1fc..891fdd8c8005 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 dcd3b7ec01c7..caace3c3ad2a 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 4485acd89897..51be36105fca 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 f8558d1977a7..61a458708491 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 0f8ccdaf1d47..6b3b0166659f 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);