From b1239f7518de8d5d59ac51e3b9e30f45c7286c80 Mon Sep 17 00:00:00 2001 From: "Matthieu Baerts (NGI0)" Date: Sat, 26 Oct 2024 12:41:31 +0200 Subject: [PATCH] ell: only include 'ell/ell.h' header When looking at the code of other projects using ELL (IWD, BlueZ, Ofono), it looks like only 'ell.h' should be included, not individual header files from the 'ell' header directory. That looks like the way to go, because when looking at ell/genl.h, it uses functions declared in ell/netlink.h, without including this file before. This causes issues when compiling the code using libell-dev installed on the system: libtool: compile: gcc (...) -c path_manager.c (...) In file included from path_manager.c:21: /usr/include/ell/genl.h: In function 'l_genl_attr_next': /usr/include/ell/genl.h:98:16: error: implicit declaration of function 'l_netlink_attr_next'; did you mean 'l_genl_attr_next'? [-Wimplicit-function-declaration] 98 | return l_netlink_attr_next((struct l_netlink_attr *) attr, | ^~~~~~~~~~~~~~~~~~~ | l_genl_attr_next /usr/include/ell/genl.h: In function 'l_genl_attr_recurse': /usr/include/ell/genl.h:105:16: error: implicit declaration of function 'l_netlink_attr_recurse'; did you mean 'l_genl_attr_recurse'? [-Wimplicit-function-declaration] 105 | return l_netlink_attr_recurse((struct l_netlink_attr *) attr, | ^~~~~~~~~~~~~~~~~~~~~~ | l_genl_attr_recurse make[2]: *** [Makefile:597: libmptcpd_la-path_manager.lo] Error 1 All .c files including ELL header files have been modified to include only . The .cpp file in the tests has not been modified, because it looks like that causes some issues. For the same reason, include/mptcpd/private/plugin.h file has not been modified as well. Closes: #302 Signed-off-by: Matthieu Baerts (NGI0) --- lib/hash_sockaddr.c | 6 +----- lib/id_manager.c | 9 +-------- lib/listener_manager.c | 8 +------- lib/network_monitor.c | 10 +--------- lib/path_manager.c | 8 +------- lib/plugin.c | 8 +------- lib/sockaddr.c | 5 +---- plugins/path_managers/addr_adv.c | 7 +------ plugins/path_managers/sspi.c | 7 +------ src/commands.c | 7 +------ src/configuration.c | 9 +-------- src/mptcpd.c | 7 +------ src/netlink_pm.c | 6 +----- src/netlink_pm_mptcp_org.c | 4 +--- src/netlink_pm_upstream.c | 7 +------ src/path_manager.c | 9 +-------- tests/plugins/noop/noop.c | 6 +----- tests/plugins/priority/one.c | 6 +----- tests/plugins/priority/two.c | 6 +----- tests/plugins/security/four.c | 6 +----- tests/plugins/security/three.c | 6 +----- tests/test-addr-info.c | 3 +-- tests/test-commands.c | 11 +---------- tests/test-configuration.c | 8 +------- tests/test-id-manager.c | 3 +-- tests/test-listener-manager.c | 7 +------ tests/test-murmur-hash.c | 7 +------ tests/test-network-monitor.c | 9 +-------- tests/test-path-manager.c | 9 +-------- tests/test-plugin.c | 3 +-- tests/test-sockaddr.c | 7 +------ 31 files changed, 31 insertions(+), 183 deletions(-) --- a/lib/hash_sockaddr.c +++ b/lib/hash_sockaddr.c @@ -16,11 +16,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#pragma GCC diagnostic pop - +#include #include --- a/lib/id_manager.c +++ b/lib/id_manager.c @@ -20,14 +20,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#include -#include -#pragma GCC diagnostic pop +#include #include #include --- a/lib/listener_manager.c +++ b/lib/listener_manager.c @@ -19,13 +19,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#include -#pragma GCC diagnostic pop +#include #include #include --- a/lib/network_monitor.c +++ b/lib/network_monitor.c @@ -23,15 +23,7 @@ #include // For standard network interface flags. #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#include -#include -#include -#pragma GCC diagnostic pop +#include #include #include --- a/lib/path_manager.c +++ b/lib/path_manager.c @@ -16,13 +16,7 @@ #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include // For L_STRINGIFY needed by l_error(). -#include -#pragma GCC diagnostic pop +#include #include #include --- a/lib/plugin.c +++ b/lib/plugin.c @@ -20,13 +20,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#include -#pragma GCC diagnostic pop +#include /** * @todo Remove this preprocessor symbol definition once support for --- a/lib/sockaddr.c +++ b/lib/sockaddr.c @@ -11,10 +11,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#pragma GCC diagnostic pop +#include #include --- a/plugins/path_managers/addr_adv.c +++ b/plugins/path_managers/addr_adv.c @@ -13,12 +13,7 @@ #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include // For L_STRINGIFY needed by ELL log macros. -#include -#pragma GCC diagnostic pop - +#include #include #include --- a/plugins/path_managers/sspi.c +++ b/plugins/path_managers/sspi.c @@ -17,12 +17,7 @@ #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include // For L_STRINGIFY needed by l_error(). -#include -#include -#pragma GCC diagnostic pop +#include #include #include --- a/src/commands.c +++ b/src/commands.c @@ -16,12 +16,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include // For L_STRINGIFY needed by l_error(), etc. -#include -#pragma GCC diagnostic pop +#include #include "commands.h" --- a/src/configuration.c +++ b/src/configuration.c @@ -21,14 +21,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#include -#include -#pragma GCC diagnostic pop +#include #include --- a/src/mptcpd.c +++ b/src/mptcpd.c @@ -15,12 +15,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include // For L_STRINGIFY needed by l_error(). -#include -#include -#pragma GCC diagnostic pop +#include #include --- a/src/netlink_pm.c +++ b/src/netlink_pm.c @@ -10,11 +10,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#pragma GCC diagnostic pop +#include #include "netlink_pm.h" --- a/src/netlink_pm_mptcp_org.c +++ b/src/netlink_pm_mptcp_org.c @@ -15,9 +15,7 @@ #include #include -#include -#include // For L_STRINGIFY needed by l_error(), etc. -#include +#include #include "commands.h" #include "netlink_pm.h" --- a/src/netlink_pm_upstream.c +++ b/src/netlink_pm_upstream.c @@ -15,12 +15,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include // For L_STRINGIFY needed by l_error(), etc. -#include -#pragma GCC diagnostic pop +#include #include #include --- a/src/path_manager.c +++ b/src/path_manager.c @@ -21,14 +21,7 @@ #include // For inet_ntop(). #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#include -#include -#pragma GCC diagnostic pop +#include #include #include --- a/tests/plugins/noop/noop.c +++ b/tests/plugins/noop/noop.c @@ -7,11 +7,7 @@ * Copyright (c) 2019-2022, Intel Corporation */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include // For L_STRINGIFY needed by l_error(). -#include -#pragma GCC diagnostic pop +#include #ifdef HAVE_CONFIG_H # include --- a/tests/plugins/priority/one.c +++ b/tests/plugins/priority/one.c @@ -7,11 +7,7 @@ * Copyright (c) 2019-2022, Intel Corporation */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include // For L_STRINGIFY needed by l_error(). -#include -#pragma GCC diagnostic pop +#include #ifdef HAVE_CONFIG_H # include --- a/tests/plugins/priority/two.c +++ b/tests/plugins/priority/two.c @@ -7,11 +7,7 @@ * Copyright (c) 2019-2022, Intel Corporation */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include // For L_STRINGIFY needed by l_error(). -#include -#pragma GCC diagnostic pop +#include #ifdef HAVE_CONFIG_H # include --- a/tests/plugins/security/four.c +++ b/tests/plugins/security/four.c @@ -7,11 +7,7 @@ * Copyright (c) 2019-2022, Intel Corporation */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include // For L_STRINGIFY needed by l_error(). -#include -#pragma GCC diagnostic pop +#include #ifdef HAVE_CONFIG_H # include --- a/tests/plugins/security/three.c +++ b/tests/plugins/security/three.c @@ -7,11 +7,7 @@ * Copyright (c) 2019-2022, Intel Corporation */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include // For L_STRINGIFY needed by l_error(). -#include -#pragma GCC diagnostic pop +#include #ifdef HAVE_CONFIG_H # include --- a/tests/test-addr-info.c +++ b/tests/test-addr-info.c @@ -8,8 +8,7 @@ */ #include // htonl() and htons() -#include -#include +#include #include #include --- a/tests/test-commands.c +++ b/tests/test-commands.c @@ -14,16 +14,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include // Needed by -#include -#include -#include -#include -#pragma GCC diagnostic pop +#include // Internal Headers // ----------------- --- a/tests/test-configuration.c +++ b/tests/test-configuration.c @@ -7,13 +7,7 @@ * Copyright (c) 2019, 2021, Intel Corporation */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include // Needed by -#include -#include -#pragma GCC diagnostic pop +#include #include // INTERNAL! --- a/tests/test-id-manager.c +++ b/tests/test-id-manager.c @@ -9,8 +9,7 @@ #include -#include -#include +#include #include #include --- a/tests/test-listener-manager.c +++ b/tests/test-listener-manager.c @@ -11,12 +11,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#pragma GCC diagnostic pop +#include #include #include --- a/tests/test-murmur-hash.c +++ b/tests/test-murmur-hash.c @@ -10,12 +10,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include // Needed by . -#include -#include -#pragma GCC diagnostic pop +#include #include --- a/tests/test-network-monitor.c +++ b/tests/test-network-monitor.c @@ -15,14 +15,7 @@ #include // For INET_ADDRSTRLEN and INET6_ADDRSTRLEN. #include // For standard network interface flags. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include // Needed by -#include -#include -#pragma GCC diagnostic pop +#include #include #include --- a/tests/test-path-manager.c +++ b/tests/test-path-manager.c @@ -9,14 +9,7 @@ #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#include // Needed by -#include -#pragma GCC diagnostic pop +#include #include "test-util.h" --- a/tests/test-plugin.c +++ b/tests/test-plugin.c @@ -14,8 +14,7 @@ #include #include -#include -#include +#include #include #include --- a/tests/test-sockaddr.c +++ b/tests/test-sockaddr.c @@ -9,12 +9,7 @@ #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#pragma GCC diagnostic pop +#include #include