hboehm.info/gc (#2328)

* Create package.yml

* Create test.cc
This commit is contained in:
Andrew 2023-07-01 00:03:23 +03:00 committed by GitHub
parent 56ae63132b
commit 5dee2e3b8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,36 @@
distributable:
url: https://github.com/ivmai/bdwgc/releases/download/v{{version}}/gc-{{version}}.tar.gz
strip-components: 1
versions:
github: ivmai/bdwgc
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
freedesktop.org/pkg-config: '*'
github.com/ivmai/libatomic_ops: '*'
script:
- ./configure $ARGS
- make --jobs {{ hw.concurrency }}
- make --jobs {{ hw.concurrency }} check
- make --jobs {{ hw.concurrency }} install
env:
ARGS:
- --prefix="{{prefix}}"
- --disable-debug
- --disable-dependency-tracking
- --enable-cplusplus
- --enable-static
- --enable-large-config
test:
dependencies:
tea.xyz/gx/cc: c99
freedesktop.org/pkg-config: '*'
script:
- pkg-config --modversion bdw-gc | grep {{version}}
- cc test.c -lgc -o test
- ./test

16
hboehm.info/gc/test.cc Normal file
View file

@ -0,0 +1,16 @@
#include <assert.h>
#include <stdio.h>
#include "gc.h"
int main(void) {
int i;
GC_INIT();
for (i = 0; i < 10000000; ++i) {
int **p = (int **) GC_MALLOC(sizeof(int *));
int *q = (int *) GC_MALLOC_ATOMIC(sizeof(int));
assert(*p == 0);
*p = (int *) GC_REALLOC(q, 2 * sizeof(int));
}
return 0;
}