Public headers: use SPDX identifiers The SPDX identifiers [1] are a legally binding shorthand, which can be used instead of the full boiler plate text. This is another step towards implementing the full REUSE spec [2] to help with copyright and licensing audits and compliance. This will reduce a lot a manual work required for the licensing audit required in Debian on each update. For files that lacked copyright and licensing information, I used the following guidelines. Use the author from the git history and the main project license 'LGPL-2.1-or-later'. [1] https://spdx.org/ids-how [2] https://reuse.software/tutorial/ Change-Id: I31928c81be4821cca29b905d8a0a06de9bd0e1ec Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: powerpc32: transparent unions alter calling convention On powerpc32, transparent unions have an impact on the calling convention used for the argument, as they use the calling convention of the first field of the union rather than the union itself. On powerpc32, the calling convention for a union is that the register has a pointer to the union, which differs from the calling convention of its first field (which is a pointer in this case). "[...] the argument is passed to the function using the calling conventions of the first member of the transparent union, not the calling conventions of the union itself. All members of the union must have the same machine representation; this is necessary for this argument passing to work properly." [1] Therefore, use a transparent union for c++ so c++ compilers can emit caller code with a compatible stack layout. The "ignored attribute" warning emitted by clang appears to be only for architectures where the calling convention is not affected by the presence of transparent union attribute. Therefore, simply silence this warning. Link: https://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Type-Attributes.html [1] Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Change-Id: I07182dd4ed37a3f61a226fb199bc98c95f83bd37
Add C++ build tests Some urcu header files cause build failures when included in C++ programs. Add a test file that includes all exported headers (except those that are marked as deprecated) and build that test file as a C and C++ program, with and without _LGPL_SOURCE defined (to test both the static and non-static implementations). This helps ensure that the code in these headers works as both languages. This alone does not ensure full coverage, there may be code in unused macros that would need fixing. But by including the "static" headers, this already finds a few issues. The test doesn't run anything, its purpose is only to verify that things build. This catches the following build failures: - clang++ doesn't know the __transparent_union__ attribute, place some pragmas to ignore this warning around where __transparent_union__ is used. - CDS_WFS_WOULDBLOCK and CDS_WFS_END are cast to a void*. This doesn't work in C++ when assigning to a field them to typed pointer. Fix them by casting to the appropriate type. - The transparent union trick doesn't work in C++: CXX test_build_cxx.o In file included from /home/simark/src/urcu/include/urcu/wfstack.h:116, from /home/simark/src/urcu/include/urcu/cds.h:35, from /home/simark/src/urcu/tests/unit/test_build_cxx.cpp:34: /home/simark/src/urcu/include/urcu/static/wfstack.h: In function ‘cds_wfs_node* _cds_wfs_pop_with_state_blocking(cds_wfs_stack*, int*)’: /home/simark/src/urcu/include/urcu/static/wfstack.h:350:54: error: could not convert ‘s’ from ‘cds_wfs_stack*’ to ‘cds_wfs_stack_ptr_t’ 350 | retnode = ___cds_wfs_pop_with_state_blocking(s, state); | ^ | | | cds_wfs_stack* A C++ user can fall back to instantiating a cds_wfs_stack_ptr_t explicitly, assigning the right field, and passing the cds_wfs_stack_ptr_t to the function. Fix a few instances in the static headers. A follow up commit will introduce C++ API wrappers based on function overloading to provide a C++ API similar to the C API. Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Change-Id: I30adc8df69414a0a019c5ec081f64cfac64843f5
Cleanup: Re-organise source dir Re-organise the sources, add a top level "src" and "include" dir and move relevant files. Disable autotools automated includes and define them manually. This fixes problems with collision of header names with system headers. Include the autoconf config.h in the default includes and remove it where it's explicitely included. Remove _GNU_SOURCE defines since it's detected at configure for platforms that requires it and added to the config.h. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>