Changeset 78f0422c in mainline for uspace/lib/c


Ignore:
Timestamp:
2023-10-22T17:27:09Z (21 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
133461c
Parents:
71b4444 (diff), dfb16c4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge C/C++ changes needed to build with newer GCC

Location:
uspace/lib/c
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/rtld/symbol.c

    r71b4444 r78f0422c  
    135135        modules_untag(start->rtld);
    136136
    137         /* Insert root (the program) into the queue and tag it */
     137        /*
     138         * Insert root (the program) into the queue and tag it.
     139         *
     140         * We disable the dangling-pointer warning because the compiler incorrectly
     141         * assumes that we leak local address (queue) to a parent scope (to start
     142         * argument). However, we always empty the list so the pointer cannot
     143         * actually escape. Probably the compiler can never statically analyze that
     144         * correctly.
     145         */
    138146        list_initialize(&queue);
    139147        start->bfs_tag = true;
     148#pragma GCC diagnostic push
     149#if defined(__GNUC__) && (__GNUC__ >= 12)
     150#pragma GCC diagnostic ignored "-Wdangling-pointer"
     151#endif
    140152        list_append(&start->queue_link, &queue);
     153#pragma GCC diagnostic pop
    141154
    142155        /* If the symbol is found, it will be stored in 'sym' */
  • uspace/lib/c/generic/thread/fibril_synch.c

    r71b4444 r78f0422c  
    160160{
    161161        check_fibril_for_deadlock(oi, fibril_self());
    162 }
    163 
    164 void fibril_mutex_initialize(fibril_mutex_t *fm)
    165 {
    166         fm->oi.owned_by = NULL;
    167         fm->counter = 1;
    168         list_initialize(&fm->waiters);
    169162}
    170163
  • uspace/lib/c/include/adt/list.h

    r71b4444 r78f0422c  
    183183 *
    184184 */
    185 _NO_TRACE static inline void list_initialize(list_t *list)
     185_NO_TRACE static inline __CONSTEXPR void list_initialize(list_t *list)
    186186{
    187187        list->head.prev = &list->head;
  • uspace/lib/c/include/fibril_synch.h

    r71b4444 r78f0422c  
    153153extern void __fibril_synch_fini(void);
    154154
    155 extern void fibril_mutex_initialize(fibril_mutex_t *);
     155/** Initialize fibril mutex.
     156 *
     157 * Kept as in-line to allow constexpr marker for C++ library where this
     158 * is used by C++ mutex type (list initialization are two assignments
     159 * so it is actually reasonable to have this inlined).
     160 */
     161static inline __CONSTEXPR void fibril_mutex_initialize(fibril_mutex_t *fm)
     162{
     163        fm->oi.owned_by = NULL;
     164        fm->counter = 1;
     165        list_initialize(&fm->waiters);
     166}
     167
    156168extern void fibril_mutex_lock(fibril_mutex_t *);
    157169extern bool fibril_mutex_trylock(fibril_mutex_t *);
  • uspace/lib/c/test/string.c

    r71b4444 r78f0422c  
    799799PCUT_TEST(strndup_nonempty_short)
    800800{
     801#pragma GCC diagnostic push
     802        // Intentionally checking it works with _longer_ size than actual
     803#if defined(__GNUC__) && (__GNUC__ >= 11)
     804#pragma GCC diagnostic ignored "-Wstringop-overread"
     805#endif
    801806        char *d = strndup("abc", 5);
     807#pragma GCC diagnostic pop
    802808        PCUT_ASSERT_NOT_NULL(d);
    803809        PCUT_ASSERT_TRUE(d[0] == 'a');
Note: See TracChangeset for help on using the changeset viewer.