cmake/compiler/xcc: sched: Support XCC inlining semantics

Cadence XCC is based off of a very old 4.2 gcc compiler, which didn't
perfectly support C99 "inline" semantics with respect to
cross-translation-unit inline linkage (which Zephyr does not use, our
inlines are static only) and declaration order.

Fix the one spot where we were calling an inline before its
ALWAYS_INLINE definition, and add a flag to suppress the warning so
CI's trying to build with XCC and -Werror don't flip out.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2021-09-07 15:34:04 -07:00 committed by Anas Nashif
commit 0d763e0a10
2 changed files with 23 additions and 17 deletions

View file

@ -4,4 +4,10 @@ if(CC STREQUAL "clang")
include(${ZEPHYR_BASE}/cmake/compiler/clang/compiler_flags.cmake)
else()
include(${ZEPHYR_BASE}/cmake/compiler/gcc/compiler_flags.cmake)
# XCC is based on GCC 4.2 which has a somewhat pedantic take on the
# fact that linkage semantics differed between C99 and GNU at the
# time. Suppress the warning, it's the best we can do given that
# it's a legacy compiler.
set_compiler_property(APPEND PROPERTY warning_base "-fgnu89-inline")
endif()

View file

@ -170,6 +170,23 @@ static ALWAYS_INLINE struct k_thread *_priq_dumb_mask_best(sys_dlist_t *pq)
}
#endif
ALWAYS_INLINE void z_priq_dumb_add(sys_dlist_t *pq, struct k_thread *thread)
{
struct k_thread *t;
__ASSERT_NO_MSG(!z_is_idle_thread_object(thread));
SYS_DLIST_FOR_EACH_CONTAINER(pq, t, base.qnode_dlist) {
if (z_sched_prio_cmp(thread, t) > 0) {
sys_dlist_insert(&t->base.qnode_dlist,
&thread->base.qnode_dlist);
return;
}
}
sys_dlist_append(pq, &thread->base.qnode_dlist);
}
/* _current is never in the run queue until context switch on
* SMP configurations, see z_requeue_current()
*/
@ -927,23 +944,6 @@ void *z_get_next_switch_handle(void *interrupted)
}
#endif
ALWAYS_INLINE void z_priq_dumb_add(sys_dlist_t *pq, struct k_thread *thread)
{
struct k_thread *t;
__ASSERT_NO_MSG(!z_is_idle_thread_object(thread));
SYS_DLIST_FOR_EACH_CONTAINER(pq, t, base.qnode_dlist) {
if (z_sched_prio_cmp(thread, t) > 0) {
sys_dlist_insert(&t->base.qnode_dlist,
&thread->base.qnode_dlist);
return;
}
}
sys_dlist_append(pq, &thread->base.qnode_dlist);
}
void z_priq_dumb_remove(sys_dlist_t *pq, struct k_thread *thread)
{
__ASSERT_NO_MSG(!z_is_idle_thread_object(thread));