diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-05-10 16:42:16 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-05-10 16:42:16 +0200 |
commit | 14cd5182c5f64c43581c82db8c958369152226ac (patch) | |
tree | 57f150ba2707f29214eeb9b1eaad2373780d1b15 /vcl/source | |
parent | e4bb2b4f4875c15bd68297b5be716edd6859841e (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.
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 9fda579dda51..5c28f9f8afc3 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1568,7 +1568,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: @@ -1577,7 +1577,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 daaf4f480b29..a033c6b871b7 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -1214,42 +1214,50 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent ) case KEY_RIGHT: aPaM = bCtrl ? CursorWordRight( aPaM ) : CursorRight( aPaM, aTranslatedKeyEvent.GetKeyCode().IsMod2() ? (sal_uInt16) css::i18n::CharacterIteratorMode::SKIPCHARACTER : (sal_uInt16) css::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 6ea7268318a4..ac3bf78bb098 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 2299f71c91fb..c7a177ced98c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5341,7 +5341,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() else appendName( rWidget.m_aValue, aValue ); } - // fall-through + SAL_FALLTHROUGH; case PDFWriter::PushButton: aLine.append( "Btn" ); break; @@ -10928,7 +10928,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 b4ce854c4a28..223e0e3a0775 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -516,7 +516,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 : @@ -550,7 +550,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 4e75b536c608..717b899b9ad2 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 59a970a8caae..2c6cabff51e7 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 fc39c2fc277d..cde81f6163c6 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -2559,7 +2559,7 @@ bool ImplWindowFrameProc( vcl::Window* _pWindow, SalEvent nEvent, const void* pE ImplHandleSurroundingTextSelectionChange( pWindow, pEvt->mnStart, pEvt->mnEnd ); - // Fallthrough really intended? + SAL_FALLTHROUGH; // TODO: Fallthrough really intended? } case SalEvent::StartReconversion: ImplHandleStartReconversion( pWindow ); |