-
Notifications
You must be signed in to change notification settings - Fork 3k
AStyle : drivers/hal/platform folders update #7008
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
Conversation
I fixed the rebase error, now compiles as it should ! :-) |
Gonna need another rebase. |
Rebased and updated ( I run astyle again to check if 3 folders that I am touching here are up to date with astyle). |
Note, I'll rebase this as final rebase once I get approvals (otherwise I daily rebase and those conflicts are not that simple sometimes as I have to run astyle for all conflicts over again). |
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.
A couple of comments and questions, one of which I really care about.
case HalfDuplex100 : speed = 1; duplex = 0; break; | ||
case FullDuplex100 : speed = 1; duplex = 1; break; | ||
switch (mode) { | ||
case AutoNegotiate : |
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.
Do case statements need braces?
Also, should the space between case <name> :
not be there?
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.
Do case statements need braces?
No.
Also, should the space between case : not be there?
Yes, seems like astyle bug! (it uses the same formatting as previous one).
delete _chains[i]; | ||
} |
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'm just going to assume this corresponds to the brace on line 75.
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.
Part of NULL check, line 79
_mode(0), | ||
_hz(1000000), | ||
_write_fill(SPI_FILL_CHAR) | ||
{ |
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.
This brace set feels like it should have an intentation.
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.
function body, no indentation needed
} | ||
} | ||
|
||
uint32_t mbed_itm_send(uint32_t port, uint32_t data) | ||
{ | ||
/* Check if ITM and port is enabled */ | ||
if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ | ||
((ITM->TER & (1UL << port) ) != 0UL) ) /* ITM Port enabled */ | ||
{ | ||
((ITM->TER & (1UL << port)) != 0UL)) { /* ITM Port enabled */ |
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.
This style change actually upsets me.
Imo, its much easier to read multiline conditional statements when the left parenthesis are aligned based on their parenthesis depth level. This change throws all of that out the window.
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.
That is the default behavior we use (no config in the astylerc, neither in our code style guide for this). Parameters are aligned if on multilines but conditions are indented.
The config to check for this is --min-conditional-indent=# / -m#
.
Rebased to resolve conflicts . |
@ARMmbed/mbed-os-maintainers Would anyone else like to review? |
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 is some inconsistencies with block comments for functions and structure members.
For example the comments lines 84-85 in Driver_Storage.h
should be aligned with the comment line 83 as they are part of the same member documentation.
And this function doc should probably aligned like the others.
Also I know it is part of K&R but as we already have 2 exceptions to the rules, one for the function's opening brace's new line would be good to me.
The line return doesn't help much readability while artificially increasing LOC count.
It should be consistent with other blocks indentation (for
/while
/if
/else
).
@ithinuel Driver_Storage changes seems to be a bug in AStyle, astyle do not format doxygen. See the bug report: https://sourceforge.net/p/astyle/bugs/409/ - Won't fix. Here are my findings: If I change the style for the comment, this stays as it is (line 2 is intentionally misalinged to check if it aligns it or leaves it) :
From the astyle docs: no doxygen mentioned in the documentation (no option there available). There are 3 tickets in the issue tracker that are related to doxygen, none resolved. I assume AStyle treats ///< as a code comment (
It touches CRC header file just because it uses 5 spaces so aligns it to 4. But does not touch comments (no doxygen support). Looks fine. Formatting doxygen is out of scope for AStyle. To resolve the Storage problem, either ignore that file (its deprecated anyway, I should probably not do any style changes. I'll revert them) or use other doxygen formatting (as shown above
I dont follow. |
I rebased. |
Rebased again ! up to date |
Deprecated API thus no changes there
This reduces currently from 913 files needs code style update to 790 . |
/morph build |
Build : SUCCESSBuild number : 2477 Triggering tests/morph test |
Test : SUCCESSBuild number : 2254 |
Exporter Build : SUCCESSBuild number : 2116 |
@ithinuel Are you all good with the changes? |
Description
This depends on #7007 (first 2 commits here are from that PR, will be rebased) . Applied to drivers/hal/platform folders. Up for review to see how astyle formats the code .
Not critical for 5.9, can come right after the code freeze so wont cause much rebasing (styling changes, should not change any behavior!)
This will need to be rebase as there are couple of PR changing this folders, will do final rebase once approved, thus please look at changes to check the style - the very important
Pull request type