Commit Graph

3 Commits

Author SHA1 Message Date
Thomas Haller
7abac1b89a shared: move redefining G_VARIANT_TYPE() to "nm-glib-aux/nm-default-glib.h"
We redefine G_VARIANT_TYPE() because we don't want to pay a run time
check for what should be a simple cast.

But this is strictly tied to glib, and it must only be done after glib.h
was included. Move it to the right place.
2021-02-09 12:38:19 +01:00
Thomas Haller
fa3ac35031 shared: remove unused "shared/nm-default.h" 2021-02-09 12:38:18 +01:00
Thomas Haller
dbdac49b81 all: add "nm-std-aux/nm-default-std.h" as replacement for "nm-default.h"
autotools projects commonly should include "config.h" as first header.
Also, commonly we need more headers, like glib.h or our nm_auto macros.
Hence, almost all our sources should as first include "nm-default.h".

However, as we build different parts, "nm-default.h" gets controlled
by the NETWORKMANAGER_COMPILATION define which autotools/meson needs
to specify in the build options.

That is confusing.

One advantage of that was, that theoretically the same sources can
be built twice, with different behavior. However, we should avoid doing
that altogether and build static libraries (once) that we link multiple
times.

Another advantage was that if NETWORKMANAGER_COMPILATION is for example
set to build a DAEMON source, there is a check that we don't include
private headers from libnm-core. However, that should be better solved
by not having public, internal and private headers in the same
directory.

Instead, introduce different "nm-default-*.h" headers that don't require
special defines and behave in a consistent way. This way, we require
fewer CFLAGS and it's immediately clear by looking at the source alone
which headers are included. Also, you will be easier see when a wrong
nm-default-*.h header gets included.

Introduce the first replacement. The others will follow.
2021-02-09 12:38:17 +01:00