Skip to content

Commit 2d87932

Browse files
author
Colin Davidson
committed
[CI][CLANG-FORMAT] Switch to clang-20-format
This keeps it in line with upstream dpc++
1 parent d729283 commit 2d87932

88 files changed

Lines changed: 4667 additions & 4058 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/run_ock_internal_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ jobs:
172172

173173
- name: setup-ubuntu-clang-format
174174
run:
175-
pip install clang-format==19.1.0
175+
pip install clang-format==20.1.0
176176

177177
- name: run clang-format
178178
run: |
179-
# we've installed clang-format-19 in the docker via pip, which just installs it as clang-format,
179+
# we've installed clang-format-20 in the docker via pip, which just installs it as clang-format,
180180
# so just use clang-format-diff and -b clang-format directly
181181
git fetch origin ${{ github.base_ref }}
182182
git diff --no-color origin/${{ github.base_ref }} | \

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,12 @@ find_package(PythonInterp 3.6 REQUIRED)
197197
# which perform static analysis and style checking on source files.
198198
# When updating the version here, also update that used in the merge request
199199
# config
200-
find_package(ClangTools 19 COMPONENTS clang-format clang-tidy)
200+
find_package(ClangTools 19 COMPONENTS clang-tidy)
201+
if(TARGET ClangTools::clang-tidy)
202+
ca_option(CA_CLANG_TIDY_FLAGS STRING
203+
"Semi-color separated list of clang-tidy flags" "")
204+
endif()
205+
find_package(ClangTools 20 COMPONENTS clang-format)
201206
if(TARGET ClangTools::clang-tidy)
202207
ca_option(CA_CLANG_TIDY_FLAGS STRING
203208
"Semi-color separated list of clang-tidy flags" "")

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ To install the dependencies on Ubuntu, open the terminal and run:
4545

4646
### Recommended packages
4747
* [Ninja](https://ninja-build.org/)
48-
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html) 16
48+
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html) 20
4949
* [lit](https://llvm.org/docs/CommandGuide/lit.html)
5050

5151
To install the recommended packages, run:
5252
```sh
5353
$ sudo apt install -y ninja-build doxygen python3-pip
54-
$ sudo pip3 install lit virtualenv cmakelint clang-format==19.1.0
54+
$ sudo pip3 install lit virtualenv cmakelint clang-format==20.1.0
5555
```
5656

5757
### Compiling oneAPI Construction Kit

clik/external/hal_cpu/include/device/kernel_if.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ static uintptr_t start_dma(void *dst, const void *src, size_t size_in_bytes,
8383
return xfer_id;
8484
}
8585

86-
static void wait_dma(uintptr_t xfer_id, struct exec_state *e) { /* No-op */
87-
}
86+
static void wait_dma(uintptr_t xfer_id, struct exec_state *e) { /* No-op */ }
8887

8988
#endif // _HAL_CPU_KERNEL_IF_H

clik/external/hal_cpu/source/hal_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class cpu_hal_platform : public hal::hal_t {
5757

5858
cpu_hal_platform() {
5959
hal_device_info = &cpu_hal::setup_cpu_hal_device_info();
60-
60+
6161
static constexpr uint32_t implemented_api_version = 6;
6262
static_assert(implemented_api_version == hal_t::api_version,
6363
"Implemented API version for CPU HAL does not match hal.h");

examples/hals/hal_refsi_tutorial/include/device/io_impl.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ uintptr_t start_dma(void *dst, const void *src, size_t size_in_bytes,
101101
return xfer_id;
102102
}
103103

104-
void wait_dma(uintptr_t xfer_id, struct exec_state *state) { /* No-op */
105-
}
104+
void wait_dma(uintptr_t xfer_id, struct exec_state *state) { /* No-op */ }
106105
#endif // defined(HAL_REFSI_TARGET_M1)
107106

108107
int vsnprint(char *out, size_t n, const char *s, va_list vl) {
@@ -137,8 +136,7 @@ int vsnprint(char *out, size_t n, const char *s, va_list vl) {
137136
if (++pos < n) out[pos - 1] = '-';
138137
}
139138
long digits = 1;
140-
for (long nn = num; nn /= 10; digits++)
141-
;
139+
for (long nn = num; nn /= 10; digits++);
142140
for (int i = digits - 1; i >= 0; i--) {
143141
if (pos + i + 1 < n) out[pos + i] = '0' + (num % 10);
144142
num /= 10;

examples/refsi/hal_refsi/external/refsidrv/include/common/common_devices.h

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ inline unit_kind get_unit_kind(unit_id_t unit_id) {
5858

5959
/// @brief Retrieve the 'index' part of a unit ID. This could be for example the
6060
/// hart ID if the unit refers to a hart.
61-
inline uint16_t get_unit_index(unit_id_t unit_id) {
62-
return (unit_id & 0xffff);
63-
}
61+
inline uint16_t get_unit_index(unit_id_t unit_id) { return (unit_id & 0xffff); }
6462

6563
/// @brief Return a textual representation of the unit ID.
6664
std::string format_unit(unit_id_t unit_id);
@@ -145,7 +143,7 @@ class MemoryDeviceBase : public MemoryDevice {
145143
/// device's base address. This base address is used to query the memory
146144
/// interface for the sub-device which 'lives' at a specified address.
147145
class MemoryInterface : public MemoryDevice {
148-
public:
146+
public:
149147
/// @brief Query the memory interface for a device at the given address.
150148
/// @param addr Address to query for a device.
151149
/// @param dev_offset On success, offset from the returned device's base
@@ -156,7 +154,7 @@ class MemoryInterface : public MemoryDevice {
156154
/// @brief Utility class to help manage a set of devices under the same address
157155
/// space. Devices can be added and removed dynamically.
158156
class MemoryController : public MemoryInterface {
159-
public:
157+
public:
160158
/// @brief Create a new memory controller with no sub-devices.
161159
MemoryController() {}
162160

@@ -169,7 +167,7 @@ class MemoryController : public MemoryInterface {
169167
/// another device is already using the base address.
170168
/// @param addr Base address of the device, i.e. where it will be mapped.
171169
/// @param dev Device to add to map in the memory controller.
172-
bool add_device(reg_t addr, MemoryDevice* dev);
170+
bool add_device(reg_t addr, MemoryDevice *dev);
173171

174172
/// @brief Remove (unmap) a device from the memory controller, given its exact
175173
/// base address.
@@ -182,10 +180,10 @@ class MemoryController : public MemoryInterface {
182180
/// region.
183181
/// @param addr Address to use to locate the device.
184182
/// @return Pair of (base address, memory device) on success.
185-
std::pair<reg_t, MemoryDevice*> find_device(reg_t addr);
183+
std::pair<reg_t, MemoryDevice *> find_device(reg_t addr);
186184

187185
/// @brief Return a read-only map of the mapped devices.
188-
const std::map<reg_t, MemoryDevice*> & get_devices() { return devices; }
186+
const std::map<reg_t, MemoryDevice *> &get_devices() { return devices; }
189187

190188
/// @brief Try to find a device mapped at the given address, which does not
191189
/// need to be the base address but can point anywhere in the device's memory
@@ -218,7 +216,7 @@ class MemoryController : public MemoryInterface {
218216
/// be nullptr.
219217
/// @param unit ID of the execution unit requesting the memory access.
220218
/// @return true on success and false on failure.
221-
bool load(reg_t addr, size_t len, uint8_t* bytes, unit_id_t unit) override;
219+
bool load(reg_t addr, size_t len, uint8_t *bytes, unit_id_t unit) override;
222220

223221
/// @brief Try to write data to the device. This is equivalent to calling
224222
/// @ref find_device followed by @ref store on the returned device,
@@ -228,7 +226,7 @@ class MemoryController : public MemoryInterface {
228226
/// @param bytes Data to write to the device - must not be nullptr.
229227
/// @param unit ID of the execution unit requesting the memory access.
230228
/// @return true on success and false on failure.
231-
bool store(reg_t addr, size_t len, const uint8_t* bytes,
229+
bool store(reg_t addr, size_t len, const uint8_t *bytes,
232230
unit_id_t unit) override;
233231

234232
/// @brief Try to copy data from one area of memory to another.
@@ -239,16 +237,14 @@ class MemoryController : public MemoryInterface {
239237
/// @return true on success and false on failure.
240238
bool copy(reg_t dst_addr, reg_t src_addr, size_t len, unit_id_t unit);
241239

242-
private:
243-
std::map<reg_t, MemoryDevice*> devices;
240+
private:
241+
std::map<reg_t, MemoryDevice *> devices;
244242
};
245243

246244
class RAMDevice : public MemoryDeviceBase {
247245
public:
248-
RAMDevice (size_t size);
249-
virtual ~RAMDevice() {
250-
free(data);
251-
}
246+
RAMDevice(size_t size);
247+
virtual ~RAMDevice() { free(data); }
252248

253249
uint8_t *contents() { return data; }
254250
size_t mem_size() const override { return size; }
@@ -262,9 +258,7 @@ class RAMDevice : public MemoryDeviceBase {
262258

263259
class ROMDevice : public MemoryDeviceBase {
264260
public:
265-
ROMDevice (size_t size) {
266-
data.resize(size);
267-
}
261+
ROMDevice(size_t size) { data.resize(size); }
268262

269263
uint8_t *contents() { return data.data(); }
270264
size_t mem_size() const override { return data.size(); }
@@ -280,47 +274,47 @@ class ROMDevice : public MemoryDeviceBase {
280274
};
281275

282276
class HartLocalDevice : public MemoryDeviceBase {
283-
public:
277+
public:
284278
HartLocalDevice(size_t size) : size(size) {}
285279
virtual ~HartLocalDevice();
286280

287281
uint8_t *addr_to_mem(reg_t addr, size_t size, unit_id_t unit_id) override;
288282

289-
uint8_t* mem_contents(unit_id_t unit_id);
283+
uint8_t *mem_contents(unit_id_t unit_id);
290284
size_t mem_size() const override { return size; }
291285

292-
private:
286+
private:
293287
size_t size;
294288
std::vector<uint8_t *> hart_contents;
295289
};
296290

297291
class FileDevice : public MemoryDevice {
298-
public:
292+
public:
299293
FileDevice(const char *path);
300294
virtual ~FileDevice();
301295

302296
bool is_open() const { return fd >= 0; }
303297

304298
size_t mem_size() const override;
305299

306-
bool load(reg_t addr, size_t len, uint8_t* bytes, unit_id_t unit_id) override;
307-
bool store(reg_t addr, size_t len, const uint8_t* bytes,
300+
bool load(reg_t addr, size_t len, uint8_t *bytes, unit_id_t unit_id) override;
301+
bool store(reg_t addr, size_t len, const uint8_t *bytes,
308302
unit_id_t unit_id) override;
309303

310-
private:
304+
private:
311305
int fd;
312306
};
313307

314308
class BufferDevice : public MemoryDeviceBase {
315-
public:
309+
public:
316310
BufferDevice(const void *data, size_t size) : data(data), size(size) {}
317311

318312
size_t mem_size() const override { return size; }
319313

320314
uint8_t *addr_to_mem(reg_t dev_offset, size_t size,
321315
unit_id_t unit_id) override;
322316

323-
private:
317+
private:
324318
const void *data;
325319
size_t size;
326320
};

examples/refsi/hal_refsi/external/refsidrv/include/common/elf_loader.h

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,16 @@
1818
#define _REFSIDRV_COMMON_ELF_LOADER_H
1919

2020
#include <map>
21-
#include <vector>
2221
#include <string>
22+
#include <vector>
2323

24-
#include "riscv/devices.h"
2524
#include "common_devices.h"
2625
#include "fesvr/elf.h"
26+
#include "riscv/devices.h"
2727

2828
using symbol_map = std::map<std::string, reg_t>;
2929

30-
enum class elf_machine {
31-
unknown = 0,
32-
riscv_rv32 = 1,
33-
riscv_rv64 = 2
34-
};
30+
enum class elf_machine { unknown = 0, riscv_rv32 = 1, riscv_rv64 = 2 };
3531

3632
struct elf_segment {
3733
uint64_t address;
@@ -41,26 +37,24 @@ struct elf_segment {
4137
};
4238

4339
class ELFProgram {
44-
public:
40+
public:
4541
~ELFProgram();
4642

4743
elf_machine get_machine() const;
4844

49-
bool read(MemoryDevice &src,
50-
unit_id_t unit = make_unit(unit_kind::external));
51-
bool load(MemoryDevice &dst,
52-
unit_id_t unit = make_unit(unit_kind::external));
45+
bool read(MemoryDevice &src, unit_id_t unit = make_unit(unit_kind::external));
46+
bool load(MemoryDevice &dst, unit_id_t unit = make_unit(unit_kind::external));
5347
void clear();
5448

55-
const std::vector<elf_segment> & get_segments() const { return segments; }
56-
const symbol_map & get_symbols() const { return symbols; }
49+
const std::vector<elf_segment> &get_segments() const { return segments; }
50+
const symbol_map &get_symbols() const { return symbols; }
5751
uint64_t get_entry_address() const { return entry_address; }
5852

5953
reg_t find_symbol(const char *name) const;
6054

6155
static constexpr uint64_t invalid_address = ~0ull;
6256

63-
private:
57+
private:
6458
bool read_header(MemoryDevice &src, unit_id_t unit);
6559
bool read_program_header(Elf64_Phdr &program_header, MemoryDevice &src,
6660
unit_id_t unit, uint64_t offset);

examples/refsi/hal_refsi/external/refsidrv/include/device/dma_regs.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@
1717
#ifndef _REFSIDRV_DEVICE_DMA_REGS_H
1818
#define _REFSIDRV_DEVICE_DMA_REGS_H
1919

20-
#define REFSI_REG_DMACTRL 0x00
21-
#define REFSI_REG_DMASTARTSEQ 0x01
22-
#define REFSI_REG_DMADONESEQ 0x02
23-
#define REFSI_REG_DMASRCADDR 0x03
24-
#define REFSI_REG_DMADSTADDR 0x04
25-
#define REFSI_REG_DMAXFERSIZE0 0x05
26-
#define REFSI_REG_DMAXFERSRCSTRIDE0 0x08
27-
#define REFSI_REG_DMAXFERDSTSTRIDE0 0x0a
28-
29-
#define REFSI_DMA_REG_ADDR(base, reg) ((base) + ((reg) << 3))
30-
#define REFSI_DMA_GET_REG(base, addr) (((addr) - (base)) >> 3)
31-
#define REFSI_DMA_NUM_REGS 0x20
32-
33-
#define REFSI_DMA_IO_ADDRESS 0x20002000
34-
#define REFSI_DMA_IO_END_ADDRESS 0x20002100
35-
36-
#define REFSI_DMA_START 0x01
37-
38-
#define REFSI_DMA_1D 0x10
39-
#define REFSI_DMA_2D 0x20
40-
#define REFSI_DMA_3D 0x30
41-
#define REFSI_DMA_DIM_MASK 0x30
42-
43-
#define REFSI_DMA_STRIDE_NONE 0x00
44-
#define REFSI_DMA_STRIDE_DST 0x40
45-
#define REFSI_DMA_STRIDE_SRC 0x80
46-
#define REFSI_DMA_STRIDE_BOTH ((REFSI_DMA_STRIDE_DST) | (REFSI_DMA_STRIDE_SRC))
47-
#define REFSI_DMA_STRIDE_MODE_MASK REFSI_DMA_STRIDE_BOTH
48-
49-
#endif // _REFSIDRV_DEVICE_DMA_REGS_H
20+
#define REFSI_REG_DMACTRL 0x00
21+
#define REFSI_REG_DMASTARTSEQ 0x01
22+
#define REFSI_REG_DMADONESEQ 0x02
23+
#define REFSI_REG_DMASRCADDR 0x03
24+
#define REFSI_REG_DMADSTADDR 0x04
25+
#define REFSI_REG_DMAXFERSIZE0 0x05
26+
#define REFSI_REG_DMAXFERSRCSTRIDE0 0x08
27+
#define REFSI_REG_DMAXFERDSTSTRIDE0 0x0a
28+
29+
#define REFSI_DMA_REG_ADDR(base, reg) ((base) + ((reg) << 3))
30+
#define REFSI_DMA_GET_REG(base, addr) (((addr) - (base)) >> 3)
31+
#define REFSI_DMA_NUM_REGS 0x20
32+
33+
#define REFSI_DMA_IO_ADDRESS 0x20002000
34+
#define REFSI_DMA_IO_END_ADDRESS 0x20002100
35+
36+
#define REFSI_DMA_START 0x01
37+
38+
#define REFSI_DMA_1D 0x10
39+
#define REFSI_DMA_2D 0x20
40+
#define REFSI_DMA_3D 0x30
41+
#define REFSI_DMA_DIM_MASK 0x30
42+
43+
#define REFSI_DMA_STRIDE_NONE 0x00
44+
#define REFSI_DMA_STRIDE_DST 0x40
45+
#define REFSI_DMA_STRIDE_SRC 0x80
46+
#define REFSI_DMA_STRIDE_BOTH ((REFSI_DMA_STRIDE_DST) | (REFSI_DMA_STRIDE_SRC))
47+
#define REFSI_DMA_STRIDE_MODE_MASK REFSI_DMA_STRIDE_BOTH
48+
49+
#endif // _REFSIDRV_DEVICE_DMA_REGS_H

examples/refsi/hal_refsi/external/refsidrv/include/device/host_io_regs.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#ifndef _REFSIDRV_DEVICE_HOST_IO_REGS_H
1818
#define _REFSIDRV_DEVICE_HOST_IO_REGS_H
1919

20-
#define HOST_IO_CMD_EXIT 0
21-
#define HOST_IO_CMD_PUTSTRING 1
22-
#define HOST_IO_CMD_BARRIER 2
20+
#define HOST_IO_CMD_EXIT 0
21+
#define HOST_IO_CMD_PUTSTRING 1
22+
#define HOST_IO_CMD_BARRIER 2
2323

24-
#endif // _REFSIDRV_DEVICE_HOST_IO_REGS_H
24+
#endif // _REFSIDRV_DEVICE_HOST_IO_REGS_H

0 commit comments

Comments
 (0)