libwps: fix build with gcc7
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
This commit is contained in:
@@ -0,0 +1,319 @@
|
||||
From e1b2c2f34268d14aa469c88ab89bd9f491168bd0 Mon Sep 17 00:00:00 2001
|
||||
From: osnola <alonso@loria.fr>
|
||||
Date: Mon, 3 Jul 2017 10:04:00 +0200
|
||||
Subject: [PATCH] g++7: try to remove some warnings...
|
||||
|
||||
Upstream-Status: Submitted [1]
|
||||
|
||||
[1] https://sourceforge.net/p/libwps/code/ci/master/tree/
|
||||
|
||||
---
|
||||
src/lib/WKS4Spreadsheet.cpp | 2 +-
|
||||
src/lib/WKSContentListener.cpp | 4 ++--
|
||||
src/lib/WPS4.cpp | 2 +-
|
||||
src/lib/WPS4Text.cpp | 7 ++++---
|
||||
src/lib/WPS8Table.cpp | 2 +-
|
||||
src/lib/WPS8TextStyle.cpp | 4 +++-
|
||||
src/lib/WPSCell.cpp | 11 +++++++----
|
||||
src/lib/WPSContentListener.cpp | 6 +++---
|
||||
src/lib/WPSGraphicShape.cpp | 1 +
|
||||
src/lib/WPSPageSpan.cpp | 1 +
|
||||
src/lib/libwps_internal.cpp | 1 +
|
||||
src/lib/libwps_internal.h | 14 ++++++++++++++
|
||||
src/lib/libwps_tools_win.cpp | 1 +
|
||||
13 files changed, 40 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/lib/WKS4Spreadsheet.cpp b/src/lib/WKS4Spreadsheet.cpp
|
||||
index 29dd98e..cf3232c 100644
|
||||
--- a/src/lib/WKS4Spreadsheet.cpp
|
||||
+++ b/src/lib/WKS4Spreadsheet.cpp
|
||||
@@ -821,7 +821,7 @@ bool WKS4Spreadsheet::readMsWorksStyle()
|
||||
break;
|
||||
case 5: // center arround cell
|
||||
f << ",center[between cell]";
|
||||
- // fail through expected
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 2:
|
||||
style.setHAlignement(WPSCell::HALIGN_CENTER);
|
||||
break;
|
||||
diff --git a/src/lib/WKSContentListener.cpp b/src/lib/WKSContentListener.cpp
|
||||
index 08d8209..d24b8a2 100644
|
||||
--- a/src/lib/WKSContentListener.cpp
|
||||
+++ b/src/lib/WKSContentListener.cpp
|
||||
@@ -775,7 +775,7 @@ void WKSContentListener::_handleFrameParameters
|
||||
{
|
||||
case WPSPosition::YFull:
|
||||
propList.insert("svg:height", double(h), unit);
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case WPSPosition::YTop:
|
||||
if (origin[1] < 0.0 || origin[1] > 0.0)
|
||||
{
|
||||
@@ -819,7 +819,7 @@ void WKSContentListener::_handleFrameParameters
|
||||
{
|
||||
case WPSPosition::XFull:
|
||||
propList.insert("svg:width", double(w), unit);
|
||||
- // fallthrough intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case WPSPosition::XLeft:
|
||||
if (origin[0] < 0.0 || origin[0] > 0.0)
|
||||
{
|
||||
diff --git a/src/lib/WPS4.cpp b/src/lib/WPS4.cpp
|
||||
index cc6493d..2629086 100644
|
||||
--- a/src/lib/WPS4.cpp
|
||||
+++ b/src/lib/WPS4.cpp
|
||||
@@ -585,7 +585,7 @@ bool WPS4Parser::findZones()
|
||||
{
|
||||
case 0xda1:
|
||||
apCreator = 2;
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 0:
|
||||
case 1:
|
||||
worksVersion = 1;
|
||||
diff --git a/src/lib/WPS4Text.cpp b/src/lib/WPS4Text.cpp
|
||||
index 76f0e5f..fe464ce 100644
|
||||
--- a/src/lib/WPS4Text.cpp
|
||||
+++ b/src/lib/WPS4Text.cpp
|
||||
@@ -910,6 +910,7 @@ bool WPS4Text::readText(WPSEntry const &zone)
|
||||
}
|
||||
m_input->seek(-1, librevenge::RVNG_SEEK_CUR);
|
||||
}
|
||||
+ WPS_FALLTHROUGH;
|
||||
default:
|
||||
if (version()<=2)
|
||||
{
|
||||
@@ -1593,7 +1594,7 @@ bool WPS4Text::readDosLink(WPSEntry const &entry)
|
||||
val = libwps::readU16(m_input); // always 4
|
||||
if (val != 4) f << "g1=" << val << ",";
|
||||
}
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 0x40: // spreadsheet range
|
||||
case 0x01: // char ?
|
||||
{
|
||||
@@ -1999,7 +2000,7 @@ bool WPS4Text::readParagraph(long endPos, int &id, std::string &mess)
|
||||
break;
|
||||
case 0x13: // seems another way to define the left margin
|
||||
f << "#left,";
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 0x12:
|
||||
pp.m_margins[1] = arg/1440.;
|
||||
break;
|
||||
@@ -2565,7 +2566,7 @@ bool WPS4Text::readPLC
|
||||
break;
|
||||
default:
|
||||
WPS_DEBUG_MSG(("WPS4Text:readPLC: unexpected PLC size\n"));
|
||||
- // fallthrough intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 0:
|
||||
plc.m_value = 0;
|
||||
}
|
||||
diff --git a/src/lib/WPS8Table.cpp b/src/lib/WPS8Table.cpp
|
||||
index 3280158..da6bfa9 100644
|
||||
--- a/src/lib/WPS8Table.cpp
|
||||
+++ b/src/lib/WPS8Table.cpp
|
||||
@@ -605,7 +605,7 @@ bool WPS8Table::readMCLD(RVNGInputStreamPtr input, WPSEntry const &entry)
|
||||
break; // normal
|
||||
case 0xFF: // also unset, diff with value = 1 ?
|
||||
f2 << "#f" << dt.id() << "=" << std::hex << dt.m_value << std::dec << ",";
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 1:
|
||||
cell->setVerticalSet(false);
|
||||
break;
|
||||
diff --git a/src/lib/WPS8TextStyle.cpp b/src/lib/WPS8TextStyle.cpp
|
||||
index aa02e49..dbaeb71 100644
|
||||
--- a/src/lib/WPS8TextStyle.cpp
|
||||
+++ b/src/lib/WPS8TextStyle.cpp
|
||||
@@ -671,6 +671,7 @@ bool WPS8TextStyle::readParagraph(long endPos, int &id, std::string &mess)
|
||||
{
|
||||
case 2: // not frequent: only found one time
|
||||
f << "#type[bullet]=2,";
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 1: // the normal case
|
||||
para.m_listLevelIndex = 1;
|
||||
para.m_listLevel.m_type = libwps::BULLET;
|
||||
@@ -756,7 +757,7 @@ bool WPS8TextStyle::readParagraph(long endPos, int &id, std::string &mess)
|
||||
break;
|
||||
default:
|
||||
f << "#bullet/type=" << type << ",";
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 2:
|
||||
para.m_listLevel.m_type = libwps::ARABIC;
|
||||
break;
|
||||
@@ -1001,6 +1002,7 @@ bool WPS8TextStyle::readParagraph(long endPos, int &id, std::string &mess)
|
||||
f << "extra[tabs]=[" << data.m_recursData[ch] << "],";
|
||||
}
|
||||
}
|
||||
+ WPS_FALLTHROUGH; // checkme
|
||||
|
||||
case 0x34: // interline line spacing 8*152400 -> normal, sinon *2
|
||||
{
|
||||
diff --git a/src/lib/WPSCell.cpp b/src/lib/WPSCell.cpp
|
||||
index 7086140..d87ea0b 100644
|
||||
--- a/src/lib/WPSCell.cpp
|
||||
+++ b/src/lib/WPSCell.cpp
|
||||
@@ -64,12 +64,14 @@ bool WPSCellFormat::convertDTFormat(std::string const &dtFormat, librevenge::RVN
|
||||
{
|
||||
case 'Y':
|
||||
list.insert("number:style", "long");
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 'y':
|
||||
list.insert("librevenge:value-type", "year");
|
||||
propVect.append(list);
|
||||
break;
|
||||
case 'B':
|
||||
list.insert("number:style", "long");
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 'b':
|
||||
case 'h':
|
||||
list.insert("librevenge:value-type", "month");
|
||||
@@ -82,13 +84,14 @@ bool WPSCellFormat::convertDTFormat(std::string const &dtFormat, librevenge::RVN
|
||||
break;
|
||||
case 'e':
|
||||
list.insert("number:style", "long");
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 'd':
|
||||
list.insert("librevenge:value-type", "day");
|
||||
propVect.append(list);
|
||||
break;
|
||||
case 'A':
|
||||
list.insert("number:style", "long");
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 'a':
|
||||
list.insert("librevenge:value-type", "day-of-week");
|
||||
propVect.append(list);
|
||||
@@ -96,7 +99,7 @@ bool WPSCellFormat::convertDTFormat(std::string const &dtFormat, librevenge::RVN
|
||||
|
||||
case 'H':
|
||||
list.insert("number:style", "long");
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 'I':
|
||||
list.insert("librevenge:value-type", "hours");
|
||||
propVect.append(list);
|
||||
@@ -286,11 +289,11 @@ bool WPSCellFormat::getNumberingProperties(librevenge::RVNGPropertyList &propLis
|
||||
{
|
||||
case 5: // thousand
|
||||
propList.insert("number:grouping", true);
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 0: // default
|
||||
if (m_subFormat==0)
|
||||
propList.remove("number:decimal-places");
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 1: // decimal
|
||||
propList.insert("librevenge:value-type", "number");
|
||||
break;
|
||||
diff --git a/src/lib/WPSContentListener.cpp b/src/lib/WPSContentListener.cpp
|
||||
index 9d5e390..5994e51 100644
|
||||
--- a/src/lib/WPSContentListener.cpp
|
||||
+++ b/src/lib/WPSContentListener.cpp
|
||||
@@ -1183,7 +1183,7 @@ bool WPSContentListener::openGroup(WPSPosition const &pos)
|
||||
default:
|
||||
WPS_DEBUG_MSG(("WPSContentListener::openGroup: UNKNOWN position, insert as char position\n"));
|
||||
#endif
|
||||
- // fallthrough intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case WPSPosition::CharBaseLine:
|
||||
case WPSPosition::Char:
|
||||
if (m_ps->m_isSpanOpened)
|
||||
@@ -1372,7 +1372,7 @@ void WPSContentListener::_handleFrameParameters
|
||||
{
|
||||
case WPSPosition::YFull:
|
||||
propList.insert("svg:height", double(h), unit);
|
||||
- // fall-through intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case WPSPosition::YTop:
|
||||
if (origin[1] < 0.0 || origin[1] > 0.0)
|
||||
{
|
||||
@@ -1416,7 +1416,7 @@ void WPSContentListener::_handleFrameParameters
|
||||
{
|
||||
case WPSPosition::XFull:
|
||||
propList.insert("svg:width", double(w), unit);
|
||||
- // fallthrough intended
|
||||
+ WPS_FALLTHROUGH;
|
||||
case WPSPosition::XLeft:
|
||||
if (origin[0] < 0.0 || origin[0] > 0.0)
|
||||
{
|
||||
diff --git a/src/lib/WPSGraphicShape.cpp b/src/lib/WPSGraphicShape.cpp
|
||||
index 6a73f8b..6c60213 100644
|
||||
--- a/src/lib/WPSGraphicShape.cpp
|
||||
+++ b/src/lib/WPSGraphicShape.cpp
|
||||
@@ -631,6 +631,7 @@ std::vector<WPSGraphicShape::PathData> WPSGraphicShape::getPath(bool forTransfor
|
||||
break;
|
||||
}
|
||||
}
|
||||
+ WPS_FALLTHROUGH;
|
||||
case Arc:
|
||||
case Pie:
|
||||
{
|
||||
diff --git a/src/lib/WPSPageSpan.cpp b/src/lib/WPSPageSpan.cpp
|
||||
index f4d2fca..0444680 100644
|
||||
--- a/src/lib/WPSPageSpan.cpp
|
||||
+++ b/src/lib/WPSPageSpan.cpp
|
||||
@@ -114,6 +114,7 @@ void WPSPageSpan::setHeaderFooter(const HeaderFooterType type, const HeaderFoote
|
||||
{
|
||||
case NEVER:
|
||||
_removeHeaderFooter(type, ALL);
|
||||
+ WPS_FALLTHROUGH;
|
||||
case FIRST:
|
||||
case ALL:
|
||||
_removeHeaderFooter(type, ODD);
|
||||
diff --git a/src/lib/libwps_internal.cpp b/src/lib/libwps_internal.cpp
|
||||
index 73d1999..0be82b4 100644
|
||||
--- a/src/lib/libwps_internal.cpp
|
||||
+++ b/src/lib/libwps_internal.cpp
|
||||
@@ -488,6 +488,7 @@ librevenge::RVNGString WPSField::getString() const
|
||||
struct tm timeinfo;
|
||||
if (localtime_r(&now, &timeinfo))
|
||||
{
|
||||
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
char buf[256];
|
||||
strftime(buf, 256, format.c_str(), &timeinfo);
|
||||
res=librevenge::RVNGString(buf);
|
||||
diff --git a/src/lib/libwps_internal.h b/src/lib/libwps_internal.h
|
||||
index 690dedb..8e91806 100644
|
||||
--- a/src/lib/libwps_internal.h
|
||||
+++ b/src/lib/libwps_internal.h
|
||||
@@ -83,6 +83,20 @@ struct WPS_shared_ptr_noop_deleter
|
||||
void operator()(T *) {}
|
||||
};
|
||||
|
||||
+/** fall through attributes */
|
||||
+#define WPS_FALLTHROUGH
|
||||
+#if defined(__clang__)
|
||||
+# if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::fallthrough)
|
||||
+# undef WPS_FALLTHROUGH
|
||||
+# define WPS_FALLTHROUGH [[clang::fallthrough]]
|
||||
+# endif
|
||||
+#elif defined(__GNUC__)
|
||||
+# if __GNUC__>=7
|
||||
+# undef WPS_FALLTHROUGH
|
||||
+# define WPS_FALLTHROUGH __attribute__ ((fallthrough))
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
// basic classes and autoptr
|
||||
/** shared pointer to librevenge::RVNGInputStream */
|
||||
typedef shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr;
|
||||
diff --git a/src/lib/libwps_tools_win.cpp b/src/lib/libwps_tools_win.cpp
|
||||
index 80f53c7..2868267 100644
|
||||
--- a/src/lib/libwps_tools_win.cpp
|
||||
+++ b/src/lib/libwps_tools_win.cpp
|
||||
@@ -186,6 +186,7 @@ Font::Type Font::getTypeForOEM(int oem)
|
||||
|
||||
default:
|
||||
WPS_DEBUG_MSG(("libwps_tools_win::Font::getTypeForOEM: find unknown oem %d\n", oem));
|
||||
+ WPS_FALLTHROUGH;
|
||||
case 0:
|
||||
return UNKNOWN;
|
||||
}
|
||||
--
|
||||
2.9.4
|
||||
|
||||
@@ -5,7 +5,10 @@ LIC_FILES_CHKSUM = " \
|
||||
file://COPYING.MPL;md5=815ca599c9df247a0c7f619bab123dad \
|
||||
"
|
||||
|
||||
SRC_URI = "http://dev-www.libreoffice.org/src/${BPN}-${PV}.tar.xz"
|
||||
SRC_URI = " \
|
||||
http://dev-www.libreoffice.org/src/${BPN}-${PV}.tar.xz \
|
||||
file://0001-g-7-try-to-remove-some-warnings.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "b04428f208e2eb31adcba5a53dec62c2"
|
||||
SRC_URI[sha256sum] = "e48a7c2fd20048a0a8eaf69bad972575f8b9f06e7497c787463f127d332fccd0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user