Beniamino Galvani 2019-02-04 10:56:25 +01:00
commit 483dc40047
10 changed files with 50 additions and 18 deletions

View file

@ -58,6 +58,7 @@
%bcond_without regen_docs
%bcond_with debug
%bcond_with test
%bcond_with lto
%bcond_with sanitizer
%if 0%{?fedora} > 28 || 0%{?rhel} > 7
%bcond_with libnm_glib
@ -490,6 +491,11 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
-Dmore_asserts=0 \
%endif
-Dld_gc=true \
%if %{with lto}
-D b_lto=true \
%else
-D b_lto=false \
%endif
-Dlibaudit=yes-disabled-by-default \
%if 0%{?with_modem_manager_1}
-Dmodem_manager=true \
@ -601,6 +607,11 @@ intltoolize --automake --copy --force
--without-more-asserts \
%endif
--enable-ld-gc \
%if %{with lto}
--enable-lto \
%else
--disable-lto \
%endif
--with-libaudit=yes-disabled-by-default \
%if 0%{?with_modem_manager_1}
--with-modem-manager-1=yes \

View file

@ -674,8 +674,10 @@ _nm_connection_find_base_type_setting (NMConnection *connection)
{
NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (connection);
GHashTableIter iter;
NMSetting *setting = NULL, *s_iter;
NMSettingPriority setting_prio, s_iter_prio;
NMSetting *setting = NULL;
NMSetting *s_iter;
NMSettingPriority setting_prio = NM_SETTING_PRIORITY_USER;
NMSettingPriority s_iter_prio;
g_hash_table_iter_init (&iter, priv->settings);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &s_iter)) {

View file

@ -919,7 +919,7 @@ vfs_to_dbus (NMSetting *setting, const char *property)
GVariantBuilder vf_builder;
const guint *vlan_ids;
const char **name;
guint num_vlans;
guint num_vlans = 0;
g_variant_builder_init (&vf_builder, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&vf_builder, "{sv}", "index",

View file

@ -150,9 +150,9 @@ fi
AC_DEFUN([NM_LTO],
[AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [Enable Link Time Optimization for smaller size (default: no)]))
if (test "${enable_lto}" = "yes"); then
CC_CHECK_FLAG_APPEND([lto_flags], [CFLAGS], [-flto])
CC_CHECK_FLAG_APPEND([lto_flags], [CFLAGS], [-flto -flto-partition=none])
if (test -n "${lto_flags}"); then
CFLAGS="-flto $CFLAGS"
CFLAGS="-flto -flto-partition=none $CFLAGS"
else
AC_MSG_ERROR([Link Time Optimization -flto is not supported.])
fi

View file

@ -147,6 +147,15 @@ if enable_ld_gc
common_ldflags += test_ldflags
endif
enable_lto = get_option('b_lto')
if enable_lto
# meson already adds '-flto'
lto_flag = '-flto-partition=none'
assert(cc.has_argument(lto_flag), '-flto-partition=none not supported. Disable link-time optimization with -Db_lto=false.')
common_flags += lto_flag
common_ldflags += lto_flag
endif
if nm_debug
common_flags += cc.get_supported_arguments([
'-fno-strict-aliasing',
@ -986,7 +995,7 @@ if enable_valgrind
endif
output += '\n'
output += ' code coverage: ' + get_option('b_coverage').to_string() + '\n'
output += ' LTO: ' + get_option('b_lto').to_string() + '\n'
output += ' LTO: ' + enable_lto.to_string() + '\n'
output += ' Linker garbage collection: ' + enable_ld_gc.to_string() + '\n'
output += ' JSON validation for libnm: ' + enable_json_validation.to_string() + '\n'
output += ' crypto: ' + crypto + ' (have-gnutls: ' + crypto_gnutls_dep.found().to_string() + ', have-nss: ' + crypto_nss_dep.found().to_string() + ')\n'

View file

@ -1243,17 +1243,17 @@ fcn_name (lookup_type val) \
/*****************************************************************************/
#define _NM_BACKPORT_SYMBOL_IMPL(VERSION, RETURN_TYPE, ORIG_FUNC, VERSIONED_FUNC, ARGS_TYPED, ARGS) \
RETURN_TYPE VERSIONED_FUNC ARGS_TYPED; \
RETURN_TYPE VERSIONED_FUNC ARGS_TYPED \
#define _NM_BACKPORT_SYMBOL_IMPL(version, return_type, orig_func, versioned_func, args_typed, args) \
return_type versioned_func args_typed; \
__attribute__ ((externally_visible)) return_type versioned_func args_typed \
{ \
return ORIG_FUNC ARGS; \
return orig_func args; \
} \
RETURN_TYPE ORIG_FUNC ARGS_TYPED; \
__asm__(".symver "G_STRINGIFY(VERSIONED_FUNC)", "G_STRINGIFY(ORIG_FUNC)"@"G_STRINGIFY(VERSION))
return_type orig_func args_typed; \
__asm__(".symver "G_STRINGIFY(versioned_func)", "G_STRINGIFY(orig_func)"@"G_STRINGIFY(version))
#define NM_BACKPORT_SYMBOL(VERSION, RETURN_TYPE, FUNC, ARGS_TYPED, ARGS) \
_NM_BACKPORT_SYMBOL_IMPL(VERSION, RETURN_TYPE, FUNC, _##FUNC##_##VERSION, ARGS_TYPED, ARGS)
#define NM_BACKPORT_SYMBOL(version, return_type, func, args_typed, args) \
_NM_BACKPORT_SYMBOL_IMPL(version, return_type, func, _##func##_##version, args_typed, args)
/*****************************************************************************/
@ -1371,6 +1371,14 @@ nm_strcmp_p (gconstpointer a, gconstpointer b)
: _b); \
})
/* evaluates to (void) if _A or _B are not constant or of different types */
#define NM_CONST_MAX(_A, _B) \
(__builtin_choose_expr (( __builtin_constant_p (_A) \
&& __builtin_constant_p (_B) \
&& __builtin_types_compatible_p (typeof (_A), typeof (_B))), \
((_A) > (_B)) ? (_A) : (_B), \
((void) 0)))
/*****************************************************************************/
static inline guint

View file

@ -1214,7 +1214,7 @@ nmtst_inet_from_string (int addr_family, const char *str)
static inline const char *
nmtst_inet_to_string (int addr_family, gconstpointer addr)
{
static char buf[MAX (INET6_ADDRSTRLEN, INET_ADDRSTRLEN)];
static char buf[NM_CONST_MAX (INET6_ADDRSTRLEN, INET_ADDRSTRLEN)];
g_assert (NM_IN_SET (addr_family, AF_INET, AF_INET6));
g_assert (addr);

View file

@ -890,7 +890,8 @@ void internal_hashmap_clear(HashmapBase *h, free_func_t default_free_key, free_f
* themselves from our hash table a second time, the entry is already gone. */
while (internal_hashmap_size(h) > 0) {
void *v, *k;
void *k = NULL;
void *v;
v = internal_hashmap_first_key_and_value(h, true, &k);

View file

@ -5643,7 +5643,6 @@ check_connection_compatible (NMDevice *self, NMConnection *connection, GError **
NMDeviceClass *klass;
const char *const *patterns;
NMSettingMatch *s_match;
guint num_patterns;
klass = NM_DEVICE_GET_CLASS (self);
if (klass->connection_type_check_compatible) {
@ -5684,6 +5683,8 @@ check_connection_compatible (NMDevice *self, NMConnection *connection, GError **
s_match = (NMSettingMatch *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_MATCH);
if (s_match) {
guint num_patterns = 0;
patterns = nm_setting_match_get_interface_names (s_match, &num_patterns);
if (!nm_wildcard_match_check (device_iface, patterns, num_patterns)) {
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,

View file

@ -2153,7 +2153,7 @@ nm_ip4_config_get_first_address (const NMIP4Config *self)
const NMPlatformIP4Address *
_nmtst_ip4_config_get_address (const NMIP4Config *self, guint i)
{
NMDedupMultiIter iter;
NMDedupMultiIter iter = { };
const NMPlatformIP4Address *a = NULL;
guint j;