Skip to content
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

Give every printf-like function __restrict for the format value #360

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AreaZR
Copy link
Contributor

@AreaZR AreaZR commented Nov 29, 2022

The format value has to be a string literal, every time. Otherwise, you are not using these functions correctly. To reinforce this fact, I put __restrict over every non-contrib example of this I could find.

@AreaZR
Copy link
Contributor Author

AreaZR commented Jul 7, 2023

@daztucker Thoughts?

@AreaZR AreaZR force-pushed the fix branch 2 times, most recently from 73b4c02 to 40ee4f5 Compare July 8, 2023 00:51
@AreaZR AreaZR changed the title Give every printf like function __restrict for the format value Give every printf-like function __restrict for the format value Jul 8, 2023
@kalvdans
Copy link

kalvdans commented Sep 5, 2023

__restrict only have effect when two pointer arguments are of the same type, and says that they never can overlap. Your are looking for -Werror=format-nonliteral .

The format value has to be a string literal, every time. Otherwise, you are not using these functions correctly. To reinforce this fact, I put __restrict over every non-contrib example of this I could find.

Also regenerated autoconf files to accommodate this change.
@djmdjm
Copy link
Contributor

djmdjm commented Oct 18, 2024

The format value has to be a string literal, every time. Otherwise, you are not using these functions correctly

I don't think this is true. The logging code itself uses snprint() with a non-literal format string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants