mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
Introduced macro to silence implicit-fallthrough warning
The fallthrough comment is not enough to silence the warning with -Wimplicit-fallthrough=5. This commit also fixes submodule handling in github actions.
This commit is contained in:
@ -34,8 +34,11 @@
|
|||||||
* left empty.
|
* left empty.
|
||||||
* WSREP_UNUSED - Can be used to mark variables which may be present in
|
* WSREP_UNUSED - Can be used to mark variables which may be present in
|
||||||
* debug builds but not in release builds.
|
* debug builds but not in release builds.
|
||||||
|
* WSREP_FALLTHROUGH - Silence implicit fallthrough warning.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef WSREP_LIB_COMPILER_HPP
|
||||||
|
#define WSREP_LIB_COMPILER_HPP
|
||||||
|
|
||||||
#if __cplusplus >= 201103L && !(__GNUC__ == 4 && __GNUG_MINOR__ < 8)
|
#if __cplusplus >= 201103L && !(__GNUC__ == 4 && __GNUG_MINOR__ < 8)
|
||||||
#define WSREP_NORETURN [[noreturn]]
|
#define WSREP_NORETURN [[noreturn]]
|
||||||
@ -51,3 +54,17 @@
|
|||||||
#define WSREP_OVERRIDE
|
#define WSREP_OVERRIDE
|
||||||
#endif // __cplusplus >= 201103L
|
#endif // __cplusplus >= 201103L
|
||||||
#define WSREP_UNUSED __attribute__((unused))
|
#define WSREP_UNUSED __attribute__((unused))
|
||||||
|
|
||||||
|
#if __GNUC__ >= 7
|
||||||
|
#define WSREP_FALLTHROUGH __attribute__((fallthrough))
|
||||||
|
#elif defined(__clang__)
|
||||||
|
# if defined(__has_warning)
|
||||||
|
# if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
|
||||||
|
# define WSREP_FALLTHROUGH [[clang::fallthrough]]
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#else // __clang __
|
||||||
|
#define WSREP_FALLTHROUGH ((void)0)
|
||||||
|
#endif // __GNUC__ >= 7 || (__clang__ && __clang_major__ >= 10)
|
||||||
|
|
||||||
|
#endif // WSREP_LIB_COMPILER_HPP
|
||||||
|
@ -1086,7 +1086,7 @@ void wsrep::server_state::on_sync()
|
|||||||
break;
|
break;
|
||||||
case s_connected:
|
case s_connected:
|
||||||
state(lock, s_joiner);
|
state(lock, s_joiner);
|
||||||
// fall through
|
WSREP_FALLTHROUGH;
|
||||||
case s_joiner:
|
case s_joiner:
|
||||||
state(lock, s_initializing);
|
state(lock, s_initializing);
|
||||||
break;
|
break;
|
||||||
@ -1096,7 +1096,7 @@ void wsrep::server_state::on_sync()
|
|||||||
break;
|
break;
|
||||||
case s_initialized:
|
case s_initialized:
|
||||||
state(lock, s_joined);
|
state(lock, s_joined);
|
||||||
// fall through
|
WSREP_FALLTHROUGH;
|
||||||
default:
|
default:
|
||||||
/* State */
|
/* State */
|
||||||
state(lock, s_synced);
|
state(lock, s_synced);
|
||||||
|
@ -677,9 +677,9 @@ int wsrep::transaction::before_rollback()
|
|||||||
case s_preparing:
|
case s_preparing:
|
||||||
// Error detected during prepare phase
|
// Error detected during prepare phase
|
||||||
state(lock, s_must_abort);
|
state(lock, s_must_abort);
|
||||||
// fall through
|
WSREP_FALLTHROUGH;
|
||||||
case s_prepared:
|
case s_prepared:
|
||||||
// fall through
|
WSREP_FALLTHROUGH;
|
||||||
case s_executing:
|
case s_executing:
|
||||||
// Voluntary rollback
|
// Voluntary rollback
|
||||||
if (is_streaming())
|
if (is_streaming())
|
||||||
@ -850,7 +850,7 @@ int wsrep::transaction::after_statement()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Continue to replay if rollback() changed the state to s_must_replay
|
// Continue to replay if rollback() changed the state to s_must_replay
|
||||||
// Fall through
|
WSREP_FALLTHROUGH;
|
||||||
case s_must_replay:
|
case s_must_replay:
|
||||||
{
|
{
|
||||||
if (is_xa() && !ordered())
|
if (is_xa() && !ordered())
|
||||||
@ -1404,7 +1404,7 @@ int wsrep::transaction::streaming_step(wsrep::unique_lock<wsrep::mutex>& lock,
|
|||||||
switch (streaming_context_.fragment_unit())
|
switch (streaming_context_.fragment_unit())
|
||||||
{
|
{
|
||||||
case streaming_context::row:
|
case streaming_context::row:
|
||||||
// fall through
|
WSREP_FALLTHROUGH;
|
||||||
case streaming_context::statement:
|
case streaming_context::statement:
|
||||||
streaming_context_.increment_unit_counter(1);
|
streaming_context_.increment_unit_counter(1);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user