mity / md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
MIT License
756 stars 138 forks source link

Build with -Wall -Wextra, and silence most warnings #141

Closed dangelog closed 3 years ago

dangelog commented 3 years ago

As per subjet.

AMEND: actually, had to fix all the warnings, as the CI is quite strict in that regard (didn't spot that it was under -Werror).

codecov[bot] commented 3 years ago

Codecov Report

Merging #141 (bef1255) into master (26003b8) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #141   +/-   ##
=======================================
  Coverage   94.40%   94.40%           
=======================================
  Files           3        3           
  Lines        3072     3072           
=======================================
  Hits         2900     2900           
  Misses        172      172           
Impacted Files Coverage Δ
src/md4c.c 94.31% <100.00%> (ø)

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 26003b8...bef1255. Read the comment docs.

mity commented 3 years ago

didn't spot that it was under -Werror

Yeah, a favor to Qt team who needs -Wdeclaration-after-statement to be treated as an error due some embedded compiler which chokes on that. If there is a better way how to turn just that one warning type into an error, I would prefer that.

n_codepoints does not seem to ever contain negative offsets anyhow, should it actually be unsigned?

Strictly speaking yes. It was int for some historical reasons. I think -1 was used as a special value when end of string was reached or something like that. Looking at the code, it's not true anymore.

mity commented 3 years ago

Ok, merged, seems ok to me. Thanks for working on it.