Commit graph

10183 commits

Author SHA1 Message Date
Dan Winship b4ae6eaec9 libnm: remove Since tags and NM_AVAILABLE_IN_* attributes
Everything currently in libnm has always been there.
2014-08-01 14:34:06 -04:00
Dan Winship 054c12ea30 libnm: remove all deprecated functions and types
Remove deprecated functions and enum types.

For now, deprecated properties are still around, because removing them
would cause warnings when talking to older implementations.
2014-08-01 14:34:05 -04:00
Dan Winship b9fef07fff libnm-util: remove NM_UTIL_PRIVATE_CALL, NMSettingIP4Config:address-labels
Since libnm-util is no longer used from within NM, its copy of
NM_UTIL_PRIVATE_CALL is now useless, and the internal-only
NMSettingIP4Config:address-labels property is no longer needed.
2014-08-01 14:34:05 -04:00
Dan Winship 058915a9ae contrib: update NetworkManager.spec for libnm
Add libnm to NetworkManager.spec, and try to update the descriptions
of NetworkManager-devel, NetworkManager-glib, and
NetworkManager-glib-devel to make sense in the libnm world...
2014-08-01 14:34:05 -04:00
Dan Winship a7c4d53d03 all: port everything to libnm
Since the API has not changed at this point, this is mostly just a
matter of updating Makefiles, and changing references to the library
name in comments.

NetworkManager cannot link to libnm due to the duplicated type/symbol
names. So it links to libnm-core.la directly, which means that
NetworkManager gets a separate copy of that code from libnm.so.
Everything else links to libnm.
2014-08-01 14:34:05 -04:00
Dan Winship c5daa4c4df docs: add libnm documentation
Add docs infrastructure
2014-08-01 14:34:05 -04:00
Dan Winship eedcf185a7 libnm: add libnm/libnm-core (part 2)
This fixes up the code from the previous "clean" import, and adds
build infrastructure.

[There are two slightly orthogonal sets of changes in this patch.
First, the files added in the previous commit were modified as followed:

  # Replace internal references to "libnm-util" and "libnm-glib" with "libnm"
  perl -pi -e 's/libnm-(util|glib)/libnm/;' libnm-core/*.[ch] libnm-core/tests/*.[ch] libnm/*.[ch] libnm/tests/*.[ch]

  # Fix includes of the enum-types files
  perl -pi -e 's/nm-utils-enum-types/nm-core-enum-types/;' libnm-core/*.[ch] libnm-core/tests/*.[ch] libnm/*.[ch] libnm/tests/*.[ch]
  perl -pi -e 's/nm-glib-enum-types/nm-enum-types/;' libnm/*.[ch] libnm/tests/*.[ch]

  # Fix some python example code
  perl -pi -e 's/import NMClient/import NM/;' -e 's/NMClient.Client\(\)/NM.Client()/;' libnm/nm-client.c

Then, the build infrastructure was added (without further modifying
any existing files in libnm-core or libnm.)

Note: to regenerate libnm.ver after rebase:
  (head -2 libnm-util/libnm-util.ver; (grep -h '\s'nm_ libnm-util/libnm-util.ver libnm-glib/libnm-glib.ver | env LANG=C sort); tail -3 libnm-util/libnm-util.ver) > libnm/libnm.ver
]
2014-08-01 14:34:04 -04:00
Dan Winship d595f7843e libnm: add libnm/libnm-core (part 1)
This commit begins creating the new "libnm", which will replace
libnm-util and libnm-glib.

The main reason for the libnm-util/libnm-glib split is that the daemon
needs to link to libnm-util (to get NMSettings, NMConnection, etc),
but can't link to libnm-glib (because it uses many of the same type
names as the NetworkManager daemon. eg, NMDevice). So the daemon links
to only libnm-util, but basically all clients link to both.

With libnm, there will be only a single client-visible library, and
NetworkManager will internally link against a private "libnm-core"
containing the parts that used to be in libnm-util.

(The "libnm-core" parts still need to be in their own directory so
that the daemon can see those header files without also seeing the
ones in libnm/ that conflict with its own headers.)

[This commit just copies the source code from libnm-util/ to
libnm-core/, and libnm-glib/ to libnm/:

  mkdir -p libnm-core/tests/
  mkdir -p libnm/tests/
  cp libnm-util/*.[ch] libnm-util/nm-version.h.in libnm-core/
  rm -f libnm-core/nm-version.h libnm-core/nm-setting-template.[ch] libnm-core/nm-utils-enum-types.[ch]
  cp libnm-util/tests/*.[ch] libnm-core/tests/
  cp libnm-glib/*.[ch] libnm/
  rm -f libnm/libnm_glib.[ch] libnm/libnm-glib-test.c libnm/nm-glib-enum-types.[ch]
  cp libnm-glib/tests/*.[ch] libnm/tests/

]
2014-08-01 14:34:04 -04:00
Thomas Haller c123a24dc4 Merge branch 'th/bgo733212_logging'
https://bugzilla.gnome.org/show_bug.cgi?id=733212

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:11:02 +02:00
Thomas Haller be55d774eb core: refactoring logging in NMDevice to use new _LOG() macros
Make use of the previously added _LOG() macros in nm-device.c.
This reduces code, but also ensures printing the same prefix for
every logline produced *for* a device instance.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:09:47 +02:00
Thomas Haller 7de955c0d2 core/trivial: change variable name for self pointer in NMDevice to @self
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:09:23 +02:00
Thomas Haller 75d8a805e7 core: add logging macro _LOG() and _LOGD() to nm-device.c
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller ca7329f7d4 core/logging: add new logging macro nm_log_obj()
Add new macro nm_log_obj() to prefix the log line with a pointer value
as identifier. This macro can be used to give each logging line a common
prefix with defined format. It is mainly intended to print a message
"for" an object, for example inside a method function.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller 573576bedd core/logging: define nm_log() to check for nm_logging_enabled() first
Change the definition of nm_log() to first check whether logging is
enabled. This has the benefit, that the logging arguments don't have
to be evaluated if logging is disabled.

With this change, you must ensure, that calling any logging function
is side-effect-free. For example:
    nm_log_debug ("This is a bug %s, %d", has_side_effect (), ++i);
would be a bug, because the logging arguments get only evaluated
depending on the logging setup.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller 7509d4f80f core/logging: change order or domain/level arguments for nm_log()
Now the order of arguments corresponds to nm_logging_enabled().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller 60cf1b8fcd core/logging: define logging macros based on nm_log()
Base the definition of nm_log_*() macros on the nm_log() macro,
instead of directly on the _nm_log() function.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller 19d4bda69a core/logging: ensure that logging is always initialized
Ensure that nm_logging_setup() was called for all functions
where it actually makes a difference.

This is especially important for nm_logging_enabled(),
so that the behavior of the following is identical:

    nm_log_info(LOGD_CORE, "hello world");

and
    if (nm_logging_enabled (LOGL_INFO, LOGD_CORE))
        nm_log_info(LOGD_CORE, "hello world");

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller 453d1aa71d core/logging: return static string from nm_logging_domains_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller 85b972e9b8 core/logging: return static string from nm_logging_level_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller ff6946a193 core/logging: align logging after "<LEVEL>" prefix
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller f6882496e3 core/logging: add assert to nm_logging_setup() to check input arguments
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller a69037431c core/logging: remove unused #undef from header file
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller 65c43a680e utils: add _NM_UTILS_MACRO_FIRST and _NM_UTILS_MACRO_REST macros
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:24 +02:00
Thomas Haller 9f832d99be core: add project-wide header file nm-utils-internal.h
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:24 +02:00
Thomas Haller 8720c8e136 core: no need to clone ifname in nm_device_generate_connection()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:24 +02:00
Dan Winship bd37e0ea58 Misc libnm-glib/tests/ fixes (bgo #734121) 2014-08-01 12:12:48 -04:00
Dan Winship 48ad586209 libnm-glib: add tests of NMClient:manager-running and NMRemoteSettings:service-running
Test that the code to track whether NetworkManager is running works
correctly.
2014-08-01 12:12:42 -04:00
Dan Winship fe264a2d01 libnm-glib: fix a crash when using multiple NMClients
NMObjectCache was assuming there would never be more than one object
with the same path, but since NMClient is an NMObject, it was getting
cached too, so if you created two clients and then unreffed one of
them, it's possible the wrong one could get left in the cache, causing
a crash the next time the other one called nm_object_cache_clear().

Fix this by only adding NMObjects to the cache in the codepaths where
we also check to see if the object was already in the cache.

(This also means we can remove the "except" argument to
nm_object_cache_clear(), since the NMClient won't be cached any more.)
2014-08-01 12:12:42 -04:00
Dan Winship 08b91199fb libnm-glib: make test-networkmanager-service.py automatically exit with its parent
test-nm-client.c and test-remote-settings-client.c were using their
own assertion macros so they could kill the test service on assertion
failure. Except that some new code didn't get the memo and used the
g_assert* macros. Not to mention that sometimes the tests would crash
outside of an assertion macro.

We can make test-networkmanager-service.py notice that its parent has
crashed by opening a pipe between them and taking advantage of the
fact that the pipe will be automatically closed if the parent crashes.
So then test-networkmanager-service.py just has to watch for that, and
exit if the pipe closes.

Then that lets us drop the test_assert* macros and just use g_assert*
instead.
2014-08-01 12:12:42 -04:00
Dan Winship bd8a7f74b1 libnm-glib: split out test service launching code from tests 2014-08-01 12:12:42 -04:00
Dan Winship ade4f2e84e libnm-glib: use automake test infrastructure for test programs
Use "TESTS = tests-nm-client test-remote-settings-client" rather than
overriding "check-local".

Add a script "libnm-test-launch.sh" that will handle redirecting the
test via dbus-launch if needed.
2014-08-01 11:55:49 -04:00
Dan Winship 4f7e9bd336 libnm-glib: compile test-networkmanager-service.py path into test binaries
Rather than passing the path to the test service on the command line,
compile it into the test programs.

(Among other things, this makes it easier to run the test directly
from the command line.)
2014-08-01 11:55:49 -04:00
Thomas Haller d005c77213 build/dns: fix compilation error due to invalid #include path
Out-of-tree build fails with:
  ../../src/dns-manager/nm-dns-manager.c:38:33: fatal error: libnm-util/nm-utils.h: No such file or directory

Fixes regression introduced by commit 7580cfef20.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:59:11 +02:00
Thomas Haller b456900531 all: merge branch 'th/bgo733806_clang'
Fix sources so that they compile with clang.

https://bugzilla.gnome.org/show_bug.cgi?id=733806

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:25:13 +02:00
Thomas Haller 7580cfef20 dns: fix compiler warning by refactoring use of inet_ntop
Use nm_utils_inet4_ntop() and nm_utils_inet6_ntop() instead.
And get rid of the unneeded error-checking.

gcc warns:

    make[4]: Entering directory `/data/src/NetworkManager/src'
      CC       nm-dns-manager.lo
    dns-manager/nm-dns-manager.c: In function 'merge_one_ip4_config':
    dns-manager/nm-dns-manager.c:137:37: warning: ordered comparison of pointer with integer zero [-Wextra]
       if (inet_ntop (AF_INET, &addr, buf, INET_ADDRSTRLEN) > 0)
                                         ^
    dns-manager/nm-dns-manager.c:168:37: warning: ordered comparison of pointer with integer zero [-Wextra]
       if (inet_ntop (AF_INET, &addr, buf, INET_ADDRSTRLEN) > 0)
                                         ^
    dns-manager/nm-dns-manager.c: In function 'merge_one_ip6_config':
    dns-manager/nm-dns-manager.c:197:64: warning: ordered comparison of pointer with integer zero [-Wextra]
        if (inet_ntop (AF_INET, &(addr->s6_addr32[3]), buf, INET_ADDRSTRLEN) > 0)
                                                                    ^
    dns-manager/nm-dns-manager.c:200:38: warning: ordered comparison of pointer with integer zero [-Wextra]
        if (inet_ntop (AF_INET6, addr, buf, INET6_ADDRSTRLEN) > 0) {
                                          ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:01 +02:00
Thomas Haller ef24273104 cli: fix warning in parse_output_fields() about strict-overflow
gcc warns:

    make[4]: Entering directory `./NetworkManager/cli/src'
      CC       utils.o
    utils.c: In function ‘parse_output_fields’:
    utils.c:707:7: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
        if (found) {
           ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:01 +02:00
Thomas Haller b835111129 libnm-util, core: fix warning about signed integer overflow (-Wstrict-overflow)
gcc warns:

    make[4]: Entering directory `./NetworkManager/libnm-util'
      CC       nm-value-transforms.lo
    nm-value-transforms.c: In function '_nm_utils_convert_op_array_to_string':
    nm-value-transforms.c:121:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (i > 0)
          ^
    nm-value-transforms.c: In function '_nm_utils_convert_string_array_to_string':
    nm-value-transforms.c:121:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (i > 0)
          ^

    make[7]: Entering directory `./NetworkManager/src/settings/plugins/ifcfg-rh'
      CC       reader.lo
    reader.c: In function 'make_wired_setting':
    reader.c:3295:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (!found)
          ^
    reader.c: In function 'wireless_connection_from_ifcfg':
    reader.c:3295:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (!found)
          ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:01 +02:00
Thomas Haller f0d40201ae cli: fix warning about uninitialized value
gcc warns:

    make[4]: Entering directory `./NetworkManager/cli/src'
      CC       connections.o
    connections.c: In function ‘complete_connection_by_type’:
    connections.c:4235:18: error: ‘mtu_int’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
         g_object_set (s_wired, NM_SETTING_WIRED_MTU, mtu_int, NULL);
                      ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:01 +02:00
Thomas Haller f808c3603a platform/test: fix warning about uninitialized value
gcc warns:

    make[5]: Entering directory `./NetworkManager/src/platform/tests'
      CC       platform.o
    platform.c: In function ‘do_ip6_route_add’:
    platform.c:696:2: error: ‘plen’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      return nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER,
      ^
    platform.c: In function ‘do_ip6_route_delete’:
    platform.c:724:2: error: ‘plen’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      return nm_platform_ip6_route_delete (ifindex, network, plen, metric);
      ^
    platform.c: In function ‘do_ip4_route_delete’:
    [...]

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:01 +02:00
Thomas Haller 996b31ec20 cli: remove unused static struct nmc_mobile_settings
clang warns:

    make[4]: Entering directory `./NetworkManager/cli/src'
      CC       connections.o
    connections.c:2206:23: error: unused variable 'nmc_mobile_settings' [-Werror,-Wunused-const-variable]
    static const NameItem nmc_mobile_settings [] = {
                          ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller 9c9312b805 platform/test: fix warnings in test
clang warns:

    make[5]: Entering directory `./NetworkManager/src/platform/tests'
      CC       test_link_fake-test-link.o
    test-link.c:133:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
    }
    ^
    test-link.c:191:10: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
                            char *stdout = NULL;
                                  ^
    /usr/include/stdio.h:173:16: note: expanded from macro 'stdout'
    #define stdout stdout
                   ^
    /usr/include/stdio.h:169:25: note: previous declaration is here
    extern struct _IO_FILE *stdout;         /* Standard output stream.  */
                            ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller 4ca6274e2b ifcfg-rh: fix warning about duplicate const when declaring string
clang warns:

    make[7]: Entering directory `./NetworkManager/src/settings/plugins/ifcfg-rh'
      CC       writer.lo
    writer.c:2505:20: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
            static const char const as_dash[] = "\\][|/=()!";
                              ^~~~~~
      CC       utils.lo
    utils.c:40:20: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
            static const char const drop_chars[] = "\r\n"; /* drop CR and LF */
                              ^~~~~~

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller e543909afc olpc: fix wrong state change reason for device
NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED would map
to NM_DEVICE_STATE_REASON_NOW_MANAGED.

clang warns:

    make[6]: Entering directory `./NetworkManager/src/devices/wifi'
      CC       nm-device-olpc-mesh.lo
    nm-device-olpc-mesh.c:193:28: error: implicit conversion from enumeration type 'enum NMVPNConnectionStateReason' to different enumeration type 'NMDeviceStateReason' [-Werror,-Wenum-conversion]
                                             NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    nm-device-olpc-mesh.c:319:27: error: implicit conversion from enumeration type 'enum NMVPNConnectionStateReason' to different enumeration type 'NMDeviceStateReason' [-Werror,-Wenum-conversion]
                                     NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED);
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller 43df0e9ae4 core: fix warning calling non-returning g_error()
g_error() does not return, but clang seems not to understand that
and gives the following warning.

    make[4]: Entering directory `./NetworkManager/src'
      CC       NetworkManagerUtils.lo
    NetworkManagerUtils.c:1584:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
    }
    ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller 45c5365d85 vpn: fix warning in vpn-manager about implicit conversion of enum types
This bug has no real consequense, because the numerical values of the
enum values are identical.

clang warns:

    make[4]: Entering directory `./NetworkManager/src'
      CC       nm-vpn-connection.lo
    vpn-manager/nm-vpn-connection.c:179:10: error: implicit conversion from enumeration type 'VpnState' to different enumeration type 'NMVPNConnectionState' (aka 'enum NMVPNConnectionState') [-Werror,-Wenum-conversion]
                    return STATE_UNKNOWN;
                    ~~~~~~ ^~~~~~~~~~~~~

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller e31474f5d4 platform: fix warning initializing static array freq_policy
Since kernel commit 8fe02e167efa8ed4a4503a5eedc0f49fcb7e3eb9,
the value NL80211_FREQUENCY_ATTR_NO_IR replaces PASSIVE_SCAN
and NO_IBSS. Hence their numerical values are identical and
cause the following compiler warning.

clang warns:

    make[4]: Entering directory `./NetworkManager/src'
      CC       wifi-utils-nl80211.lo
    platform/wifi/wifi-utils-nl80211.c:683:48: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
                    [NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
                                                                 ^~~~~~~~
    platform/wifi/wifi-utils-nl80211.c:682:53: note: previous initialization is here
                    [NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG },
                                                                      ^~~~~~~~

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller 971dfc773f platform: fix warning warning about unused variable
The variable is not actually unused, because it is used
to free the nl_object instance.

clang warns:

    make[4]: Entering directory `./NetworkManager/src'
      CC       nm-linux-platform.lo
    platform/nm-linux-platform.c:1746:35: error: unused variable 'obj_cleanup' [-Werror,-Wunused-variable]
            auto_nl_object struct nl_object *obj_cleanup = obj;
                                             ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller 657ea51008 core: fix wrong device state change on failure in NMDeviceEthernet
Due to a bug, when dcb fails it would change the device state
to NM_DEVICE_STATE_UNKNOWN (zero), instead of NM_DEVICE_STATE_FAILED.

clang warns:

    make[4]: Entering directory `./NetworkManager/src'
      CC       nm-device-ethernet.lo
    devices/nm-device-ethernet.c:1237:30: error: implicit conversion from enumeration type 'enum NMActStageReturn' to different enumeration type 'NMDeviceState' [-Werror,-Wenum-conversion]
                                                             NM_ACT_STAGE_RETURN_FAILURE,
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    devices/nm-device-ethernet.c:1261:30: error: implicit conversion from enumeration type 'enum NMActStageReturn' to different enumeration type 'NMDeviceState' [-Werror,-Wenum-conversion]
                                                             NM_ACT_STAGE_RETURN_FAILURE,
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller a2a36d8450 core: fix warning about comparing unsigned enum values being positive
clang warns:

    make[4]: Entering directory `./NetworkManager/src'
      CC       nm-device.lo
    devices/nm-device.c:367:12: error: comparison of unsigned enum expression >= 0 is always true [-Werror,-Wtautological-compare]
            if (state >= 0 && state < G_N_ELEMENTS (state_table))
                ~~~~~ ^  ~
    devices/nm-device.c:443:13: error: comparison of unsigned enum expression >= 0 is always true [-Werror,-Wtautological-compare]
            if (reason >= 0 && reason < G_N_ELEMENTS (reason_table))
                ~~~~~~ ^  ~

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:00 +02:00
Thomas Haller 0238f8f8e2 libnm-glib: fix warning about redefining typedef RemoteCall
clang warns:

    make[4]: Entering directory `./NetworkManager/libnm-glib'
      CC       libnm_glib_la-nm-remote-connection.lo
    nm-remote-connection.c:77:3: error: redefinition of typedef 'RemoteCall' is a C11 feature [-Werror,-Wtypedef-redefinition]
    } RemoteCall;
      ^
    nm-remote-connection.c:67:27: note: previous definition is here
    typedef struct RemoteCall RemoteCall;
                              ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:16:59 +02:00