merge: branch 'bg/gcc10'

Fix build using GCC 10.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/406
This commit is contained in:
Beniamino Galvani 2020-02-03 15:27:39 +01:00
commit 9a971849b5
8 changed files with 36 additions and 34 deletions

View file

@ -1084,6 +1084,7 @@ libnm_core_libnm_core_la_CPPFLAGS = \
if WITH_JSON_VALIDATION
libnm_core_libnm_core_la_CPPFLAGS += $(JANSSON_CFLAGS)
libnm_core_libnm_core_la_CFLAGS = -fcommon
endif
libnm_core_libnm_core_la_SOURCES = \
@ -3667,8 +3668,6 @@ src_devices_wifi_libnm_device_plugin_wifi_la_LIBADD = \
src/devices/wifi/libnm-wifi-base.la \
$(GLIB_LIBS)
$(src_devices_wifi_libnm_device_plugin_wifi_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
check-local-devices-wifi: src/devices/wifi/libnm-device-plugin-wifi.la
$(srcdir)/tools/check-exports.sh $(builddir)/src/devices/wifi/.libs/libnm-device-plugin-wifi.so "$(srcdir)/linker-script-devices.ver"
$(call check_so_symbols,$(builddir)/src/devices/wifi/.libs/libnm-device-plugin-wifi.so)

View file

@ -696,8 +696,6 @@ constructed (GObject *object)
curl_multi_setopt (priv->mhandle, CURLMOPT_SOCKETDATA, self);
curl_multi_setopt (priv->mhandle, CURLMOPT_TIMERFUNCTION, _mhandle_timerfunction_cb);
curl_multi_setopt (priv->mhandle, CURLMOPT_TIMERDATA, self);
if (NM_CURL_DEBUG)
curl_multi_setopt (priv->mhandle, CURLOPT_VERBOSE, 1);
}
G_OBJECT_CLASS (nm_http_client_parent_class)->constructed (object);

View file

@ -516,7 +516,7 @@ struct _NMMetaPropertyTypDataNested {
guint nested_len;
};
const NMMetaPropertyTypDataNested nm_meta_property_typ_data_bond;
extern const NMMetaPropertyTypDataNested nm_meta_property_typ_data_bond;
/*****************************************************************************/

View file

@ -188,9 +188,12 @@ links = [
libnm_libnm_core_intern,
]
libnm_core_c_args = common_c_flags
if enable_json_validation
libnm_core_sources += files('nm-json.c')
deps += jansson_dep
libnm_core_c_args += ['-fcommon']
endif
libnm_core = static_library(
@ -198,7 +201,7 @@ libnm_core = static_library(
sources: libnm_core_sources + libnm_core_enum_sources + nm_meta_setting_source + [nm_version_macro_header],
include_directories: top_inc,
dependencies: deps,
c_args: common_c_flags,
c_args: libnm_core_c_args,
link_with: links,
)

View file

@ -277,6 +277,7 @@ int n_dhcp4_outgoing_append(NDhcp4Outgoing *outgoing,
return 0;
}
overload = outgoing->overload;
if (overload & N_DHCP4_OVERLOAD_SNAME)
outgoing->i_message = offsetof(NDhcp4Message, sname);
else

View file

@ -690,7 +690,6 @@ do_curl_request (NMConnectivityCheckHandle *cb_data)
curl_multi_setopt (mhandle, CURLMOPT_SOCKETDATA, cb_data);
curl_multi_setopt (mhandle, CURLMOPT_TIMERFUNCTION, multi_timer_cb);
curl_multi_setopt (mhandle, CURLMOPT_TIMERDATA, cb_data);
curl_multi_setopt (mhandle, CURLOPT_VERBOSE, 1);
switch (cb_data->addr_family) {
case AF_INET:

View file

@ -335,24 +335,25 @@ _ethtool_call_once (int ifindex, gpointer edata, gsize edata_size)
static struct ethtool_gstrings *
ethtool_get_stringset (SocketHandle *shandle, int stringset_id)
{
struct {
struct ethtool_sset_info info;
guint32 sentinel;
} sset_info = {
.info.cmd = ETHTOOL_GSSET_INFO,
.info.reserved = 0,
.info.sset_mask = (1ULL << stringset_id),
};
char buf[sizeof (struct ethtool_sset_info) + sizeof (guint32)];
struct ethtool_sset_info *sset_info;
gs_free struct ethtool_gstrings *gstrings = NULL;
gsize gstrings_len;
guint32 i, len;
if (_ethtool_call_handle (shandle, &sset_info, sizeof (sset_info)) < 0)
sset_info = (struct ethtool_sset_info *) buf;
*sset_info = (struct ethtool_sset_info) {
.cmd = ETHTOOL_GSSET_INFO,
.reserved = 0,
.sset_mask = (1ULL << stringset_id),
};
if (_ethtool_call_handle (shandle, sset_info, sizeof (*sset_info)) < 0)
return NULL;
if (!sset_info.info.sset_mask)
if (!sset_info->sset_mask)
return NULL;
len = sset_info.info.data[0];
len = sset_info->data[0];
gstrings_len = sizeof (*gstrings) + (len * ETH_GSTRING_LEN);
gstrings = g_malloc0 (gstrings_len);
@ -831,41 +832,42 @@ nmp_utils_ethtool_get_permanent_address (int ifindex,
guint8 *buf,
size_t *length)
{
struct {
struct ethtool_perm_addr e;
guint8 _extra_data[NM_UTILS_HWADDR_LEN_MAX + 1];
} edata = {
.e.cmd = ETHTOOL_GPERMADDR,
.e.size = NM_UTILS_HWADDR_LEN_MAX,
};
char ebuf[sizeof (struct ethtool_perm_addr) + NM_UTILS_HWADDR_LEN_MAX + 1];
struct ethtool_perm_addr *edata;
guint i;
g_return_val_if_fail (ifindex > 0, FALSE);
if (_ethtool_call_once (ifindex, &edata, sizeof (edata)) < 0)
edata = (struct ethtool_perm_addr *) ebuf;
*edata = (struct ethtool_perm_addr) {
.cmd = ETHTOOL_GPERMADDR,
.size = NM_UTILS_HWADDR_LEN_MAX,
};
if (_ethtool_call_once (ifindex, edata, sizeof (*edata)) < 0)
return FALSE;
if (edata.e.size > NM_UTILS_HWADDR_LEN_MAX)
if (edata->size > NM_UTILS_HWADDR_LEN_MAX)
return FALSE;
if (edata.e.size < 1)
if (edata->size < 1)
return FALSE;
if (NM_IN_SET (edata.e.data[0], 0, 0xFF)) {
if (NM_IN_SET (edata->data[0], 0, 0xFF)) {
/* Some drivers might return a permanent address of all zeros.
* Reject that (rh#1264024)
*
* Some drivers return a permanent address of all ones. Reject that too */
for (i = 1; i < edata.e.size; i++) {
if (edata.e.data[0] != edata.e.data[i])
for (i = 1; i < edata->size; i++) {
if (edata->data[0] != edata->data[i])
goto not_all_0or1;
}
return FALSE;
}
not_all_0or1:
memcpy (buf, edata.e.data, edata.e.size);
*length = edata.e.size;
memcpy (buf, edata->data, edata->size);
*length = edata->size;
return TRUE;
}

View file

@ -33,7 +33,7 @@ typedef struct {
NMSIfcfgKeyTypeFlags key_flags;
} NMSIfcfgKeyTypeInfo;
const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[227];
extern const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[227];
const NMSIfcfgKeyTypeInfo *nms_ifcfg_well_known_key_find_info (const char *key, gssize *out_idx);