From 5d8db1548b6ff726bfa6c8c58bdcdb5c423a6365 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Sat, 26 Oct 2024 15:42:54 +0200 Subject: [PATCH] ell: only include 'ell/ell.h' header (#309) 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(-) diff --git a/lib/hash_sockaddr.c b/lib/hash_sockaddr.c index e56a922f..8001f5c0 100644 --- 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 diff --git a/lib/id_manager.c b/lib/id_manager.c index 62e7f540..1843fafe 100644 --- a/lib/id_manager.c +++ b/lib/id_manager.c @@ -19,14 +19,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#include -#include -#include -#include -#include -#pragma GCC diagnostic pop +#include #include #include diff --git a/lib/listener_manager.c b/lib/listener_manager.c index 0db43d70..c5155a25 100644 --- 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 diff --git a/lib/network_monitor.c b/lib/network_monitor.c index b521e3e6..225b2de3 100644 --- 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 diff --git a/lib/path_manager.c b/lib/path_manager.c index b2413d3b..2063055c 100644 --- 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 diff --git a/lib/plugin.c b/lib/plugin.c index f666b9c6..03e1b18e 100644 --- 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 diff --git a/lib/sockaddr.c b/lib/sockaddr.c index 64722236..9f7b5aba 100644 --- 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 diff --git a/plugins/path_managers/addr_adv.c b/plugins/path_managers/addr_adv.c index ff6fad29..cfb66d4e 100644 --- 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 diff --git a/plugins/path_managers/sspi.c b/plugins/path_managers/sspi.c index 729549ab..a9a600ba 100644 --- 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 diff --git a/src/commands.c b/src/commands.c index ca303535..905b5eb3 100644 --- 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" diff --git a/src/configuration.c b/src/configuration.c index 28f9e40d..e78c8b59 100644 --- a/src/configuration.c +++ b/src/configuration.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 diff --git a/src/mptcpd.c b/src/mptcpd.c index 6b671f38..2f199315 100644 --- 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 diff --git a/src/netlink_pm.c b/src/netlink_pm.c index 71cd4022..503cf391 100644 --- 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" diff --git a/src/netlink_pm_mptcp_org.c b/src/netlink_pm_mptcp_org.c index ff9b0df0..06660f4a 100644 --- 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" diff --git a/src/netlink_pm_upstream.c b/src/netlink_pm_upstream.c index 2f718c22..4f43fae9 100644 --- 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 diff --git a/src/path_manager.c b/src/path_manager.c index d268ff15..5588fb70 100644 --- a/src/path_manager.c +++ b/src/path_manager.c @@ -20,14 +20,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 diff --git a/tests/plugins/noop/noop.c b/tests/plugins/noop/noop.c index 09b548d9..637d80c3 100644 --- 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 diff --git a/tests/plugins/priority/one.c b/tests/plugins/priority/one.c index 171f4ffa..8ac7e7a3 100644 --- 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 diff --git a/tests/plugins/priority/two.c b/tests/plugins/priority/two.c index d4b15d64..c97b1845 100644 --- 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 diff --git a/tests/plugins/security/four.c b/tests/plugins/security/four.c index 298c49dc..e10f74b2 100644 --- 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 diff --git a/tests/plugins/security/three.c b/tests/plugins/security/three.c index a5a43ba0..a285dab9 100644 --- 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 diff --git a/tests/test-addr-info.c b/tests/test-addr-info.c index f54eff8c..c3b8e901 100644 --- 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 diff --git a/tests/test-commands.c b/tests/test-commands.c index 71ab6282..4fc97968 100644 --- 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 // ----------------- diff --git a/tests/test-configuration.c b/tests/test-configuration.c index c2cef203..5623a3f0 100644 --- 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! diff --git a/tests/test-id-manager.c b/tests/test-id-manager.c index c81a3eea..1f6bdb1c 100644 --- a/tests/test-id-manager.c +++ b/tests/test-id-manager.c @@ -9,8 +9,7 @@ #include -#include -#include +#include #include #include diff --git a/tests/test-listener-manager.c b/tests/test-listener-manager.c index 654c4f5e..6cce774a 100644 --- 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 diff --git a/tests/test-murmur-hash.c b/tests/test-murmur-hash.c index 03479f45..addd77c5 100644 --- 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 diff --git a/tests/test-network-monitor.c b/tests/test-network-monitor.c index 60d87053..4bcff310 100644 --- 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 diff --git a/tests/test-path-manager.c b/tests/test-path-manager.c index 558a8b20..b23094f3 100644 --- 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" diff --git a/tests/test-plugin.c b/tests/test-plugin.c index 15fec1b5..3e51eaae 100644 --- a/tests/test-plugin.c +++ b/tests/test-plugin.c @@ -14,8 +14,7 @@ #include #include -#include -#include +#include #include #include diff --git a/tests/test-sockaddr.c b/tests/test-sockaddr.c index fc3ba46c..13fad154 100644 --- 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