mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
add V_FALLTHROUGH for explicit fallthrough
This commit is contained in:
parent
01acd03a71
commit
11537972f3
@ -20,6 +20,32 @@ class VNotebook;
|
||||
#define V_ASSERT(cond) ((!(cond)) ? qt_assert(#cond, __FILE__, __LINE__) : qt_noop())
|
||||
#endif
|
||||
|
||||
// Thanks to CGAL/cgal.
|
||||
#ifndef __has_attribute
|
||||
#define __has_attribute(x) 0 // Compatibility with non-clang compilers.
|
||||
#endif
|
||||
|
||||
#ifndef __has_cpp_attribute
|
||||
#define __has_cpp_attribute(x) 0 // Compatibility with non-supporting compilers.
|
||||
#endif
|
||||
|
||||
// The fallthrough attribute.
|
||||
// See for clang:
|
||||
// http://clang.llvm.org/docs/AttributeReference.html#statement-attributes
|
||||
// See for gcc:
|
||||
// https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||
#if __has_cpp_attribute(fallthrough)
|
||||
# define V_FALLTHROUGH [[fallthrough]]
|
||||
#elif __has_cpp_attribute(gnu::fallthrough)
|
||||
# define V_FALLTHROUGH [[gnu::fallthrough]]
|
||||
#elif __has_cpp_attribute(clang::fallthrough)
|
||||
# define V_FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif __has_attribute(fallthrough) && ! __clang__
|
||||
# define V_FALLTHROUGH __attribute__ ((fallthrough))
|
||||
#else
|
||||
# define V_FALLTHROUGH while(false){}
|
||||
#endif
|
||||
|
||||
enum class MessageBoxType
|
||||
{
|
||||
Normal = 0,
|
||||
|
@ -1115,6 +1115,8 @@ bool VVim::handleKeyPressEvent(int key, int modifiers, int *p_autoIndentPos)
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
V_FALLTHROUGH;
|
||||
}
|
||||
|
||||
case Qt::Key_PageUp:
|
||||
@ -1381,6 +1383,8 @@ bool VVim::handleKeyPressEvent(int key, int modifiers, int *p_autoIndentPos)
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
V_FALLTHROUGH;
|
||||
}
|
||||
|
||||
case Qt::Key_Escape:
|
||||
@ -3481,6 +3485,8 @@ void VVim::processDeleteAction(QList<Token> &p_tokens)
|
||||
// Fall through.
|
||||
mayCrossBlock = true;
|
||||
|
||||
V_FALLTHROUGH;
|
||||
|
||||
case Range::WordAround:
|
||||
// Fall through.
|
||||
case Range::WordInner:
|
||||
@ -3712,6 +3718,8 @@ void VVim::processCopyAction(QList<Token> &p_tokens)
|
||||
// Fall through.
|
||||
mayCrossBlock = true;
|
||||
|
||||
V_FALLTHROUGH;
|
||||
|
||||
case Range::WordAround:
|
||||
// Fall through.
|
||||
case Range::WordInner:
|
||||
|
Loading…
x
Reference in New Issue
Block a user