test: use g_assert_not_reached () instead of asserting FALSE
authorLubomir Rintel <lkundrak@v3.sk>
Fri, 12 Feb 2016 08:05:27 +0000 (09:05 +0100)
committerLubomir Rintel <lkundrak@v3.sk>
Fri, 12 Feb 2016 08:05:27 +0000 (09:05 +0100)
It's declared as never returning, making do a better at understanding control
flow. Otherwise it makes a poor guess:

  In file included from test-crypto.c:37:
  ../../shared/nm-test-utils.h:1344:3: error: variable 'family' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                  g_assert (FALSE);
                  ^~~~~~~~~~~~~~~~

shared/nm-test-utils.h

index fcae761..66cacb7 100644 (file)
@@ -1341,7 +1341,7 @@ nmtst_setting_ip_config_add_address (NMSettingIPConfig *s_ip,
        else if (nm_utils_ipaddr_valid (AF_INET6, address))
                family = AF_INET6;
        else
-               g_assert (FALSE);
+               g_assert_not_reached ();
 
        addr = nm_ip_address_new (family, address, prefix, NULL);
        g_assert (addr);
@@ -1366,7 +1366,7 @@ nmtst_setting_ip_config_add_route (NMSettingIPConfig *s_ip,
        else if (nm_utils_ipaddr_valid (AF_INET6, dest))
                family = AF_INET6;
        else
-               g_assert (FALSE);
+               g_assert_not_reached ();
 
        route = nm_ip_route_new (family, dest, prefix, next_hop, metric, NULL);
        g_assert (route);