Skip to content

Commit

Permalink
ell: only include 'ell/ell.h' header (#309)
Browse files Browse the repository at this point in the history
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 <ell/ell.h>. 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) <[email protected]>
  • Loading branch information
matttbe authored Oct 26, 2024
1 parent 3702487 commit 5d8db15
Show file tree
Hide file tree
Showing 31 changed files with 31 additions and 183 deletions.
6 changes: 1 addition & 5 deletions lib/hash_sockaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
#include <string.h>
#include <netinet/in.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h>
#pragma GCC diagnostic pop

#include <ell/ell.h>

#include <mptcpd/private/murmur_hash.h>

Expand Down
9 changes: 1 addition & 8 deletions lib/id_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@
#include <sys/socket.h>
#include <netinet/in.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/hashmap.h>
#include <ell/uintset.h>
#include <ell/util.h>
#include <ell/log.h>
#include <ell/random.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/private/murmur_hash.h>
#include <mptcpd/private/id_manager.h>
Expand Down
8 changes: 1 addition & 7 deletions lib/listener_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
#include <errno.h>
#include <string.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/hashmap.h>
#include <ell/util.h>
#include <ell/log.h>
#include <ell/random.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/private/murmur_hash.h>
#include <mptcpd/private/listener_manager.h>
Expand Down
10 changes: 1 addition & 9 deletions lib/network_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@
#include <net/if.h> // For standard network interface flags.
#include <netinet/in.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/netlink.h>
#include <ell/log.h>
#include <ell/util.h>
#include <ell/queue.h>
#include <ell/timeout.h>
#include <ell/rtnl.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/private/path_manager.h>
#include <mptcpd/private/sockaddr.h>
Expand Down
8 changes: 1 addition & 7 deletions lib/path_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@

#include <netinet/in.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/genl.h>
#include <ell/queue.h>
#include <ell/util.h> // For L_STRINGIFY needed by l_error().
#include <ell/log.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/path_manager.h>
#include <mptcpd/private/path_manager.h>
Expand Down
8 changes: 1 addition & 7 deletions lib/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@
#include <unistd.h>
#include <assert.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/queue.h>
#include <ell/hashmap.h>
#include <ell/util.h>
#include <ell/log.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

/**
* @todo Remove this preprocessor symbol definition once support for
Expand Down
5 changes: 1 addition & 4 deletions lib/sockaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
#include <sys/socket.h>
#include <netinet/in.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/private/sockaddr.h>

Expand Down
7 changes: 1 addition & 6 deletions plugins/path_managers/addr_adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@

#include <errno.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h> // For L_STRINGIFY needed by ELL log macros.
#include <ell/log.h>
#pragma GCC diagnostic pop

#include <ell/ell.h>

#include <mptcpd/private/path_manager.h>
#include <mptcpd/private/configuration.h>
Expand Down
7 changes: 1 addition & 6 deletions plugins/path_managers/sspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@

#include <netinet/in.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h> // For L_STRINGIFY needed by l_error().
#include <ell/log.h>
#include <ell/queue.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/network_monitor.h>
#include <mptcpd/path_manager.h>
Expand Down
7 changes: 1 addition & 6 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@
#include <string.h>
#include <arpa/inet.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/genl.h>
#include <ell/util.h> // For L_STRINGIFY needed by l_error(), etc.
#include <ell/log.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include "commands.h"

Expand Down
9 changes: 1 addition & 8 deletions src/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@
#include <sys/stat.h>
#include <unistd.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/log.h>
#include <ell/util.h>
#include <ell/settings.h>
#include <ell/queue.h>
#include <ell/string.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/types.h>

Expand Down
7 changes: 1 addition & 6 deletions src/mptcpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
#include <signal.h>
#include <assert.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h> // For L_STRINGIFY needed by l_error().
#include <ell/log.h>
#include <ell/main.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/private/configuration.h>

Expand Down
6 changes: 1 addition & 5 deletions src/netlink_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
#include <stdbool.h>
#include <stdio.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/log.h>
#include <ell/util.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include "netlink_pm.h"

Expand Down
4 changes: 1 addition & 3 deletions src/netlink_pm_mptcp_org.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
#include <errno.h>
#include <stdio.h>

#include <ell/genl.h>
#include <ell/util.h> // For L_STRINGIFY needed by l_error(), etc.
#include <ell/log.h>
#include <ell/ell.h>

#include "commands.h"
#include "netlink_pm.h"
Expand Down
7 changes: 1 addition & 6 deletions src/netlink_pm_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
#include <errno.h>
#include <sys/socket.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/genl.h>
#include <ell/util.h> // For L_STRINGIFY needed by l_error(), etc.
#include <ell/log.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/types.h>
#include <mptcpd/listener_manager.h>
Expand Down
9 changes: 1 addition & 8 deletions src/path_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@
#include <arpa/inet.h> // For inet_ntop().
#include <netinet/in.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/genl.h>
#include <ell/log.h>
#include <ell/queue.h>
#include <ell/timeout.h>
#include <ell/util.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/path_manager.h>
#include <mptcpd/private/path_manager.h>
Expand Down
6 changes: 1 addition & 5 deletions tests/plugins/noop/noop.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
* Copyright (c) 2019-2022, Intel Corporation
*/

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h> // For L_STRINGIFY needed by l_error().
#include <ell/log.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#ifdef HAVE_CONFIG_H
# include <mptcpd/private/config.h>
Expand Down
6 changes: 1 addition & 5 deletions tests/plugins/priority/one.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
* Copyright (c) 2019-2022, Intel Corporation
*/

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h> // For L_STRINGIFY needed by l_error().
#include <ell/log.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#ifdef HAVE_CONFIG_H
# include <mptcpd/private/config.h>
Expand Down
6 changes: 1 addition & 5 deletions tests/plugins/priority/two.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
* Copyright (c) 2019-2022, Intel Corporation
*/

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h> // For L_STRINGIFY needed by l_error().
#include <ell/log.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#ifdef HAVE_CONFIG_H
# include <mptcpd/private/config.h>
Expand Down
6 changes: 1 addition & 5 deletions tests/plugins/security/four.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
* Copyright (c) 2019-2022, Intel Corporation
*/

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h> // For L_STRINGIFY needed by l_error().
#include <ell/log.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#ifdef HAVE_CONFIG_H
# include <mptcpd/private/config.h>
Expand Down
6 changes: 1 addition & 5 deletions tests/plugins/security/three.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
* Copyright (c) 2019-2022, Intel Corporation
*/

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h> // For L_STRINGIFY needed by l_error().
#include <ell/log.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#ifdef HAVE_CONFIG_H
# include <mptcpd/private/config.h>
Expand Down
3 changes: 1 addition & 2 deletions tests/test-addr-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
*/

#include <arpa/inet.h> // htonl() and htons()
#include <ell/log.h>
#include <ell/test.h>
#include <ell/ell.h>

#include <mptcpd/addr_info.h>
#include <mptcpd/private/addr_info.h>
Expand Down
11 changes: 1 addition & 10 deletions tests/test-commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@
#include <arpa/inet.h>
#include <net/if.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/main.h>
#include <ell/idle.h>
#include <ell/util.h> // Needed by <ell/log.h>
#include <ell/log.h>
#include <ell/netlink.h>
#include <ell/rtnl.h>
#include <ell/test.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

// Internal Headers
// -----------------
Expand Down
8 changes: 1 addition & 7 deletions tests/test-configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
* Copyright (c) 2019, 2021, Intel Corporation
*/

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/main.h>
#include <ell/util.h> // Needed by <ell/log.h>
#include <ell/log.h>
#include <ell/test.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/private/configuration.h> // INTERNAL!

Expand Down
3 changes: 1 addition & 2 deletions tests/test-id-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include <stddef.h>

#include <ell/log.h>
#include <ell/test.h>
#include <ell/ell.h>

#include <mptcpd/private/id_manager.h>
#include <mptcpd/id_manager.h>
Expand Down
7 changes: 1 addition & 6 deletions tests/test-listener-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
#include <netinet/in.h>
#include <sys/un.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h>
#include <ell/log.h>
#include <ell/test.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/private/listener_manager.h>
#include <mptcpd/listener_manager.h>
Expand Down
7 changes: 1 addition & 6 deletions tests/test-murmur-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@
#include <stdint.h>
#include <stddef.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/util.h> // Needed by <ell/log.h>.
#include <ell/log.h>
#include <ell/test.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/private/murmur_hash.h>

Expand Down
9 changes: 1 addition & 8 deletions tests/test-network-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@
#include <netinet/in.h> // For INET_ADDRSTRLEN and INET6_ADDRSTRLEN.
#include <net/if.h> // For standard network interface flags.

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <ell/main.h>
#include <ell/idle.h>
#include <ell/util.h> // Needed by <ell/log.h>
#include <ell/log.h>
#include <ell/queue.h>
#pragma GCC diagnostic pop
#include <ell/ell.h>

#include <mptcpd/private/network_monitor.h>
#include <mptcpd/network_monitor.h>
Expand Down
Loading

0 comments on commit 5d8db15

Please sign in to comment.