Fix order of initializers in CDS_LIST_HEAD_INIT
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 8 Sep 2021 19:30:28 +0000 (15:30 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 8 Sep 2021 19:30:28 +0000 (15:30 -0400)
commitce4a1f76adc73cda1ff7d4c98eb54bbd188faadf
treee757361e61ac483130598c0b40ff7fa52dc47cee
parent6faece30fc278a5062d3af116005d90be1a2027d
Fix order of initializers in CDS_LIST_HEAD_INIT

When using CDS_LIST_HEAD_INIT in a C++ program, we get (with clang
rather than gcc, because the error message is clearer):

    /home/simark/src/urcu/tests/unit/test_build_cxx.cpp:73:13: error: ISO C++ requires field designators to be specified in declaration order; field 'prev' will be initialized after field 'next' [-Werror,-Wreorder-init-list]
        .head = CDS_LIST_HEAD_INIT(list.head),
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/simark/src/urcu/include/urcu/list.h:49:53: note: expanded from macro 'CDS_LIST_HEAD_INIT'
    #define CDS_LIST_HEAD_INIT(name) { .prev = &(name), .next = &(name) }
                                                        ^~~~~~~~~~~~~~~
    /home/simark/src/urcu/tests/unit/test_build_cxx.cpp:73:13: note: previous initialization for field 'prev' is here
        .head = CDS_LIST_HEAD_INIT(list.head),
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/simark/src/urcu/include/urcu/list.h:49:44: note: expanded from macro 'CDS_LIST_HEAD_INIT'
    #define CDS_LIST_HEAD_INIT(name) { .prev = &(name), .next = &(name) }
                                               ^~~~~~~

Fix that by swapping the initializers in CDS_LIST_HEAD_INIT.

Change-Id: Ib127b9cc128fd64f5b2ae028e093be42ca10f437
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/urcu/list.h
This page took 0.024657 seconds and 4 git commands to generate.