Skip to content

Conversation

kfessel
Copy link
Contributor

@kfessel kfessel commented Aug 5, 2022

Contribution description

If log_color is used: this moves log_write from its header (being implemtented static to its own compile unit making it used accross multiple compile units)

Testing procedure

run tests/log_*

Issues/PRs references

#18379 i was asked by @miri64 to check if it increases the rom size (it didn't) while checking for that I found that log_write seems to not be inlined -> using one for all will decrease the size (if more than on compilation unit is using log (and log_color is used)).

@github-actions github-actions bot added the Area: sys Area: System label Aug 5, 2022
Comment on lines 19 to 20
BASELIBS += log.module
SRC += log_color.c
Copy link
Member

@miri64 miri64 Aug 5, 2022

Choose a reason for hiding this comment

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

Can we use the default mechanism of SUBMODULES here and not some hand-spun solution, please? Edit: see https://doc.riot-os.org/creating-modules.html#pseudomodules

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

@kfessel kfessel requested a review from miri64 August 5, 2022 16:07
@github-actions github-actions bot added the Area: build system Area: Build system label Aug 5, 2022
@kfessel kfessel added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Aug 5, 2022
PSEUDOMODULES += log
PSEUDOMODULES += log_printfnoformat
PSEUDOMODULES += log_color
PSEUDOMODULES += log_%
Copy link
Member

@miri64 miri64 Aug 5, 2022

Choose a reason for hiding this comment

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

Why reduce specificity?

Suggested change
PSEUDOMODULES += log_%
PSEUDOMODULES += log_printfnoformat
PSEUDOMODULES += log_color

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seemed overspecific (i had to remove PSEUDOMODULES += log since there are now variants that have build results)
so i made it less specific (as it is for other pseudo modules)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if log is a pseudo module the build result isn't linked

Copy link
Member

Choose a reason for hiding this comment

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

So how does a user find out what log_... pseudo-modules there are if you remove the only bit of documentation?

Copy link
Member

Choose a reason for hiding this comment

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

It seemed overspecific (i had to remove PSEUDOMODULES += log since there are now variants that have build results)

Sorry my mistake. I realized that, but for got to remove the line. Fixed in the suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

and there seem are a lot on % in it (e.g.: prng_%)

And I dislike them as much as what you are trying to do here. I was and always will be against wildcards to define pseudomodules. I don't see any reason for them except lazyness. Let's be good scouts and not make the situation worse than it already is, just because there is precedence for bad behavior.

As for documentation: This file is actually rendered by Doxygen: https://doc.riot-os.org/group__pseudomodules.html...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

If you can explain to me, why the change to wildcards is so important I am inclined to remove my change request regarding this. Because I still don't really see a valid reason.

https://output.circle-artifacts.com/output/job/a338c64b-59b4-4911-907d-afcce6e4bdf8/artifacts/0/doc/group__pseudomodules.html

Why do they use a different formatting than the rest of the listed pseudo-modules there?

Copy link
Contributor Author

@kfessel kfessel Aug 8, 2022

Choose a reason for hiding this comment

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

Why do they use a different formatting than the rest of the listed pseudo-modules there?

While most pseudomodules aren't even listed the one that are use the defgroup title in entirely different way than the rest of the documentation
I think: the title of a common defgroup for a (pseudo)module should be as i just wrote the one for log_... <modulename>: <title> this would also help the list in https://doc.riot-os.org/group__sys.html

eg.: from the syslist i know the is a "Lightweight Morse encoder" - what is its module to use?
changing this to "umorse: Lightweight Morse encoder" would help a lot

atm for many sys-modules the title is missused as a brief:
CongURE and fido2 are nice exemptions

Copy link
Member

Choose a reason for hiding this comment

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

There is #7094. <modulename>: <title> would be one way to fix this. However, IMHO this should be done all in one go.

Comment on lines +54 to +59
# for each $(BASE_MODULE)_<name> in USEMODULE, add $(BASE_MODULE)_<name>.c to SRC
# unless in SUBMODULES_NO_SRC
SRC += $(wildcard \
$(filter-out $(SUBMODULES_NO_SRC),\
$(patsubst %,%.c,\
$(filter $(BASE_MODULE)_%,$(USEMODULE)))))
Copy link
Member

Choose a reason for hiding this comment

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

What is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

previously log_color.c was not accepted (it wanted to have it named color.c) this adds log_color.c to the accepted names.

Copy link
Member

Choose a reason for hiding this comment

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

Why not keep the old naming pattern in line with the documentation and name the file color.c? It is new anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the documentation of the submodule seemed to me as if log_color.c should be an accepted name and the only reason this did not work was that it was not done the way it was intended.

my personal reason: is that my editor names the tabs with the file name (no path) and i like to find the files again and color is very generic

Copy link
Member

Choose a reason for hiding this comment

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

Our Makefile's contain already enough complexity to give me lots of nightmares. I totally agree with @miri64 that we should just use the submodule naming pattern as intended, rather than increasing the complexity of the build system even further to introduce an alternative naming pattern.

Also, adding a second naming pattern and introducing inconsistency is pretty confusing.

Copy link
Contributor Author

@kfessel kfessel Aug 9, 2022

Choose a reason for hiding this comment

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

should these log modules even be pseudo modules?

why not have sys/log_color and sys/log_puts? - they even got different tests this would simplify the whole thing a lot

Copy link
Member

Choose a reason for hiding this comment

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

why not have sys/log_color and sys/log_puts? - they even got different tests this would simplify the whole thing a lot

There are already two ways of defining submodules.. either the SUBMODULES := 1 method with PSEUDOMODULES or the build system way of having subdirectories (see e.g. gnrc). Please let's not introduce a third. If you want the log_color module be a non-pseudomodule, do it with subdirectories.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@miri64 maybe #18425 is the better solution it reduces the specialty of log_* making it just 2 modules easy to create a 3rd the make files are much smaller and the overall complexity is reduced i also like the visibility of that 2 modules

@github-actions github-actions bot added Area: timers Area: timer subsystems Area: tools Area: Supplementary tools labels Aug 8, 2022
@chrysn chrysn added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 8, 2022
@kfessel
Copy link
Contributor Author

kfessel commented Sep 15, 2022

I prefer #18425 for its simplicity

@kfessel kfessel closed this Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: sys Area: System Area: timers Area: timer subsystems Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants