pespin submitted this change.

View Change

Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved laforge: Looks good to me, but someone else must approve
core/stats_tcp: declare struct osmo_fd in header

include/osmocom/core/stats_tcp.h names struct osmo_fd in its prototypes
without declaring it and without including select.h. A translation unit
that includes stats_tcp.h on its own therefore gives the type function
prototype scope, and a later definition of one of those functions in the
same unit has a different, incompatible type. Clang reports -Wvisibility
and then rejects the definitions outright.

Every in-tree caller happens to include select.h first, which is why this
never showed up. It surfaced while writing a Darwin implementation of the
same functions, where stats_tcp.h is the only include.

Add the forward declaration to the header rather than requiring each
includer to get the order right. A forward declaration is enough: the
prototypes take a pointer. Nothing here is platform specific and there is
no runtime impact.

Change-Id: I2f31f45317e6a28f47470ba6a5e4a31e4704e831
---
M include/osmocom/core/stats_tcp.h
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/osmocom/core/stats_tcp.h b/include/osmocom/core/stats_tcp.h
index 9bc7111..d7d7791 100644
--- a/include/osmocom/core/stats_tcp.h
+++ b/include/osmocom/core/stats_tcp.h
@@ -1,5 +1,7 @@
#pragma once

+struct osmo_fd;
+
#define TCP_STATS_DEFAULT_INTERVAL 0 /* secs */
#define TCP_STATS_DEFAULT_BATCH_SIZE 5 /* sockets per interval */


To view, visit change 43572. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2f31f45317e6a28f47470ba6a5e4a31e4704e831
Gerrit-Change-Number: 43572
Gerrit-PatchSet: 3
Gerrit-Owner: andrei.gosman@gmail.com <andrei.gosman@gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>