Kaydet (Commit) ba423579 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove uses of SAL_CONSTEXPR in LIBO_INTERNAL_ONLY

Change-Id: I9a7dc7c83302b3361f056fcf6636bbba7672f15f
Reviewed-on: https://gerrit.libreoffice.org/34840Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst afa67546
......@@ -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>(
......
......@@ -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>(
......
......@@ -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; }
};
......
......@@ -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
......
......@@ -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
......
......@@ -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();
......
......@@ -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
......
......@@ -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) {}
};
......
......@@ -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;
......
......@@ -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.
......
......@@ -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(); }
......
......@@ -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);
......
......@@ -34,7 +34,7 @@
namespace
{
SAL_CONSTEXPR GLenum constInternalFormat = GL_RGBA8;
constexpr GLenum constInternalFormat = GL_RGBA8;
} // end anonymous namespace
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment