-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sys/shell: convert shell_commands.c commands to use XFA #16095
Conversation
185b452
to
69651d2
Compare
Doh,
(I somehow assumed that shell command names could become symbol names) |
Another reason why auto-generating shell handler names might not be desirable. I personally prefer hyphened commands over underdashed commands. They seem subjectively less "clunky". |
I found two hyphened shell commands in-tree ( Having the shell command name adhere to C symbol naming rules has the huge advantage of being able to let the linker sort them alphanumerically. I'd like to go without hyphens / C symbol nameing rules for now. |
The value of a string has influence on the linker's sorting order? I somehow doubt that. The variable names do not change with my proposal. |
I would prefer on the other hand, that characters beyond |
It can also quickly lead to inconsistencies since app shell commands (which I assume will still use the old style of command declaration) will be allowed to have those characters (since they are not checked by the compile), while build-in commands are not allowed to have those characters. |
@miri64 your proposal seems doable. For now I changed the only builtin command ( |
Ok. |
Unless tests fail due to this ;-). |
f29f73f
to
20c0427
Compare
|
|
no, without your proposal, XFA's get sorted by symbol name. If they're equal to the string representation of a command, this sorts shell commands in the same order. |
Let's hope it does not fall on our foot elsewhere ... ;-) |
what do you have in mind? |
I just had an experience, where a simple addition let to explosions elsewhere where I was not anticipating it... |
Needs rebase now. |
This reverts commit d9cda53.
b866b7a
to
cb25c8d
Compare
|
LGTM now. I started a release test run on this PR to get some coverage on the shell commands. Would be great if @fjmolinas could also run TRIBE on this. I wait for my final ACK until some order of operation regarding #16135 (comment) was figured out. |
Until then, I also started a run on the testbed |
Failed for unrelated reasons in task 1.2 and 1.3 (also occured during the latest weekly) 01-ci.test_spec01
nodes = [<riotctrl.ctrl.RIOTCtrl object at 0x7faa55d576d0>], log_nodes = True riotbase = '/home/runner/work/RIOT/RIOT/RIOT' Stdout
--------------------------------- Captured Log --------------------------------- Stderr
--------------------------------- Captured Err --------------------------------- make: *** [/home/runner/work/RIOT/RIOT/RIOT/makefiles/tests/tests.inc.mk:22: test] Error 1
nodes = [<riotctrl.ctrl.RIOTCtrl object at 0x7faa55d12250>], log_nodes = True riotbase = '/home/runner/work/RIOT/RIOT/RIOT', test_suite = 'tests-rtc' Stdout
--------------------------------- Captured Log --------------------------------- Stderr --------------------------------- Captured Err --------------------------------- make: *** [/home/runner/work/RIOT/RIOT/RIOT/makefiles/tests/tests.inc.mk:22: test] Error 1 |
|
The fails there also seem unrelated and fail as far as I can tell also in the latest weekly. |
This would be nice to have in the release |
@kaspar030 this needs a rebase! |
OMG! I've been detached for too long. What happened to our beloved "no bloody macros, please!"-policy? |
Fighting hard for it on every occasion. But, putting information in "global space" is difficult. We've been looking for a solution for years. The upsides are pretty great - no more auto_init style ifdef messes, code like shell commands can stay with their modules, can be added without changing "shell" itself, or outside the tree. IMO, worth the one-line macro invocations. I do prefer type safe alternatives, but there's nothing like that for plain C. |
Needs a rebase now, besides tests was this waiting for something else? |
done in #18152. |
Contribution description
This PR changes shell_commands.c to use the new XFA method instead of a seperate array for defining "builtin" shell commands.
It is the first step towards cleaning up the ifdefs by moving each shell command to its respective module sources.
Testing procedure
This touches basically every application using the shell, and might thus expose issues with XFA. Running any shell based tests on diverse platforms makes sense.
Issues/PRs references
Waiting for
#16094,#16061