mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-07 01:06:45 +08:00
add IPC_FALLTHROUGH_([[fallthrough]])
This commit is contained in:
parent
30fa347f56
commit
ba5c8f57cf
@ -43,7 +43,7 @@ struct msg_t<0, AlignSize> {
|
||||
|
||||
template <std::size_t DataSize, std::size_t AlignSize>
|
||||
struct msg_t {
|
||||
msg_t<0, AlignSize> head_ {};
|
||||
msg_t<0, AlignSize> head_ { 0, 0, 0, false };
|
||||
std::aligned_storage_t<DataSize, AlignSize> data_ {};
|
||||
|
||||
msg_t() = default;
|
||||
|
||||
@ -17,10 +17,21 @@
|
||||
#ifdef IPC_UNUSED_
|
||||
# error "IPC_UNUSED_ has been defined."
|
||||
#endif
|
||||
#ifdef IPC_FALLTHROUGH_
|
||||
# error "IPC_FALLTHROUGH_ has been defined."
|
||||
#endif
|
||||
#ifdef IPC_STBIND_
|
||||
# error "IPC_STBIND_ has been defined."
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
|
||||
#define IPC_UNUSED_ [[maybe_unused]]
|
||||
#define IPC_FALLTHROUGH_ [[fallthrough]]
|
||||
#define IPC_STBIND_(A, B, ...) auto [A, B] = __VA_ARGS__
|
||||
|
||||
#else /*__cplusplus < 201703L*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define IPC_UNUSED_ __pragma(warning(suppress: 4100 4101 4189))
|
||||
#elif defined(__GNUC__)
|
||||
@ -28,19 +39,14 @@
|
||||
#else
|
||||
# define IPC_UNUSED_
|
||||
#endif
|
||||
#endif/*__cplusplus < 201703L*/
|
||||
|
||||
#ifdef IPC_STBIND_
|
||||
# error "IPC_STBIND_ has been defined."
|
||||
#endif
|
||||
#define IPC_FALLTHROUGH_
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define IPC_STBIND_(A, B, ...) auto [A, B] = __VA_ARGS__
|
||||
#else /*__cplusplus < 201703L*/
|
||||
#define IPC_STBIND_(A, B, ...) \
|
||||
auto tp___ = __VA_ARGS__ \
|
||||
auto A = std::get<0>(tp); \
|
||||
auto B = std::get<1>(tp)
|
||||
auto A = std::get<0>(tp___); \
|
||||
auto B = std::get<1>(tp___)
|
||||
|
||||
#endif/*__cplusplus < 201703L*/
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include <type_traits>
|
||||
|
||||
#include "def.h"
|
||||
|
||||
#include "platform/detail.h"
|
||||
#include "circ/elem_def.h"
|
||||
|
||||
namespace ipc {
|
||||
@ -363,7 +363,7 @@ struct prod_cons_impl<wr<relat::multi , relat::multi, trans::broadcast>> {
|
||||
return true;
|
||||
case 1:
|
||||
el->f_ct_.store(cur + N - 1, std::memory_order_release);
|
||||
[[fallthrough]];
|
||||
IPC_FALLTHROUGH_;
|
||||
default:
|
||||
if (el->rc_.compare_exchange_weak(
|
||||
cur_rc, cur_rc + rc_incr - 1, std::memory_order_release)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user