build: Fix build when using clang (#100)

* Add -Wno-address-of-temporary to allow taking an address of temporary like -fpermissive does for gcc

* Make some implicit casts explicit

* Implement the wl_array_for_each macro inline as clang does not like to handle it's implicit typecast

* Removed unecessary include that was automatically added by the ide

* Replaced reinterpret_cast's with c-style casts
This commit is contained in:
Rudolchr 2023-09-26 23:23:02 +02:00 committed by GitHub
parent b6e1732fda
commit f9461b0b7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View file

@ -28,7 +28,8 @@ add_project_arguments(cpp_compiler.get_supported_arguments([
'-Wno-pointer-arith', '-Wno-pointer-arith',
'-Wno-unused-parameter', '-Wno-unused-parameter',
'-Wno-unused-value', '-Wno-unused-value',
'-fpermissive' '-fpermissive',
'-Wno-address-of-temporary'
]), language: 'cpp') ]), language: 'cpp')
conf_data = configuration_data() conf_data = configuration_data()

View file

@ -169,7 +169,8 @@ static void dmabufFeedbackTrancheFormats(void* data, zwp_linux_dmabuf_feedback_v
uint32_t n_modifiers = g_pPortalManager->m_sWaylandConnection.dma.formatTableSize / sizeof(struct fm_entry); uint32_t n_modifiers = g_pPortalManager->m_sWaylandConnection.dma.formatTableSize / sizeof(struct fm_entry);
fm_entry* fm_entry = (struct fm_entry*)g_pPortalManager->m_sWaylandConnection.dma.formatTable; fm_entry* fm_entry = (struct fm_entry*)g_pPortalManager->m_sWaylandConnection.dma.formatTable;
uint16_t* idx; uint16_t* idx;
wl_array_for_each(idx, indices) {
for (idx = (uint16_t*)indices->data; (const char*)idx < (const char*)indices->data + indices->size; idx++) {
if (*idx >= n_modifiers) if (*idx >= n_modifiers)
continue; continue;

View file

@ -781,7 +781,7 @@ static void pwStreamParamChanged(void* data, uint32_t id, const spa_pod* param)
const spa_pod* pod_modifier = &prop_modifier->value; const spa_pod* pod_modifier = &prop_modifier->value;
uint32_t n_modifiers = SPA_POD_CHOICE_N_VALUES(pod_modifier) - 1; uint32_t n_modifiers = SPA_POD_CHOICE_N_VALUES(pod_modifier) - 1;
uint64_t* modifiers = SPA_POD_CHOICE_VALUES(pod_modifier); uint64_t* modifiers = (uint64_t*)SPA_POD_CHOICE_VALUES(pod_modifier);
modifiers++; modifiers++;
uint32_t flags = GBM_BO_USE_RENDERING; uint32_t flags = GBM_BO_USE_RENDERING;
uint64_t modifier; uint64_t modifier;
@ -853,13 +853,14 @@ static void pwStreamParamChanged(void* data, uint32_t id, const spa_pod* param)
params[0] = build_buffer(&dynBuilder[0].b, blocks, PSTREAM->pSession->sharingData.frameInfoSHM.size, PSTREAM->pSession->sharingData.frameInfoSHM.stride, data_type); params[0] = build_buffer(&dynBuilder[0].b, blocks, PSTREAM->pSession->sharingData.frameInfoSHM.size, PSTREAM->pSession->sharingData.frameInfoSHM.stride, data_type);
params[1] = spa_pod_builder_add_object(&dynBuilder[1].b, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header), SPA_PARAM_META_size, params[1] = (const spa_pod*)spa_pod_builder_add_object(&dynBuilder[1].b, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
SPA_POD_Int(sizeof(struct spa_meta_header))); SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header)));
params[2] = spa_pod_builder_add_object(&dynBuilder[1].b, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoTransform), params[2] = (const spa_pod*)spa_pod_builder_add_object(&dynBuilder[1].b, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoTransform),
SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_videotransform))); SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_videotransform)));
params[3] = spa_pod_builder_add_object(&dynBuilder[2].b, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoDamage), SPA_PARAM_META_size, params[3] = (const spa_pod*)spa_pod_builder_add_object(
&dynBuilder[2].b, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoDamage), SPA_PARAM_META_size,
SPA_POD_CHOICE_RANGE_Int(sizeof(struct spa_meta_region) * 4, sizeof(struct spa_meta_region) * 1, sizeof(struct spa_meta_region) * 4)); SPA_POD_CHOICE_RANGE_Int(sizeof(struct spa_meta_region) * 4, sizeof(struct spa_meta_region) * 1, sizeof(struct spa_meta_region) * 4));
pw_stream_update_params(PSTREAM->stream, params, 4); pw_stream_update_params(PSTREAM->stream, params, 4);