printf icon indicating copy to clipboard operation
printf copied to clipboard

Mark the *printf functions with __attribute__((format)).

Open svkampen opened this issue 4 years ago • 3 comments

See issue #79.

svkampen avatar May 16 '20 15:05 svkampen

Codecov Report

Merging #80 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #80   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          359       359           
=========================================
  Hits           359       359           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d3b9846...d8aeaa9. Read the comment docs.

codecov-commenter avatar Jul 03 '20 13:07 codecov-commenter

When the format attribute is added, we get a massive amounts of warnings from test_suite.cpp, including:

warning: flag ' ' results in undefined behavior with 's' conversion specifier [-Wformat]
warning: format specifies type 'char' but the argument has type 'int' [-Wformat]
warning: invalid conversion specifier 'b' [-Wformat-invalid-specifier]
 warning: flag '#' results in undefined behavior with 'u' conversion specifier [-Wformat]

Some can just be fixed by explicit casting (and TBH it's a bit surprising that they work... are we saved by the ABI perhaps?) ; others cannot.

What are your thoughts?...

Naturally, this is not my repository, but I've been thinking of merging this into my fork, which already has, merged, the work of some others around here (e.g. warning fixes, glibc %p behavior etc.). I even created a PR for that, but while merging I noticed all those warnings.

eyalroz avatar Jun 29 '21 21:06 eyalroz

When the format attribute is added, we get a massive amounts of warnings from test_suite.cpp

I believe I fixed this in my fork. See joshklod:format-attr for my implementation of this feature.

joshklod avatar Jun 30 '21 13:06 joshklod