RFC: Avoid warnings in MSVC builds, add flag for similar warnings for GCC/Clang
I'm sure that some of these changes are more acceptable than others; I can split them up in separate merge requests if there are things that are OK to be merged soon while others require more discussion.
This is an alternative to !563 (closed).
Merge request reports
Activity
added buildsystem label
Are all changes in 8 required to avoid warnings?
Yes. Most of them are necessary for a warning free build with MSVC. A couple of them (all changes to lf_mask.c and one of the changes to checkasm.c) are needed for building warning free with
-Wshorten-64-to-32
with clang.I can do a separate MR with the non-debatable parts, to reduce the amount of things under discussion.
mentioned in merge request !570 (merged)
I'll rebase this on latest master once !570 (merged) is done.
- Resolved by Martin Storsjö
- Resolved by Martin Storsjö
- Resolved by Martin Storsjö
added 12 commits
-
4a4eeb39...b1d571f1 - 8 commits from branch
videolan:master
- 0301eb16 - Add casts to silence warnings about intended type conversions/shortenings
- b2dd218b - obu: Initialize off_before_idx[0], fix MSVC warning about uninitialized use
- 1679fe5f - meson: Try building with -Wshorten-64-to-32
- 3bb47def - cdef_apply_tmpl: Restore the y variables to int
Toggle commit list-
4a4eeb39...b1d571f1 - 8 commits from branch
303 303 if ((unsigned) masks[0] == 1 && !(masks[1] >> 32)) { 304 304 const int off = t->bx & (bs(&r[-b4_stride])[0] - 1); 305 305 add_sample(-off, 0, 1, -1, &r[-b4_stride]); 306 } else for (unsigned off = 0, xmask = masks[0]; np < 8 && xmask;) { // top 306 } else for (unsigned off = 0, xmask = (uint32_t) masks[0]; np < 8 && xmask;) { // top This was maybe the biggest surprise in the patchset.
masks[0]
isuint64_t
and has got values set outside of theuint32_t
range, but we intentionally need to only use the lowest half, otherwise this really doesn't work any longer.Therefore I used an
(uint32_t)
cast here, to indicate that we really explicitly want to truncate it to 32 bits (e.g. for completely hypothetical ABIs with a 64 bitint
type).
mentioned in issue #242 (closed)
- Resolved by Martin Storsjö
added 15 commits
-
3bb47def...0d18b15a - 11 commits from branch
videolan:master
- 390489c7 - Add casts to silence warnings about intended type conversions/shortenings
- ddb653e2 - obu: Initialize off_before_idx[0], fix MSVC warning about uninitialized use
- 05a1267a - meson: Try building with -Wshorten-64-to-32
- 5d3efc49 - cdef_apply_tmpl: Restore the y variables to int
Toggle commit list-
3bb47def...0d18b15a - 11 commits from branch
added 1 commit
- 8872811e - cdef_apply_tmpl: Restore the y variables to int
added 5 commits
-
3cf4d32e - 1 commit from branch
videolan:master
- 13b7df8d - Add casts to silence warnings about intended type conversions/shortenings
- baba5fc3 - obu: Initialize off_before_idx[0], fix MSVC warning about uninitialized use
- fe17bd16 - cdef_apply_tmpl: Restore the y variables to int
- ced01fec - meson: Try building with -Wshorten-64-to-32
Toggle commit list-
3cf4d32e - 1 commit from branch
added 8 commits
-
ced01fec...4c21c931 - 4 commits from branch
videolan:master
- 35b1cde2 - Add casts to silence warnings about intended type conversions/shortenings
- 65d963d4 - obu: Initialize off_before_idx[0], fix MSVC warning about uninitialized use
- 703c72fd - cdef_apply_tmpl: Restore the y variables to int
- 93ab93de - meson: Try building with -Wshorten-64-to-32
Toggle commit list-
ced01fec...4c21c931 - 4 commits from branch