Skip to content

Commit 525299b

Browse files
authored
Robj/clang format 16 (#637)
move to clang-16 and clang-format-16
1 parent 1939a12 commit 525299b

File tree

23 files changed

+88
-85
lines changed

23 files changed

+88
-85
lines changed

.github/workflows/run-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: awalsh128/cache-apt-pkgs-action@latest
1414
with:
15-
packages: libxxhash-dev libaio-dev libconfig-dev gcc clang-13 clang-format-13
15+
packages: libxxhash-dev libaio-dev libconfig-dev gcc clang-16 clang-format-16
1616
- name: format-check
1717
run: ./format-check.sh
1818

@@ -68,6 +68,6 @@ jobs:
6868
- uses: actions/checkout@v4
6969
- uses: awalsh128/cache-apt-pkgs-action@latest
7070
with:
71-
packages: libxxhash-dev libaio-dev libconfig-dev gcc clang-13 clang-format-13
71+
packages: libxxhash-dev libaio-dev libconfig-dev gcc clang-16 clang-format-16
7272
- name: make ${{ matrix.target }}
7373
run: make ${{ matrix.target }}

Dockerfile.build-env

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ set -euo pipefail; \
2323
export DEBIAN_FRONTEND=noninteractive; \
2424
apt-get update -y && apt-get install -y software-properties-common wget'
2525

26-
# Install llvm and clang v13 for Ubuntu 20.04 and make them the default
27-
# We rely on clang-format-13 for ./format-check.sh
26+
# Install llvm and clang v16 for Ubuntu 20.04 and make them the default
27+
# We rely on clang-format-16 for ./format-check.sh
2828
RUN /bin/bash -c ' \
2929
set -euo pipefail; \
3030
export DEBIAN_FRONTEND=noninteractive; \
3131
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
32-
&& add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" \
33-
&& apt-get install -y clang-13 clang-format-13 lld-13 \
34-
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-13 1 \
35-
&& update-alternatives --install /usr/bin/lld lld /usr/bin/lld-13 1 \
36-
&& update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-13 1'
32+
&& add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-16 main" \
33+
&& apt-get install -y clang-16 clang-format-16 lld-16 \
34+
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 1 \
35+
&& update-alternatives --install /usr/bin/lld lld /usr/bin/lld-16 1 \
36+
&& update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-16 1'
3737

3838
# Install remaining tools required for builds
3939
RUN /bin/bash -c ' \

docs/build.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,15 @@ To integrate SplinterDB into another application, see [Usage](usage.md).
77
Builds are known to work on Ubuntu using recent versions of GCC and Clang.
88

99
### Tooling
10-
In CI, we test against GCC 9 and Clang 13.
10+
In CI, we test against GCC 13 and Clang 16.
1111

12-
We use `clang-format-13` for code formatting.
13-
14-
To install `clang-13` tools on Ubuntu Linux, do this:
15-
16-
```shell
17-
$ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
18-
19-
$ sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
20-
21-
$ sudo apt-get install -y clang-13 clang-format-13
22-
```
12+
We use `clang-format-16` for code formatting.
2313

2414
### Full build
2515
Here are the steps to do a full-build of the library, run smoke tests, and to install the shared libraries:
2616

2717
```shell
28-
$ export COMPILER=gcc # or clang-13
18+
$ export COMPILER=gcc # or clang
2919
$ sudo apt update -y
3020
$ sudo apt install -y libaio-dev libconfig-dev libxxhash-dev $COMPILER
3121
$ export CC=$COMPILER

docs/site/content/docs/build.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,15 @@ To integrate SplinterDB into another application, see [Usage](usage.md).
77
Builds are known to work on Ubuntu using recent versions of GCC and Clang.
88

99
### Tooling
10-
In CI, we test against GCC 9 and Clang 13.
10+
In CI, we test against GCC 13 and Clang 16.
1111

12-
We use `clang-format-13` for code formatting.
13-
14-
To install `clang-13` tools on Ubuntu Linux, do this:
15-
16-
```shell
17-
$ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
18-
19-
$ sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
20-
21-
$ sudo apt-get install -y clang-13 clang-format-13
22-
```
12+
We use `clang-format-16` for code formatting.
2313

2414
### Full build
2515
Here are the steps to do a full-build of the library, run smoke tests, and to install the shared libraries:
2616

2717
```shell
28-
$ export COMPILER=gcc # or clang-13
18+
$ export COMPILER=gcc # or clang
2919
$ sudo apt update -y
3020
$ sudo apt install -y libaio-dev libconfig-dev libxxhash-dev $COMPILER
3121
$ export CC=$COMPILER

docs/site/content/docs/v0.0.1/build.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,15 @@ To integrate SplinterDB into another application, see [Usage](usage.md).
77
Builds are known to work on Ubuntu using recent versions of GCC and Clang.
88

99
### Tooling
10-
In CI, we test against GCC 9 and Clang 13.
10+
In CI, we test against GCC 13 and Clang 16.
1111

12-
We use `clang-format-13` for code formatting.
13-
14-
To install `clang-13` tools on Ubuntu Linux, do this:
15-
16-
```shell
17-
$ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
18-
19-
$ sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
20-
21-
$ sudo apt-get install -y clang-13 clang-format-13
22-
```
12+
We use `clang-format-16` for code formatting.
2313

2414
### Full build
2515
Here are the steps to do a full-build of the library, run smoke tests, and to install the shared libraries:
2616

2717
```shell
28-
$ export COMPILER=gcc # or clang-13
18+
$ export COMPILER=gcc # or clang
2919
$ sudo apt update -y
3020
$ sudo apt install -y libaio-dev libconfig-dev libxxhash-dev $COMPILER
3121
$ export CC=$COMPILER

examples/splinterdb_wide_values_example.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ main()
5555
int nrows = 0;
5656
// Insert few values doubling value-size for each new key inserted
5757
for (int val_len = 16; val_len <= USER_MAX_VALUE_SIZE;
58-
val_len <<= 1, nrows++) {
58+
val_len <<= 1, nrows++)
59+
{
5960
snprintf(key_buf, sizeof(key_buf), "Key with val_len=%d", val_len);
6061
memset(val_buf, 'z', val_len);
6162

@@ -83,7 +84,8 @@ main()
8384
// Lookup keys which have increasingly wider-values, using a small fixed size
8485
// output buffer. When necessary, memory will be allocated for wider values.
8586
for (int val_len = 16; val_len <= USER_MAX_VALUE_SIZE;
86-
val_len <<= 1, nrows++) {
87+
val_len <<= 1, nrows++)
88+
{
8789

8890
char key_buf[USER_MAX_KEY_SIZE];
8991
snprintf(key_buf, sizeof(key_buf), "Key with val_len=%d", val_len);

format-check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set -eu -o pipefail
99

1010
# different tool versions yield different results
1111
# so we standardize on this version
12-
TOOL="clang-format-13"
12+
TOOL="clang-format-16"
1313

1414
# Check if TOOL exists
1515
if ! command -v "$TOOL" &> /dev/null; then

src/btree.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ btree_create_leaf_incorporate_spec(const btree_config *cfg,
598598
return STATUS_NO_MEMORY;
599599
}
600600
if (btree_merge_tuples(
601-
cfg, tuple_key, oldmessage, &spec->msg.merged_message)) {
601+
cfg, tuple_key, oldmessage, &spec->msg.merged_message))
602+
{
602603
merge_accumulator_deinit(&spec->msg.merged_message);
603604
return STATUS_NO_MEMORY;
604605
} else {

src/clockcache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2172,7 +2172,8 @@ clockcache_get_internal(clockcache *cc, // IN
21722172
return TRUE;
21732173
case GET_RC_SUCCESS:
21742174
if (clockcache_get_entry(cc, entry_number)->page.disk_addr
2175-
!= addr) {
2175+
!= addr)
2176+
{
21762177
// this also means we raced with eviction and really lost
21772178
clockcache_dec_ref(cc, entry_number, tid);
21782179
return TRUE;

src/clockcache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "cache.h"
1414
#include "io.h"
1515

16-
//#define ADDR_TRACING
16+
// #define ADDR_TRACING
1717
#define TRACE_ADDR (UINT64_MAX - 1)
1818
#define TRACE_ENTRY (UINT32_MAX - 1)
1919

0 commit comments

Comments
 (0)