diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-08-04 09:02:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-08-04 11:21:42 +0200 |
commit | c712520cf327de27553f62d0defcce4ba901e4c7 (patch) | |
tree | d4ce4b6d59f252ec0b6ca0b308329ddafe10aade /oox | |
parent | 96fb8f88bd56c113eb23e50d23a038509703c288 (diff) |
Silence false -Werror=maybe-uninitialized
...in code recently added with 7e23cbdbb6ec0247a29ed8a8f744c01e10963ea0
"tdf#149551 separate TextRotateAngle from TextPreRotateAngle", hitting at least
with gcc-c++-12.1.1-1.fc36.x86_64,
> In file included from include/tools/degree.hxx:15,
> from include/vcl/bitmap.hxx:23,
> from include/vcl/alpha.hxx:28,
> from include/vcl/bitmapex.hxx:24,
> from include/vcl/graph.hxx:26,
> from include/oox/export/drawingml.hxx:47,
> from oox/source/export/drawingml.cxx:26:
> In function ‘o3tl::strong_int<UT, PT> o3tl::operator+(const strong_int<UT, PT>&, const strong_int<UT, PT>&) [with UT = int; PT = FractionTag<100>]’,
> inlined from ‘void oox::drawingml::DrawingML::WriteText(const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>&, bool, bool, sal_Int32, bool)’ at oox/source/export/drawingml.cxx:3520:33:
> include/o3tl/strong_int.hxx:143:12: error: ‘*(const o3tl::strong_int<int, FractionTag<100> >*)((char*)&nTextRotateAngleDeg100 + offsetof(std::optional<o3tl::strong_int<int, FractionTag<100> > >,std::optional<o3tl::strong_int<int, FractionTag<100> > >::<unnamed>.std::_Optional_base<o3tl::strong_int<int, FractionTag<100> >, true, true>::<unnamed>)).o3tl::strong_int<int, FractionTag<100> >::m_value’ may be used uninitialized [-Werror=maybe-uninitialized]
> 143 | return strong_int<UT,PT>(lhs.get() + rhs.get());
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> oox/source/export/drawingml.cxx: In member function ‘void oox::drawingml::DrawingML::WriteText(const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>&, bool, bool, sal_Int32, bool)’:
> oox/source/export/drawingml.cxx:3346:30: note: ‘*(const o3tl::strong_int<int, FractionTag<100> >*)((char*)&nTextRotateAngleDeg100 + offsetof(std::optional<o3tl::strong_int<int, FractionTag<100> > >,std::optional<o3tl::strong_int<int, FractionTag<100> > >::<unnamed>.std::_Optional_base<o3tl::strong_int<int, FractionTag<100> >, true, true>::<unnamed>)).o3tl::strong_int<int, FractionTag<100> >::m_value’ was declared here
> 3346 | std::optional<Degree100> nTextRotateAngleDeg100; // text area rotation
> | ^~~~~~~~~~~~~~~~~~~~~~
and then
> In file included from include/oox/export/drawingml.hxx:38,
> from oox/source/export/drawingml.cxx:26:
> In function ‘rtl::OString oox::drawingml::calcRotationValue(sal_Int32)’,
> inlined from ‘void oox::drawingml::DrawingML::WriteText(const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>&, bool, bool, sal_Int32, bool)’ at oox/source/export/drawingml.cxx:3551:48:
> include/oox/drawingml/drawingmltypes.hxx:168:19: error: ‘*(const o3tl::strong_int<int, FractionTag<100> >*)((char*)&nTextRotateAngleDeg100 + offsetof(std::optional<o3tl::strong_int<int, FractionTag<100> > >,std::optional<o3tl::strong_int<int, FractionTag<100> > >::<unnamed>.std::_Optional_base<o3tl::strong_int<int, FractionTag<100> >, true, true>::<unnamed>)).o3tl::strong_int<int, FractionTag<100> >::m_value’ may be used uninitialized [-Werror=maybe-uninitialized]
> 168 | nRotation -= 36000;
> | ~~~~~~~~~~^~~~~~~~
> oox/source/export/drawingml.cxx: In member function ‘void oox::drawingml::DrawingML::WriteText(const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>&, bool, bool, sal_Int32, bool)’:
> oox/source/export/drawingml.cxx:3346:30: note: ‘*(const o3tl::strong_int<int, FractionTag<100> >*)((char*)&nTextRotateAngleDeg100 + offsetof(std::optional<o3tl::strong_int<int, FractionTag<100> > >,std::optional<o3tl::strong_int<int, FractionTag<100> > >::<unnamed>.std::_Optional_base<o3tl::strong_int<int, FractionTag<100> >, true, true>::<unnamed>)).o3tl::strong_int<int, FractionTag<100> >::m_value’ was declared here
> 3346 | std::optional<Degree100> nTextRotateAngleDeg100; // text area rotation
> | ^~~~~~~~~~~~~~~~~~~~~~
Change-Id: Id0bf911ada8f8d7343e9c51107776e303ed72a25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137779
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/drawingml.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 63a5d22dd222..0f3008bc3482 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3516,8 +3516,15 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo } else if (nTextPreRotateAngle == -180 || nTextPreRotateAngle == 180) { +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 12 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif nTextRotateAngleDeg100 = NormAngle18000(nTextRotateAngleDeg100.value_or(0_deg100) + 18000_deg100); +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 12 +#pragma GCC diagnostic pop +#endif // ToDo: Examine insets. They might need rotation too. } else @@ -3540,8 +3547,15 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo std::optional<OString> sTextRotateAngleMSUnit; if (nTextRotateAngleDeg100.has_value()) +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 12 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif sTextRotateAngleMSUnit = oox::drawingml::calcRotationValue(nTextRotateAngleDeg100.value().get()); +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 12 +#pragma GCC diagnostic pop +#endif TextHorizontalAdjust eHorizontalAlignment( TextHorizontalAdjust_CENTER ); bool bHorizontalCenter = false; |