Skip to content

Commit 4fca0ae

Browse files
authored
Run CI against illumos and make the tests pass. (#771)
We only want to use the `restrict` keyword in C, not in C++. Under linux, darwin, etc., we can check for `__STDC_VERSION__` to verify that we're compiling C and not C++. However, illumos defines `__STDC_VERSION__` whether we're compiling C *or* C++. To ensure that we don't use the `restrict` keyword in C++ on illumos, this patch adds a check on `__cplusplus` as well, and skips `restrict` if it's defined. This patch also adds a test workflow for illumos to avoid future regressions.
1 parent bb5c6ba commit 4fca0ae

File tree

2 files changed

+59
-3
lines changed

2 files changed

+59
-3
lines changed

.github/workflows/omnios-ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: OmniOS
2+
3+
'on':
4+
- push
5+
- pull_request
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
15+
- name: Build and Test on OmniOS
16+
uses: vmactions/omnios-vm@v1
17+
with:
18+
release: r151050
19+
usesh: true
20+
prepare: |
21+
set -e
22+
pkg install developer/cmake developer/gcc13 developer/build/gnu-make developer/versioning/git
23+
run: |
24+
set -e
25+
SRCDIR=$(pwd)
26+
27+
# Build and Test
28+
mkdir build
29+
cd build
30+
cmake -DCMAKE_INSTALL_PREFIX:PATH=destination -DENABLE_ROARING_TESTS=ON ..
31+
cmake --build .
32+
ctest . --output-on-failure
33+
cmake --install .
34+
cd ../tests/installation/find && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .
35+
cd $SRCDIR
36+
37+
# Build and Test Shared
38+
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=destinationshared -DENABLE_ROARING_TESTS=ON -B buildshared
39+
cmake --build buildshared
40+
cmake --install buildshared
41+
cd tests/installation/find
42+
cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../destinationshared -B buildshared
43+
cmake --build buildshared
44+
./buildshared/repro
45+
cd $SRCDIR
46+
47+
# Build and Test Debug
48+
mkdir builddebug
49+
cd builddebug
50+
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=destination -DENABLE_ROARING_TESTS=ON ..
51+
cmake --build .
52+
ctest . --output-on-failure
53+
cmake --install .
54+
cd ../tests/installation/find && mkdir builddebug && cd builddebug && cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .
55+
cd $SRCDIR

include/roaring/bitset/bitset.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
#define CROARING_CBITSET_BITSET_H
33

44
// For compatibility with MSVC with the use of `restrict`
5-
#if (__STDC_VERSION__ >= 199901L) || \
5+
#ifdef __cplusplus
6+
#define CROARING_CBITSET_RESTRICT
7+
#elif (__STDC_VERSION__ >= 199901L) || \
68
(defined(__GNUC__) && defined(__STDC_VERSION__))
79
#define CROARING_CBITSET_RESTRICT restrict
810
#else
911
#define CROARING_CBITSET_RESTRICT
10-
#endif // (__STDC_VERSION__ >= 199901L) || (defined(__GNUC__) &&
11-
// defined(__STDC_VERSION__ ))
12+
#endif
1213

1314
#include <stdbool.h>
1415
#include <stdint.h>

0 commit comments

Comments
 (0)