Squashed 'src/c-rbtree/' changes from 8aa7bd1828ee..9b9713aeb9ec

9b9713aeb9ec build: update docs
7d38954dfd69 c-rbtree: document c_rbtree_entry() better
401241d4db02 build: always build test-parallel
337eb6c06d48 build: declare meson dependency
5741c13745cc ci: switch to new c-util CI workflow
39f870caf0aa build: drop redundant _GNU_SOURCE
cd315e186cf0 build: define 'ptrace' option
a1fb0a3296ae build: drop old submodules
739c1e982d74 build: re-order build definitions alphabetically
e98d4ed5a863 build: rework dependency handling
f9dd3852b8de build: use both_libraries()

git-subtree-dir: src/c-rbtree
git-subtree-split: 9b9713aeb9eca98566a85c8c90a02942ea430819
This commit is contained in:
Thomas Haller 2022-05-06 09:57:51 +02:00
parent 1b61323231
commit 8d2d37446d
12 changed files with 59 additions and 54 deletions

View file

@ -9,25 +9,15 @@ on:
jobs:
ci:
name: CI with Default Configuration
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v2
- name: Run through C-Util CI
uses: c-util/automation/src/ci-c-util@v1
with:
m32: 1
valgrind: 1
uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1
with:
cabuild_ref: "v1"
m32: true
matrixmode: true
valgrind: true
ci-ptrace:
name: Reduced CI with PTrace
runs-on: ubuntu-latest
env:
CRBTREE_TEST_PTRACE: '1'
steps:
- name: Fetch Sources
uses: actions/checkout@v2
- name: Run through C-Util CI
uses: c-util/automation/src/ci-c-util@v1
uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1
with:
cabuild_ref: "v1"
mesonargs: '-Dptrace=true'

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "subprojects/c-stdaux"]
path = subprojects/c-stdaux
url = https://github.com/c-util/c-stdaux.git

View file

@ -30,7 +30,7 @@ AUTHORS-LGPL:
along with this program; If not, see <http://www.gnu.org/licenses/>.
COPYRIGHT: (ordered alphabetically)
Copyright (C) 2015-2019 Red Hat, Inc.
Copyright (C) 2015-2022 Red Hat, Inc.
AUTHORS: (ordered alphabetically)
David Rheinsberg <david.rheinsberg@gmail.com>

15
NEWS.md
View file

@ -1,5 +1,20 @@
# c-rbtree - Intrusive Red-Black Tree Collection
## CHANGES WITH 4:
* Add 'ptrace' build option to enable running tests using 'ptrace'
to verify extended execution properties. This option should not
be used in setups where 'ptrace' cannot be employed (like running
under gdb or valgrind). This option only affects the test-suite.
* meson-0.60.0 is now the minimum required meson version.
* TBD
Contributions from: David Rheinsberg
- TBD, YYYY-MM-DD
## CHANGES WITH 3:
* Add more helpers. Add both a collection of iteratiors and helpers

View file

@ -22,7 +22,7 @@ The requirements for this project are:
At build-time, the following software is required:
* `meson >= 0.41`
* `meson >= 0.60`
* `pkg-config >= 0.29`
### Build

View file

@ -1,19 +1,22 @@
project(
'c-rbtree',
'c',
version: '3',
license: 'Apache',
default_options: [
'c_std=c11'
],
license: 'Apache',
meson_version: '>=0.60.0',
version: '3.0.0',
)
major = meson.project_version().split('.')[0]
project_description = 'Intrusive Red-Black Tree Collection'
add_project_arguments('-D_GNU_SOURCE', language: 'c')
mod_pkgconfig = import('pkgconfig')
use_ptrace = get_option('ptrace')
sub_cstdaux = subproject('c-stdaux')
dep_cstdaux = sub_cstdaux.get_variable('libcstdaux_dep')
dep_cstdaux = dependency('libcstdaux-1')
add_project_arguments(dep_cstdaux.get_variable('cflags').split(' '), language: 'c')
subdir('src')
meson.override_dependency('libcrbtree-'+major, libcrbtree_dep, static: true)

1
meson_options.txt Normal file
View file

@ -0,0 +1 @@
option('ptrace', type: 'boolean', value: false, description: 'Allow ptrace in test suite')

View file

@ -144,6 +144,11 @@ static inline void c_rbnode_init(CRBNode *n) {
*
* Return: Pointer to parent container, or NULL.
*/
/*
* Note: This was carefully designed to avoid multiple evaluation of `_what`,
* but avoid context-expression-extensions. That is why it uses the
* possibly odd style of `(x ?: offsetof(...)) - offsetof(...))`.
*/
#define c_rbnode_entry(_what, _t, _m) \
((_t *)(void *)(((unsigned long)(void *)(_what) ?: \
offsetof(_t, _m)) - offsetof(_t, _m)))

View file

@ -8,8 +8,8 @@ libcrbtree_deps = [
dep_cstdaux,
]
libcrbtree_private = static_library(
'crbtree-private',
libcrbtree_both = both_libraries(
'crbtree-'+major,
[
'c-rbtree.c',
],
@ -18,26 +18,19 @@ libcrbtree_private = static_library(
'-fno-common',
],
dependencies: libcrbtree_deps,
pic: true,
)
libcrbtree_shared = shared_library(
'crbtree',
objects: libcrbtree_private.extract_all_objects(),
dependencies: libcrbtree_deps,
install: not meson.is_subproject(),
soversion: 0,
link_depends: libcrbtree_symfile,
link_args: [
'-Wl,--no-undefined',
'-Wl,--version-script=@0@'.format(libcrbtree_symfile),
],
link_depends: libcrbtree_symfile,
soversion: 0,
)
libcrbtree_dep = declare_dependency(
include_directories: include_directories('.'),
link_with: libcrbtree_private,
dependencies: libcrbtree_deps,
include_directories: include_directories('.'),
link_with: libcrbtree_both.get_static_lib(),
version: meson.project_version(),
)
@ -45,11 +38,11 @@ if not meson.is_subproject()
install_headers('c-rbtree.h')
mod_pkgconfig.generate(
libraries: libcrbtree_shared,
version: meson.project_version(),
name: 'libcrbtree',
filebase: 'libcrbtree',
description: project_description,
filebase: 'libcrbtree-'+major,
libraries: libcrbtree_both.get_shared_lib(),
name: 'libcrbtree',
version: meson.project_version(),
)
endif
@ -57,7 +50,7 @@ endif
# target: test-*
#
test_api = executable('test-api', ['test-api.c'], link_with: libcrbtree_shared)
test_api = executable('test-api', ['test-api.c'], link_with: libcrbtree_both.get_shared_lib())
test('API Symbol Visibility', test_api)
test_basic = executable('test-basic', ['test-basic.c'], dependencies: libcrbtree_dep)
@ -70,7 +63,9 @@ test_misc = executable('test-misc', ['test-misc.c'], dependencies: libcrbtree_de
test('Miscellaneous', test_misc)
test_parallel = executable('test-parallel', ['test-parallel.c'], dependencies: libcrbtree_dep)
test('Lockless Parallel Readers', test_parallel)
if use_ptrace
test('Lockless Parallel Readers', test_parallel)
endif
test_posix = executable('test-posix', ['test-posix.c'], dependencies: libcrbtree_dep)
test('Posix tsearch(3p) Comparison', test_posix)

View file

@ -364,9 +364,6 @@ int main(int argc, char **argv) {
unsigned int i;
int r;
if (!getenv("CRBTREE_TEST_PTRACE"))
return 77;
/* we want stable tests, so use fixed seed */
srand(0xdeadbeef);

@ -1 +0,0 @@
Subproject commit c5f166d02ff68af5cdcbad1bdcea2cb134e34ce4

View file

@ -0,0 +1,3 @@
[wrap-git]
url = https://github.com/c-util/c-stdaux.git
revision = v1