diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-05-10 16:42:16 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-07-20 01:26:06 -0400 |
commit | e7b11300cd813f821d1ec5cb4633ce2c5f7d1b9f (patch) | |
tree | a6c39d9d4cde1baa84a9d788affbce3508af89a8 /vcl/source | |
parent | 34f591ca95c4c63be092da4c4b2294230404f336 (diff) |
Replace fallthrough comments with new SAL_FALLTHROUGH macro
...which (in LIBO_INTERNAL_ONLY) for Clang expands to [[clang::fallthrough]] in
preparation of enabling -Wimplicit-fallthrough. (This is only relevant for
C++11, as neither C nor old C++ has a way to annotate intended fallthroughs.)
Could use BOOST_FALLTHROUGH instead of introducing our own SAL_FALLTHROUGH, but
that would require adding back in dependencies on boost_headers to many
libraries where we carefully removed any remaining Boost dependencies only
recently. (At least make SAL_FALLTHROUGH strictly LIBO_INTERNAL_ONLY, so its
future evolution will not have any impact on the stable URE interface.) C++17
will have a proper [[fallthroug]], eventually removing the need for a macro
altogether.
(cherry picked from commit 14cd5182c5f64c43581c82db8c958369152226ac)
Change-Id: I342a7610a107db7d7a344ea9cbddfd9714d7e9ca
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/edit.cxx | 4 | ||||
-rw-r--r-- | vcl/source/edit/textview.cxx | 24 | ||||
-rw-r--r-- | vcl/source/fontsubset/cff.cxx | 2 | ||||
-rw-r--r-- | vcl/source/fontsubset/xlat.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/pngread.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/decoview.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/winproc.cxx | 2 |
9 files changed, 29 insertions, 21 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 5fb666e01122..523e12a30070 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1589,7 +1589,7 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) case css::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: case css::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: bSelect = true; - // fallthrough intended + SAL_FALLTHROUGH; case css::awt::Key::MOVE_TO_BEGIN_OF_LINE: case css::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH: case css::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: @@ -1598,7 +1598,7 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) case css::awt::Key::SELECT_TO_END_OF_PARAGRAPH: case css::awt::Key::SELECT_TO_END_OF_DOCUMENT: bSelect = true; - // fallthrough intended + SAL_FALLTHROUGH; case css::awt::Key::MOVE_TO_END_OF_LINE: case css::awt::Key::MOVE_TO_END_OF_PARAGRAPH: case css::awt::Key::MOVE_TO_END_OF_DOCUMENT: diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index 1baddd57b150..1db0da853d3b 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -1265,42 +1265,50 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent ) case KEY_RIGHT: aPaM = bCtrl ? CursorWordRight( aPaM ) : CursorRight( aPaM, aTranslatedKeyEvent.GetKeyCode().IsMod2() ? (sal_uInt16)i18n::CharacterIteratorMode::SKIPCHARACTER : (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL ); break; case css::awt::Key::SELECT_WORD_FORWARD: - bSelect = true; // fallthrough intentional + bSelect = true; + SAL_FALLTHROUGH; case css::awt::Key::MOVE_WORD_FORWARD: aPaM = CursorWordRight( aPaM ); break; case css::awt::Key::SELECT_WORD_BACKWARD: - bSelect = true; // fallthrough intentional + bSelect = true; + SAL_FALLTHROUGH; case css::awt::Key::MOVE_WORD_BACKWARD: aPaM = CursorWordLeft( aPaM ); break; case css::awt::Key::SELECT_TO_BEGIN_OF_LINE: - bSelect = true; // fallthrough intentional + bSelect = true; + SAL_FALLTHROUGH; case css::awt::Key::MOVE_TO_BEGIN_OF_LINE: aPaM = CursorStartOfLine( aPaM ); break; case css::awt::Key::SELECT_TO_END_OF_LINE: - bSelect = true; // fallthrough intentional + bSelect = true; + SAL_FALLTHROUGH; case css::awt::Key::MOVE_TO_END_OF_LINE: aPaM = CursorEndOfLine( aPaM ); break; case css::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: - bSelect = true; // falltthrough intentional + bSelect = true; + SAL_FALLTHROUGH; case css::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH: aPaM = CursorStartOfParagraph( aPaM ); break; case css::awt::Key::SELECT_TO_END_OF_PARAGRAPH: - bSelect = true; // falltthrough intentional + bSelect = true; + SAL_FALLTHROUGH; case css::awt::Key::MOVE_TO_END_OF_PARAGRAPH: aPaM = CursorEndOfParagraph( aPaM ); break; case css::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: - bSelect = true; // falltthrough intentional + bSelect = true; + SAL_FALLTHROUGH; case css::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: aPaM = CursorStartOfDoc(); break; case css::awt::Key::SELECT_TO_END_OF_DOCUMENT: - bSelect = true; // falltthrough intentional + bSelect = true; + SAL_FALLTHROUGH; case css::awt::Key::MOVE_TO_END_OF_DOCUMENT: aPaM = CursorEndOfDoc(); break; diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 3a46f474e00b..54af9444fd81 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -1002,7 +1002,7 @@ void CffSubsetterContext::convertOneTypeEsc() assert( mnStackIdx >= 1 ); if( pTop[0] >= 0) break; - // fall through + SAL_FALLTHROUGH; case TYPE2OP::NEG: assert( mnStackIdx >= 1 ); pTop[0] = -pTop[0]; diff --git a/vcl/source/fontsubset/xlat.cxx b/vcl/source/fontsubset/xlat.cxx index 408e6b1aef22..6fc4cb7b6559 100644 --- a/vcl/source/fontsubset/xlat.cxx +++ b/vcl/source/fontsubset/xlat.cxx @@ -68,7 +68,7 @@ void ConverterCache::ensureConverter( int nSelect ) rtl_TextEncoding eRecodeFrom = RTL_TEXTENCODING_UNICODE; switch( nSelect ) { - default: nSelect = 1; // fall through to unicode recoding + default: nSelect = 1; SAL_FALLTHROUGH; // to unicode recoding case 1: eRecodeFrom = RTL_TEXTENCODING_UNICODE; break; case 2: eRecodeFrom = RTL_TEXTENCODING_SHIFT_JIS; break; case 3: eRecodeFrom = RTL_TEXTENCODING_GB_2312; break; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index e576f2a5c028..e667cb23ec41 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5388,7 +5388,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() else appendName( rWidget.m_aValue, aValue ); } - // fall-through + SAL_FALLTHROUGH; case PDFWriter::PushButton: aLine.append( "Btn" ); break; @@ -10980,7 +10980,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) aCol[1] = rObject.m_aGradient.GetEndColor().GetGreen(); aCol[2] = rObject.m_aGradient.GetEndColor().GetBlue(); CHECK_RETURN( writeBuffer( aCol, 3 ) ); - // fall-through + SAL_FALLTHROUGH; case GradientStyle_LINEAR: { aCol[0] = rObject.m_aGradient.GetStartColor().GetRed(); diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index 8af9f0b200d0..1eb2663096ce 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -513,7 +513,7 @@ bool PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) break; case 16 : mnTargetDepth = 8; // we have to reduce the bitmap - // fall through + SAL_FALLTHROUGH; case 1 : case 4 : case 8 : @@ -547,7 +547,7 @@ bool PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) { case 2 : mnTargetDepth = 4; // we have to expand the bitmap - // fall through + SAL_FALLTHROUGH; case 1 : case 4 : case 8 : diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index 538c6b1d9573..0f623ebdc8a4 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -256,7 +256,7 @@ void ImplDrawSymbol( OutputDevice* pDev, Rectangle nRect, const SymbolType eType pDev->DrawLine( Point( nRect.Left(), aCenter.Y()-n2+1 ), Point( nRect.Left(), aCenter.Y()+n2-1 ) ); ++nRect.Left(); - // Intentional fall-through + SAL_FALLTHROUGH; case SymbolType::WINDBACKWARD: pDev->DrawPixel( Point( nRect.Left(), aCenter.Y() ) ); pDev->DrawPixel( Point( nRect.Left()+n2, aCenter.Y() ) ); @@ -274,7 +274,7 @@ void ImplDrawSymbol( OutputDevice* pDev, Rectangle nRect, const SymbolType eType pDev->DrawLine( Point( nRect.Right(), aCenter.Y()-n2+1 ), Point( nRect.Right(), aCenter.Y()+n2-1 ) ); --nRect.Right(); - // Intentional fall-through + SAL_FALLTHROUGH; case SymbolType::WINDFORWARD: pDev->DrawPixel( Point( nRect.Right(), aCenter.Y() ) ); pDev->DrawPixel( Point( nRect.Right()-n2, aCenter.Y() ) ); @@ -313,7 +313,7 @@ void ImplDrawSymbol( OutputDevice* pDev, Rectangle nRect, const SymbolType eType Point( nRect.Right(), nRect.Bottom() ) ); pDev->DrawLine( Point( nRect.Left(), nRect.Bottom() ), Point( nRect.Right(), nRect.Bottom() ) ); - // Intentional fall-through + SAL_FALLTHROUGH; case SymbolType::ROLLUP: pDev->DrawRect( Rectangle( nRect.Left(), nRect.Top(), nRect.Right(), nRect.Top()+n8 ) ); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index e4efb2667270..7d0ea1544ac6 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -603,7 +603,7 @@ void VclButtonBox::setAllocation(const Size &rAllocation) break; default: SAL_WARN("vcl.layout", "todo unimplemented layout style"); - //fall-through + SAL_FALLTHROUGH; case VCL_BUTTONBOX_DEFAULT_STYLE: case VCL_BUTTONBOX_END: if (!aReq.m_aMainGroupDimensions.empty()) diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 599bd9fcd4db..6fa8dde994b9 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -2609,7 +2609,7 @@ bool ImplWindowFrameProc( vcl::Window* _pWindow, SalFrame* /*pFrame*/, ImplHandleSurroundingTextSelectionChange( pWindow, pEvt->mnStart, pEvt->mnEnd ); - // Fallthrough really intended? + SAL_FALLTHROUGH; // TODO: Fallthrough really intended? } case SALEVENT_STARTRECONVERSION: ImplHandleStartReconversion( pWindow ); |