Skip to content

core: uncrustify#10867

Merged
kaspar030 merged 3 commits intoRIOT-OS:masterfrom
kaspar030:uncrustify_core
Mar 30, 2020
Merged

core: uncrustify#10867
kaspar030 merged 3 commits intoRIOT-OS:masterfrom
kaspar030:uncrustify_core

Conversation

@kaspar030
Copy link
Copy Markdown
Contributor

@kaspar030 kaspar030 commented Jan 25, 2019

Contribution description

This PR applies the current uncrustify-riot.cfg to core.
atomic_*.c are excluded due to too many misformattings in the macros.

Most of the changes are alright. My main pain point are string concatenations for inttype format macros, e.g.,

DEBUG("foo %"PRIu32"\n");

changes into

DEBUG("foo %" PRIu32 "\n");

(note the extra spaces between " and PRIu32.

But I can live with that.

Testing procedure

Check diff.

Issues/PRs references

@kaspar030 kaspar030 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: core Area: RIOT kernel. Handle PRs marked with this with care! CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jan 25, 2019
@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 25, 2019

Most of the changes are alright. My main pain point are string concatenations for inttype format macros, e.g.,

DEBUG("foo %"PRIu32"\n");

changes into

DEBUG("foo %" PRIu32 "\n");

(note the extra spaces between " and PRIu32.

But I can live with that.

I actually find the auto-formatted version more readable, but again, a matter of taste.

@kaspar030
Copy link
Copy Markdown
Contributor Author

I actually find the auto-formatted version more readable, but again, a matter of taste.

Yup. I'm OK with the auto-formatted version, too.

@kaspar030
Copy link
Copy Markdown
Contributor Author

I realized I'd forgotten the includes... They're uncrustified now, too.

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arghs .... sometimes I forget that I actually have to submit my review... here an older comment of mine (from before I added #10867 (comment))

*/
bool __atomic_compare_exchange_c(size_t len, void *ptr, void *expected,
void *desired, bool weak, int success_memorder, int failure_memorder)
void *desired, bool weak, int success_memorder, int failure_memorder)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was delivered by uncrustify this way? int failure_memorder could (and should) be on the next line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like our uncrustify config doesn't do line wrapping at all. I've pushed a change to make it do it.

It feels quite intrusive... ;)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels quite intrusive... ;)

If it formats it this way it's plain wrong though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it formats it this way it's plain wrong though.

Hmyeah. I tried limiting uncrustify's line wrap to 100 cols. It prevents this mishap.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative is setting ls_func_split_full, which results in this (if a line is longer than the configured limit):

-bool __atomic_compare_exchange_c(size_t len, void *ptr, void *expected,
-                                 void *desired, bool weak, int success_memorder, int failure_memorder)
+bool __atomic_compare_exchange_c(size_t len,
+                                 void *ptr,
+                                 void *expected,
+                                 void *desired,
+                                 bool weak,
+                                 int success_memorder,
+                                 int failure_memorder)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't like that style (and only use it if everything else doesn't make sense stylistically)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've split out the 100char config change into another PR: #10873

@kaspar030 kaspar030 removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 25, 2019
@smlng smlng added the State: waiting for other PR State: The PR requires another PR to be merged first label Feb 5, 2019
@stale
Copy link
Copy Markdown

stale bot commented Aug 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Aug 10, 2019
@stale stale bot removed the State: stale State: The issue / PR has no activity for >185 days label Aug 19, 2019
@kaspar030 kaspar030 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Aug 19, 2019
@kaspar030
Copy link
Copy Markdown
Contributor Author

@miri64 should we go forward with this?

@miri64
Copy link
Copy Markdown
Member

miri64 commented Aug 28, 2019

I do think so. I put it on my TODO list ;-).

@kaspar030
Copy link
Copy Markdown
Contributor Author

ping this is purely cosmetic. :)

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping this is purely cosmetic. :)

True, still found some nits though :-)

"sched_run: active thread: %" PRIkernel_pid ", next thread: %" PRIkernel_pid "\n",
(kernel_pid_t)((active_thread ==
NULL) ? KERNEL_PID_UNDEF : active_thread->pid),
next_thread->pid);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also (but unrelated to this PR): Is the cast really necessary?

@miri64
Copy link
Copy Markdown
Member

miri64 commented Oct 29, 2019

@kaspar030 ping?

@kaspar030
Copy link
Copy Markdown
Contributor Author

@kaspar030 ping?

Thanks for the heads up. I've addressed most issues and re-ran uncrustify.
There are some alignments in core/include/byteorder.h that seem broken. I'm about to add the ignore statements to the whole file. What do you think?

@miri64
Copy link
Copy Markdown
Member

miri64 commented Oct 29, 2019

I'm about to add the ignore statements to the whole file. What do you think?

If it is properly ended, go ahead :-).

@miri64
Copy link
Copy Markdown
Member

miri64 commented Oct 29, 2019

There are some alignments in core/include/byteorder.h that seem broken. I'm about to add the ignore statements to the whole file. What do you think?

Mhh.. after looking at the current proposal, I'm not sure what you mean. Can you point me to that?

@kaspar030
Copy link
Copy Markdown
Contributor Author

@miri64 I've rebased this, it is otherwise unchanged. Let's find a shorter you-look-I-react cycle.

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment remaining

Comment on lines +125 to +126
`st >= STATUS_ON_RUNQUEUE`
*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks weird. Any idea why uncrustify is doing this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think actually I did this, must be a merge leftover. Will fix.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. Now uncrustify just realignes the second line a bit.

@kaspar030
Copy link
Copy Markdown
Contributor Author

  • fixed comment, rebased

@miri64
Copy link
Copy Markdown
Member

miri64 commented Mar 30, 2020

ACK! Let's finally merge this!

@kaspar030 kaspar030 merged commit 9de2ff7 into RIOT-OS:master Mar 30, 2020
@kaspar030 kaspar030 deleted the uncrustify_core branch March 30, 2020 19:24
@kaspar030
Copy link
Copy Markdown
Contributor Author

Thanks @miri64!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: core Area: RIOT kernel. Handle PRs marked with this with care! CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants