summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-02 18:24:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-03 06:47:35 +0000
commitba423579255848440318d6c468a604914901779b (patch)
tree7c4bc01a2c7210bca3e8a19a012b15312f37b588
parentafa675469cd9894f41a6b9eeb2e7acc8245d256c (diff)
Remove uses of SAL_CONSTEXPR in LIBO_INTERNAL_ONLY
Change-Id: I9a7dc7c83302b3361f056fcf6636bbba7672f15f Reviewed-on: https://gerrit.libreoffice.org/34840 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--include/o3tl/typed_flags_set.hxx55
-rw-r--r--include/osl/time.h4
-rw-r--r--include/rtl/stringutils.hxx14
-rw-r--r--include/rtl/ustring.hxx2
-rw-r--r--include/svx/dlgutil.hxx4
-rw-r--r--include/vcl/scheduler.hxx4
-rw-r--r--sc/source/filter/excel/xlpage.cxx8
-rw-r--r--sot/source/base/formats.cxx4
-rw-r--r--sw/inc/docary.hxx2
-rw-r--r--sw/inc/swtypes.hxx2
-rw-r--r--sw/inc/viewopt.hxx6
-rw-r--r--vcl/opengl/LineRenderUtils.cxx2
-rw-r--r--vcl/opengl/texture.cxx2
13 files changed, 48 insertions, 61 deletions
diff --git a/include/o3tl/typed_flags_set.hxx b/include/o3tl/typed_flags_set.hxx
index dfb196a582e1..09f0b61d8c01 100644
--- a/include/o3tl/typed_flags_set.hxx
+++ b/include/o3tl/typed_flags_set.hxx
@@ -32,14 +32,14 @@ namespace o3tl {
namespace detail {
-template<typename T> inline SAL_CONSTEXPR
+template<typename T> constexpr
typename std::enable_if<std::is_signed<T>::value, bool>::type isNonNegative(
T value)
{
return value >= 0;
}
-template<typename T> inline SAL_CONSTEXPR
+template<typename T> constexpr
typename std::enable_if<std::is_unsigned<T>::value, bool>::type isNonNegative(T)
{
return true;
@@ -73,8 +73,7 @@ struct is_typed_flags {
public:
typedef is_typed_flags Unwrapped;
- explicit SAL_CONSTEXPR Wrap(
- typename std::underlying_type<E>::type value):
+ explicit constexpr Wrap(typename std::underlying_type<E>::type value):
value_(value)
{
#if HAVE_CXX14_CONSTEXPR
@@ -87,13 +86,13 @@ struct is_typed_flags {
#endif
}
- SAL_CONSTEXPR operator E() const { return static_cast<E>(value_); }
+ constexpr operator E() const { return static_cast<E>(value_); }
- explicit SAL_CONSTEXPR operator typename std::underlying_type<E>::type()
+ explicit constexpr operator typename std::underlying_type<E>::type()
const
{ return value_; }
- explicit SAL_CONSTEXPR operator bool() const { return value_ != 0; }
+ explicit constexpr operator bool() const { return value_ != 0; }
private:
typename std::underlying_type<E>::type value_;
@@ -105,7 +104,7 @@ struct is_typed_flags {
}
template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ~(E rhs) {
+constexpr typename o3tl::typed_flags<E>::Wrap operator ~(E rhs) {
#if HAVE_CXX14_CONSTEXPR
assert(
o3tl::detail::isNonNegative(
@@ -116,8 +115,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ~(E rhs) {
& ~static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ~(
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ~(
typename o3tl::typed_flags<E>::Wrap rhs)
{
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
@@ -125,8 +123,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ~(
& ~static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ^(
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ^(
E lhs, E rhs)
{
#if HAVE_CXX14_CONSTEXPR
@@ -142,8 +139,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ^(
^ static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ^(
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ^(
E lhs, typename o3tl::typed_flags<E>::Wrap rhs)
{
#if HAVE_CXX14_CONSTEXPR
@@ -156,8 +152,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ^(
^ static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ^(
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ^(
typename o3tl::typed_flags<E>::Wrap lhs, E rhs)
{
#if HAVE_CXX14_CONSTEXPR
@@ -170,8 +165,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator ^(
^ static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename W>
-inline SAL_CONSTEXPR
+template<typename W> constexpr
typename o3tl::typed_flags<typename W::Unwrapped::Self>::Wrap operator ^(
W lhs, W rhs)
{
@@ -185,9 +179,7 @@ typename o3tl::typed_flags<typename W::Unwrapped::Self>::Wrap operator ^(
}
template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator &(
- E lhs, E rhs)
-{
+constexpr typename o3tl::typed_flags<E>::Wrap operator &(E lhs, E rhs) {
#if HAVE_CXX14_CONSTEXPR
assert(
o3tl::detail::isNonNegative(
@@ -201,8 +193,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator &(
& static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator &(
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator &(
E lhs, typename o3tl::typed_flags<E>::Wrap rhs)
{
#if HAVE_CXX14_CONSTEXPR
@@ -215,8 +206,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator &(
& static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator &(
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator &(
typename o3tl::typed_flags<E>::Wrap lhs, E rhs)
{
#if HAVE_CXX14_CONSTEXPR
@@ -229,8 +219,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator &(
& static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename W>
-inline SAL_CONSTEXPR
+template<typename W> constexpr
typename o3tl::typed_flags<typename W::Unwrapped::Self>::Wrap operator &(
W lhs, W rhs)
{
@@ -244,7 +233,7 @@ typename o3tl::typed_flags<typename W::Unwrapped::Self>::Wrap operator &(
}
template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator |(E lhs, E rhs) {
+constexpr typename o3tl::typed_flags<E>::Wrap operator |(E lhs, E rhs) {
#if HAVE_CXX14_CONSTEXPR
assert(
o3tl::detail::isNonNegative(
@@ -258,8 +247,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator |(E lhs, E rhs
| static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator |(
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator |(
E lhs, typename o3tl::typed_flags<E>::Wrap rhs)
{
#if HAVE_CXX14_CONSTEXPR
@@ -272,8 +260,7 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator |(
| static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename E>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator |(
+template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator |(
typename o3tl::typed_flags<E>::Wrap lhs, E rhs)
{
#if HAVE_CXX14_CONSTEXPR
@@ -286,8 +273,8 @@ inline SAL_CONSTEXPR typename o3tl::typed_flags<E>::Wrap operator |(
| static_cast<typename std::underlying_type<E>::type>(rhs));
}
-template<typename W>
-inline SAL_CONSTEXPR typename o3tl::typed_flags<typename W::Unwrapped::Self>::Wrap operator |(
+template<typename W> constexpr
+typename o3tl::typed_flags<typename W::Unwrapped::Self>::Wrap operator |(
W lhs, W rhs)
{
return static_cast<W>(
diff --git a/include/osl/time.h b/include/osl/time.h
index 44f9af817759..965675301ef6 100644
--- a/include/osl/time.h
+++ b/include/osl/time.h
@@ -44,10 +44,10 @@
struct TimeValue {
TimeValue() = default;
- SAL_CONSTEXPR TimeValue(sal_uInt32 seconds, sal_uInt32 nanoseconds):
+ constexpr TimeValue(sal_uInt32 seconds, sal_uInt32 nanoseconds):
Seconds(seconds), Nanosec(nanoseconds) {}
- template<typename Rep, typename Period> SAL_CONSTEXPR
+ template<typename Rep, typename Period> constexpr
TimeValue(std::chrono::duration<Rep, Period> const & duration):
Seconds(
std::chrono::duration_cast<std::chrono::nanoseconds>(
diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx
index dadbda61ec97..a88f5be861fd 100644
--- a/include/rtl/stringutils.hxx
+++ b/include/rtl/stringutils.hxx
@@ -72,7 +72,7 @@ namespace rtl
@since LibreOffice 5.0
*/
struct SAL_WARN_UNUSED OUStringLiteral1_ {
- SAL_CONSTEXPR OUStringLiteral1_(sal_Unicode theC): c(theC) {}
+ constexpr OUStringLiteral1_(sal_Unicode theC): c(theC) {}
sal_Unicode const c;
};
#if defined _MSC_VER && _MSC_VER <= 1900 && !defined __clang__
@@ -173,9 +173,9 @@ struct ConstCharArrayDetector< const char[ N ], T >
template<std::size_t N, typename T>
struct ConstCharArrayDetector<sal_Unicode const [N], T> {
using TypeUtf16 = T;
- static SAL_CONSTEXPR bool const ok = true;
- static SAL_CONSTEXPR std::size_t const length = N - 1;
- static SAL_CONSTEXPR sal_Unicode const * toPointer(
+ static constexpr bool const ok = true;
+ static constexpr std::size_t const length = N - 1;
+ static constexpr sal_Unicode const * toPointer(
sal_Unicode const (& literal)[N])
{ return literal; }
};
@@ -189,9 +189,9 @@ template<typename T> struct ConstCharArrayDetector<
T>
{
using TypeUtf16 = T;
- static SAL_CONSTEXPR bool const ok = true;
- static SAL_CONSTEXPR std::size_t const length = 1;
- static SAL_CONSTEXPR sal_Unicode const * toPointer(
+ static constexpr bool const ok = true;
+ static constexpr std::size_t const length = 1;
+ static constexpr sal_Unicode const * toPointer(
OUStringLiteral1_ const & literal)
{ return &literal.c; }
};
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index eed067c1b754..1bc66d3d8ac2 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -70,7 +70,7 @@ This class is not part of public API and is meant to be used only in LibreOffice
*/
struct SAL_WARN_UNUSED OUStringLiteral
{
- template<typename T> SAL_CONSTEXPR OUStringLiteral(
+ template<typename T> constexpr OUStringLiteral(
T & literal,
typename libreoffice_internal::ConstCharArrayDetector<
T, libreoffice_internal::Dummy>::Type
diff --git a/include/svx/dlgutil.hxx b/include/svx/dlgutil.hxx
index 284d3554cdbb..59136e6fe487 100644
--- a/include/svx/dlgutil.hxx
+++ b/include/svx/dlgutil.hxx
@@ -33,8 +33,8 @@ SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit( const SfxItemSet& );
SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit();
SVX_DLLPUBLIC bool GetApplyCharUnit( const SfxItemSet& );
-SAL_CONSTEXPR DrawModeFlags const OUTPUT_DRAWMODE_COLOR = DrawModeFlags::Default;
-SAL_CONSTEXPR DrawModeFlags const OUTPUT_DRAWMODE_CONTRAST = DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient;
+constexpr DrawModeFlags OUTPUT_DRAWMODE_COLOR = DrawModeFlags::Default;
+constexpr DrawModeFlags OUTPUT_DRAWMODE_CONTRAST = DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient;
#endif
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index d504e28309e4..b4ed9e988ec8 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -33,8 +33,8 @@ protected:
static void ImplStartTimer ( sal_uInt64 nMS, bool bForce = false );
public:
- static const SAL_CONSTEXPR sal_uInt64 ImmediateTimeoutMs = 1;
- static const SAL_CONSTEXPR sal_uInt64 InfiniteTimeoutMs = 1000 * 60 * 60 * 24; // 1 day
+ static constexpr sal_uInt64 ImmediateTimeoutMs = 1;
+ static constexpr sal_uInt64 InfiniteTimeoutMs = 1000 * 60 * 60 * 24; // 1 day
static void ImplDeInitScheduler();
diff --git a/sc/source/filter/excel/xlpage.cxx b/sc/source/filter/excel/xlpage.cxx
index b45a0fc6719a..8ba6b2dc2ff7 100644
--- a/sc/source/filter/excel/xlpage.cxx
+++ b/sc/source/filter/excel/xlpage.cxx
@@ -38,20 +38,20 @@ struct XclPaperSize
long mnHeight; /// Paper height in twips.
};
-SAL_CONSTEXPR long in2twips(double n_inch)
+constexpr long in2twips(double n_inch)
{
return static_cast<long>( (n_inch * EXC_TWIPS_PER_INCH) + 0.5);
}
-SAL_CONSTEXPR long mm2twips(double n_mm)
+constexpr long mm2twips(double n_mm)
{
return static_cast<long>( (n_mm * EXC_TWIPS_PER_INCH / CM_PER_INCH / 10.0) + 0.5);
}
-SAL_CONSTEXPR long twips2mm(long n_twips)
+constexpr long twips2mm(long n_twips)
{
return static_cast<long>((static_cast<double>(n_twips) - 0.5) / EXC_TWIPS_PER_INCH * CM_PER_INCH * 10.0);
}
-SAL_CONSTEXPR XclPaperSize pPaperSizeTable[] =
+constexpr XclPaperSize pPaperSizeTable[] =
{
/* 0*/ { PAPER_USER, 0, 0 }, // undefined
{ PAPER_LETTER, in2twips( 8.5 ), in2twips( 11 ) }, // Letter
diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index 2dcc65cf2b20..ad0a0c0a5525 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -40,9 +40,9 @@ struct SotAction_Impl
SotExchangeActionFlags nFlags; // Action Id
sal_uInt8 nContextCheckId; // additional check of content in clipboard
- SAL_CONSTEXPR SotAction_Impl(SotClipboardFormatId _nFormatId, sal_uInt16 _nAction, SotExchangeActionFlags _nFlags, sal_uInt8 _nContextCheckId)
+ constexpr SotAction_Impl(SotClipboardFormatId _nFormatId, sal_uInt16 _nAction, SotExchangeActionFlags _nFlags, sal_uInt8 _nContextCheckId)
: nFormatId(_nFormatId), nAction(_nAction), nFlags(_nFlags), nContextCheckId(_nContextCheckId) {}
- SAL_CONSTEXPR SotAction_Impl(SotClipboardFormatId _nFormatId, sal_uInt16 _nAction)
+ constexpr SotAction_Impl(SotClipboardFormatId _nFormatId, sal_uInt16 _nAction)
: nFormatId(_nFormatId), nAction(_nAction), nFlags(SotExchangeActionFlags::NONE), nContextCheckId(0) {}
};
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index dec10c8e23d9..015ee47b047b 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -319,7 +319,7 @@ public:
typedef o3tl::sorted_vector<SwRangeRedline*, CompareSwRedlineTable,
o3tl::find_partialorder_ptrequals> vector_type;
typedef vector_type::size_type size_type;
- static SAL_CONSTEXPR size_type const npos = USHRT_MAX;
+ static constexpr size_type npos = USHRT_MAX;
//TODO: std::numeric_limits<size_type>::max()
private:
vector_type maVector;
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 2de88491609a..3c2110ccd955 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -60,7 +60,7 @@ typedef long SwTwips;
// Converts Millimeters to Twips (1 mm == 56.905479 twips).
template <typename T = SwTwips>
-static SAL_CONSTEXPR T MmToTwips(const double mm) { return static_cast<T>(mm / 0.017573); }
+constexpr T MmToTwips(const double mm) { return static_cast<T>(mm / 0.017573); }
#define MM50 283 // 1/2 cm in TWIPS.
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 39e30fdb0cb8..556e134d1724 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -377,11 +377,11 @@ public:
inline void SetDivisionY( short n ){ m_nDivisionY = n; }
// Default margin left and above document: 284 twips == 5.0 mm.
- static SAL_CONSTEXPR sal_uInt16 GetDefDocumentBorder() { return 284; }
+ static constexpr sal_uInt16 GetDefDocumentBorder() { return 284; }
// Default gap between pages: 284 twips == 5.0 mm.
- static SAL_CONSTEXPR sal_uInt16 GetDefGapBetweenPages() { return 284; }
+ static constexpr sal_uInt16 GetDefGapBetweenPages() { return 284; }
// Minimum edge-to-text distance: 22 twips == 0.4 mm.
- static SAL_CONSTEXPR sal_uInt16 GetMinGapBetweenPages() { return 22; }
+ static constexpr sal_uInt16 GetMinGapBetweenPages() { return 22; }
inline sal_uInt16 GetDocumentBorder() const { return IsWhitespaceHidden() ? GetMinGapBetweenPages() : GetDefDocumentBorder(); }
inline sal_uInt16 GetGapBetweenPages() const { return IsWhitespaceHidden() ? GetMinGapBetweenPages() : GetDefGapBetweenPages(); }
diff --git a/vcl/opengl/LineRenderUtils.cxx b/vcl/opengl/LineRenderUtils.cxx
index c815b8a014d2..bdf28b1120d1 100644
--- a/vcl/opengl/LineRenderUtils.cxx
+++ b/vcl/opengl/LineRenderUtils.cxx
@@ -151,7 +151,7 @@ void LineBuilder::appendRoundJoint(glm::vec2 const & point, glm::vec2 prevLineVe
void LineBuilder::appendRoundLineCapVertices(const glm::vec2& rPoint1, const glm::vec2& rPoint2)
{
- SAL_CONSTEXPR const int nRoundCapIteration = 12;
+ constexpr int nRoundCapIteration = 12;
glm::vec2 lineVector = vcl::vertex::normalize(rPoint2 - rPoint1);
glm::vec2 normal = glm::vec2(-lineVector.y, lineVector.x);
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index aff717dd8eb8..002d03f8bea0 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -34,7 +34,7 @@
namespace
{
-SAL_CONSTEXPR GLenum constInternalFormat = GL_RGBA8;
+constexpr GLenum constInternalFormat = GL_RGBA8;
} // end anonymous namespace