c-rbtree: re-import git-subtree for 'src/c-rbtree'

git subtree pull --prefix src/c-rbtree git@github.com:c-util/c-rbtree.git main --squash
This commit is contained in:
Thomas Haller
2022-05-06 09:58:05 +02:00
12 changed files with 59 additions and 54 deletions

View File

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

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

View File

@@ -1,5 +1,20 @@
# c-rbtree - Intrusive Red-Black Tree Collection # 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: ## CHANGES WITH 3:
* Add more helpers. Add both a collection of iteratiors and helpers * 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: At build-time, the following software is required:
* `meson >= 0.41` * `meson >= 0.60`
* `pkg-config >= 0.29` * `pkg-config >= 0.29`
### Build ### Build

View File

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

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. * 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) \ #define c_rbnode_entry(_what, _t, _m) \
((_t *)(void *)(((unsigned long)(void *)(_what) ?: \ ((_t *)(void *)(((unsigned long)(void *)(_what) ?: \
offsetof(_t, _m)) - offsetof(_t, _m))) offsetof(_t, _m)) - offsetof(_t, _m)))

View File

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

View File

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

Submodule src/c-rbtree/subprojects/c-stdaux deleted from c5f166d02f

View File

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