-
Notifications
You must be signed in to change notification settings - Fork 16
Introduce clang-tidy #920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce clang-tidy #920
Changes from all commits
5135288
c422b4c
61832cc
f53bc12
4eba32c
e7812ed
2bdd6e0
e20190a
33c1a13
a03a7eb
7cee0f3
11e4f11
8d0780c
fa748f6
a90acbf
968474e
33be336
0e7575f
86aadc3
ba18200
1d786d9
bcd629a
b267998
d3b2ec2
4a32887
c788b73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # SPDX-FileCopyrightText: 2025 Institute for Automation of Complex Power Systems, RWTH Aachen University | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| Checks: > | ||
| -*, | ||
| modernize-use-override, | ||
| WarningsAsErrors: '*' | ||
| HeaderFilterRegex: villas/.* | ||
| FormatStyle: file |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,7 @@ static const char *vfio_pci_irq_names[] = { | |
| Device::Device(const std::string &name, int groupFileDescriptor, | ||
| const kernel::devices::PciDevice *pci_device) | ||
| : name(name), fd(-1), attachedToGroup(false), groupFd(groupFileDescriptor), | ||
| info(), info_irq_vectors(), regions(), mappings(), pci_device(pci_device), | ||
| info(), info_irq_vectors(), regions(), mappings(), | ||
| log(Log::get("kernel:vfio:device")) { | ||
| if (groupFileDescriptor < 0) | ||
| throw RuntimeError("Invalid group file descriptor"); | ||
|
|
@@ -254,7 +254,7 @@ bool Device::pciEnable() { | |
| std::vector<Device::IrqVectorInfo> Device::initEventFds() { | ||
| std::vector<Device::IrqVectorInfo> vectors; | ||
| for (auto info_irq_vector : info_irq_vectors) { | ||
| Device::IrqVectorInfo irq = {0}; | ||
| Device::IrqVectorInfo irq = {.eventFds = {0}}; | ||
| const size_t irqCount = info_irq_vector.count; | ||
| const size_t irqSetSize = | ||
| sizeof(struct vfio_irq_set) + sizeof(int) * irqCount; | ||
|
|
@@ -296,7 +296,7 @@ std::vector<Device::IrqVectorInfo> Device::initEventFds() { | |
| return vectors; | ||
| } | ||
|
|
||
| int Device::pciMsiInit(int efds[]) { | ||
| int Device::pciMsiInit(int efds[32]) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not correct. The function does not work with a fixed length array.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But that is what the declaration of the function in the header says. The mismatch in declaration and definition signature breaks the clang build.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok sorry, didn't realize that. In the function itself, we don't do proper bounds checking.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell, this is the only one of your concerns that remains in the stripped-down version of this MR and wasn't addressed yet. I want to touch as little logic as possible here and therefore I'll do one of 2 things:
Please tell me which one you'd prefer and file an issue if you think that there's a bug here. |
||
| // Check if this is really a vfio-pci device | ||
| if (not isVfioPciDevice()) | ||
| return -1; | ||
|
|
@@ -341,7 +341,7 @@ int Device::pciMsiInit(int efds[]) { | |
| return irqCount; | ||
| } | ||
|
|
||
| int Device::pciMsiDeinit(int efds[]) { | ||
| int Device::pciMsiDeinit(int efds[32]) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also not correct. See above. |
||
| Log::get("Device")->debug("Deinitializing MSI interrupts for device {}", | ||
| name); | ||
| // Check if this is really a vfio-pci device | ||
|
|
@@ -381,7 +381,7 @@ int Device::pciMsiDeinit(int efds[]) { | |
| return irqCount; | ||
| } | ||
|
|
||
| bool Device::pciMsiFind(int nos[]) { | ||
| bool Device::pciMsiFind(int nos[32]) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also incorrect to specify the length here. |
||
| int ret, idx, irq; | ||
| char *end, *col, *last, line[1024], name[13]; | ||
| FILE *f; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.