mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
Merge bitcoin/bitcoin#31419: test: fix MIN macro redefinition
00c1dbd26d
test: fix MIN macro-redefinition (0xb10c) Pull request description: Renames the `MIN` macro to `_TRACEPOINT_TEST_MIN`. From #31418: ``` stderr: /virtual/main.c:70:9: warning: 'MIN' macro redefined [-Wmacro-redefined] 70 | #define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; }) | ^ include/linux/minmax.h:329:9: note: previous definition is here 329 | #define MIN(a,b) __cmp(min,a,b) | ^ 1 warning generated. ``` fixes: https://github.com/bitcoin/bitcoin/issues/31418 ACKs for top commit: maflcko: review ACK00c1dbd26d
Tree-SHA512: 1d91ed8b3c0b0410d42a11004286359546c17613c3ff03dd51c26896ee050e9280fff69fa2eaa6e6085f9b611663bcacedec80997a6c5e37874a79ba86bfa507
This commit is contained in:
commit
893ccea7e4
1 changed files with 4 additions and 3 deletions
|
@ -40,7 +40,8 @@ net_tracepoints_program = """
|
|||
MAX_MSG_TYPE_LENGTH,
|
||||
MAX_MSG_DATA_LENGTH
|
||||
) + """
|
||||
#define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
|
||||
// A min() macro. Prefixed with _TRACEPOINT_TEST to avoid collision with other MIN macros.
|
||||
#define _TRACEPOINT_TEST_MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
|
||||
|
||||
struct p2p_message
|
||||
{
|
||||
|
@ -60,7 +61,7 @@ int trace_inbound_message(struct pt_regs *ctx) {
|
|||
bpf_usdt_readarg_p(3, ctx, &msg.peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH);
|
||||
bpf_usdt_readarg_p(4, ctx, &msg.msg_type, MAX_MSG_TYPE_LENGTH);
|
||||
bpf_usdt_readarg(5, ctx, &msg.msg_size);
|
||||
bpf_usdt_readarg_p(6, ctx, &msg.msg, MIN(msg.msg_size, MAX_MSG_DATA_LENGTH));
|
||||
bpf_usdt_readarg_p(6, ctx, &msg.msg, _TRACEPOINT_TEST_MIN(msg.msg_size, MAX_MSG_DATA_LENGTH));
|
||||
inbound_messages.perf_submit(ctx, &msg, sizeof(msg));
|
||||
return 0;
|
||||
}
|
||||
|
@ -73,7 +74,7 @@ int trace_outbound_message(struct pt_regs *ctx) {
|
|||
bpf_usdt_readarg_p(3, ctx, &msg.peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH);
|
||||
bpf_usdt_readarg_p(4, ctx, &msg.msg_type, MAX_MSG_TYPE_LENGTH);
|
||||
bpf_usdt_readarg(5, ctx, &msg.msg_size);
|
||||
bpf_usdt_readarg_p(6, ctx, &msg.msg, MIN(msg.msg_size, MAX_MSG_DATA_LENGTH));
|
||||
bpf_usdt_readarg_p(6, ctx, &msg.msg, _TRACEPOINT_TEST_MIN(msg.msg_size, MAX_MSG_DATA_LENGTH));
|
||||
outbound_messages.perf_submit(ctx, &msg, sizeof(msg));
|
||||
return 0;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue