Feature/fixing clang gnu compiler warnings - #620
Conversation
…om freertos_kernel_port (FreeRTOS#558)
…efault PORT selection for native POSIX and MINGW platforms.
… it from a FREERTOS_CONFIG_FILE_DIRECTORY.
…gnu-compiler-warnings
|
Looks like this is in hand already, some notes all the same:
|
Fixed with latest commit.
This can be done by running a clang compile with the following compile options: add_compile_options(
### C Based Language and ID.
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wpedantic>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>
)the -Wdocumentation-* checks validity of doxygen information - i.e. invalid or missing params, and wrong usage of doxygen. You can also run Doxygen on the entire suite of C files using CMake and have warnings as errors defined when attempting to create the documentation as one of the build steps. |
|
Some checks are failing likely because of the syntax error in timers.c. Please look into the failed checks. Thank you again for your contribution. |
…g-tidy instead if you want this level of control.
|
@RichardBarry and @aggarg - the changes requested have all been performed and the unit tests now pass. I'd suggest adding a build with clang and would also suggest using clang-tidy on this code base as well. |
|
Ping @RichardBarry and @aggarg . Would like to no longer maintain the fork that I have in use, so please approve at your earliest convenience. |
Codecov ReportBase: 94.30% // Head: 94.34% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #620 +/- ##
==========================================
+ Coverage 94.30% 94.34% +0.03%
==========================================
Files 6 6
Lines 2370 2368 -2
Branches 579 578 -1
==========================================
- Hits 2235 2234 -1
Misses 85 85
+ Partials 50 49 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
| */ | ||
| static portTASK_FUNCTION( prvIdleTask, pvParameters ) | ||
|
|
||
| portTASK_FUNCTION( prvIdleTask, pvParameters ) |
There was a problem hiding this comment.
Note code coverage for this line is not expected. There is no change except to remove the static from the function definition because it is already defined in the function declaration. Please waive changed CodeCov.
| { | ||
| BaseType_t xReturn; | ||
| UBaseType_t uxSavedInterruptStatus; | ||
| portBASE_TYPE xSavedInterruptStatus; |
There was a problem hiding this comment.
Note only changing the type here because the original had an incorrect type. These are defined by the port types - portBaseType and not by the kernel types - UBaseType_t. Please waive changed CodeCov .
commented
Feb 23, 2023
Apologies for the delay. Will get it done today. |
commented
Feb 23, 2023
|
Thank you for your contribution. |
|
|
||
| ######################################################################## | ||
| # Requirements | ||
| set(CMAKE_C_STANDARD 99) |
There was a problem hiding this comment.
@phelter Why do you need C99? We want to support C89. Did you notice anything C99 specific in the kernel?
There was a problem hiding this comment.
@aggarg - Yes- there were several cases of: C90 ISO violations of declaration after statement. See: https://clang.llvm.org/docs/DiagnosticsReference.html#wdeclaration-after-statement These may have since been updated.
These can be detected using clang-14 compiles by setting the compile options in the description of this PR.
Feel free to change back to C90 if/when those are updated. I am unaware of any others.
There was a problem hiding this comment.
Thank you for the clarification. I did build the kernel with -Wdeclaration-after-statement and I see no warning from kernel source. I will remove the following 2 lines which were added in this PR -
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
Fixing majority of the clang compiler warnings.
Description
Fixed majority of clang and gnu compiler warnings. Primary ones are:
List of compiler warnings goes from:
To:
Test Steps
Compile with:
Related Issue
Tried to have this list in the CMakeLists.txt originally in PR #571, but was overruled, so reducing list for future checks.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.