When adding the #pragma once after a comment block, many editors
will remain at the previous indentation level, adding a leading
whitespace to the #pragma once. This is invalid, but causes the
headerguards check to fail. Since it is a common issue, it
warrants a separate check with a proposed solution, just like
for other headerguard issues that are checked.
- Iterate of different lengths of unsorted data to also cover corner case
one-item list
- Actually check that the list is sorted afterwards (and not just that
the maximum got sorted in last)
- Actually check that the list was stable-sorted (as the API doc
promises a stable sort)
- Increase the length of the input data for better test coverage
- Check that no elements get lost while sorting
Co-authored-by: crasbe <crasbe@gmail.com>
For a select set of boards, enable static analysis. The cost of static
analysis in terms of CPU time is quite significant, so we try to get
the most out of as little extra CPU time as possible by having it
enabled only a small set of popular boards.
This adds `STATIC_ANALYSIS` awareness to the ZSH completion, so that
enabling static analysis is made easier for zsh users who use the
completion snippet.
Now that static analysis is supported (for some modules), we need to
add awareness for that flag to compile_commands.py: As the flag is
not supported by LLVM, we strip it off in clangd mode (e.g. for
`make compile-commands`).
Modules can now add the following snipped to their `Makefile`:
MODULE_SUPPORTS_STATIC_ANALYSIS := 1
When the application is then build with `make STATIC_ANALYSIS=1`, all
modules that opted in to static analysis get build with static analysis.
This fixes compilation with `-fanalyzer`. We use `assume()` to signal
GCC that `thread` must not be null in `NDEBUG` mode, and `assert()` it
in with enabled assertions.
This also drops the `volatile` qualifier from the function argument and
changes the return value to `bool`.
Rather than using an `assert()` on `thread_get()`, check for the thread
to exist and return a capacity of `0` if it does not.
This fixes compilation with `-fanalyzer` with `NDEBUG` defined, is more
consistent with other core APIs, and makes the API usable for threads
with a dynamic life cycle.
Co-authored-by: crasbe <crasbe@gmail.com>
Replace elf2uf2 usage with picotool, fix compilation when arm g++ is installed, adjust documentation to new workflow, picotool udev warning (thanks to crasbe)
Adding a ztimer configuration that forces the use of frequency conversion
will greatly improve timing accuracy, as the frequency detected at
runtime will just be too much off from the nominal 1 MHz to run without
frequency conversion.
This makes use of the `periph_timer_query_freqs` feature:
1. It does choose the closest frequency supported before calling
timer_init() in the ztimer_periph_timer backend.
2. It does make use of the actually chosen frequency when using
`ztimer_convert_frac`.
3. It does `assert()` the frequency is within 5% of the specified when
no frequency conversion is performed or `ztimer_convert_shift_up`
is used.
This now ensures race-free access to the CIB tracking the number
of messages queued in the ringbuffer for a given thread.
In addition, `msg_avail_thread()` now checks if the provided pid refers
to a thread that is currently existing.
Co-authored-by: Mikolai Gütschow <mikolai.guetschow@tu-dresden.de>