-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add C compiler base options guidelines #63
base: wip/coding_guidelines
Are you sure you want to change the base?
Conversation
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
6709d42
to
ec00050
Compare
- The C11 version shall be used. | ||
|
||
Compiler options: `-std=c11`. | ||
MISRA C:2012 : R1.1 | ||
|
||
- No language extensions shall be allowed. | ||
|
||
Compiler options: `-pedantic -pedantic-errors`. | ||
MISRA C:2012 : R1.1 | ||
|
||
- Treat all warnings as errors so no warnings can be ignored. | ||
|
||
Compiler options: `-Werrors`. | ||
|
||
- Enable all recommended warnings. | ||
|
||
Compiler options: `-Wall -Wextra`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The C11 version shall be used. | |
Compiler options: `-std=c11`. | |
MISRA C:2012 : R1.1 | |
- No language extensions shall be allowed. | |
Compiler options: `-pedantic -pedantic-errors`. | |
MISRA C:2012 : R1.1 | |
- Treat all warnings as errors so no warnings can be ignored. | |
Compiler options: `-Werrors`. | |
- Enable all recommended warnings. | |
Compiler options: `-Wall -Wextra`. | |
R1. **The C11 version shall be used.** | |
- Compiler options: `-std=c11`. MISRA C:2012 : R1.1 | |
R2. **No language extensions shall be allowed.** | |
- Compiler options: `-pedantic -pedantic-errors`. MISRA C:2012 : R1.1 | |
R3. **Treat all warnings as errors so no warnings can be ignored.** | |
- Compiler options: `-Werrors`. | |
R4. **Enable all recommended warnings.** | |
- Compiler options: `-Wall -Wextra`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
both. If one compiler is supported for given project, it must be so for all | ||
supported target architectures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be too strict, for example for tricore
both. If one compiler is supported for given project, it must be so for all | ||
supported target architectures. | ||
|
||
For reach guideline we try to provide a set of compiler options which enforce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reach guideline we try to provide a set of compiler options which enforce | |
For each guideline we try to provide a set of compiler options which enforce |
- The C11 version shall be used. | ||
|
||
Compiler options: `-std=c11`. | ||
MISRA C:2012 : R1.1 | ||
|
||
- No language extensions shall be allowed. | ||
|
||
Compiler options: `-pedantic -pedantic-errors`. | ||
MISRA C:2012 : R1.1 | ||
|
||
- Treat all warnings as errors so no warnings can be ignored. | ||
|
||
Compiler options: `-Werrors`. | ||
|
||
- Enable all recommended warnings. | ||
|
||
Compiler options: `-Wall -Wextra`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
This PR introduces a set of guidelines on what options to use in the C compiler to be compliant with standard C11 and enable the base recommended warnings that will enforce a lot of the C guidelines that will be proposed next.
I'm wondering if this is the best way to indicate the compiler options, misra rules and checkers for each rule. Both structurally and formatting-wise. Please provide some feedback.
This PR is dependent on #62.
Checklist: