source source/periph
# Define C warning options here.
-CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -pedantic
+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -pedantic -Werror
# Define C++ warning options here.
-CPPWARN = -Wall -Wextra -Wundef -pedantic -Wno-volatile
+CPPWARN = -Wall -Wextra -Wundef -pedantic -Wno-volatile -Werror -Wconversion
#
# Project, target, sources and paths
# Custom rules
#
+check:
+ cppcheck --std=c++17 --enable=warning,style,performance,portability --force $(shell find source/ -name "*.cpp" -or -name "*.hpp" -or -name "*.c" -or -name "*.h" -type f)
+
+tidy:
+ clang-tidy \
+ -warnings-as-errors=* \
+ --extra-arg=-I --extra-arg=/usr/lib/gcc/arm-none-eabi/13/include/g++-v13 \
+ --extra-arg=-I --extra-arg=/usr/lib/gcc/arm-none-eabi/13/include/g++-v13/arm-none-eabi \
+ $(CPPSRC)
+
#
# Custom rules
##############################################################################
+
{
if (EM.assert(USBSerial::read(&cmd[1], 1) == 1, Error::BadParamSize)) {
if (cmd[1] == 0xFF) {
- unsigned char r = SClock::getRate();
+ auto r = static_cast<unsigned char>(SClock::getRate());
USBSerial::write(&r, 1);
} else {
auto r = static_cast<SClock::Rate>(cmd[1]);
samples = entry(samples, size);
asm("mov sp, %0" :: "r" (sp));
volatile auto testRead = *samples;
+ (void)testRead;
} else {
// Start execution timer:
asm("mov %0, sp; eor r0, r0; svc 2" : "=r" (sp));
// Stop execution timer:
asm("mov r0, #1; svc 2; mov sp, %0" :: "r" (sp));
volatile auto testRead = *samples;
+ (void)testRead;
}
}
* Handles the USB driver global events.\r
*/\r
static void usb_event(USBDriver *usbp, usbevent_t event) {\r
- extern SerialUSBDriver SDU1;\r
\r
switch (event) {\r
case USB_EVENT_ADDRESS:\r
}
__attribute__((section(".convcode")))
void SampleBuffer::modify(Sample *data, unsigned int srcsize) {
- auto size = srcsize < m_size ? srcsize : m_size;
- size = (size + 15) & (~15);
+ auto dsize = srcsize < m_size ? srcsize : m_size;
+ dsize = (dsize + 15) & (~15);
m_modified = m_buffer;
const int *src = reinterpret_cast<const int *>(data);
- const int * const srcend = src + (size / 2);
+ const int * const srcend = src + (dsize / 2);
int *dst = reinterpret_cast<int *>(m_buffer);
do {
int a = src[0];
}
__attribute__((section(".convcode")))
void SampleBuffer::midmodify(Sample *data, unsigned int srcsize) {
- auto size = srcsize < m_size / 2 ? srcsize : m_size / 2;
- size = (size + 15) & (~15);
+ auto dsize = srcsize < m_size / 2 ? srcsize : m_size / 2;
+ dsize = (dsize + 15) & (~15);
m_modified = middata();
const int *src = reinterpret_cast<const int *>(data);
- const int * const srcend = src + (size / 2);
+ const int * const srcend = src + (dsize / 2);
int *dst = reinterpret_cast<int *>(middata());
do {
int a = src[0];
{
public:
// Manage the sample data memory at 'buffer'.
- SampleBuffer(Sample *buffer);
+ explicit SampleBuffer(Sample *buffer);
/**
* Fill the current buffer with midpoint (2048/0V) values.