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

ci: build with ENABLE_WERROR on Windows #5143

Merged
merged 13 commits into from
Jul 5, 2019
Merged

ci: build with ENABLE_WERROR on Windows #5143

merged 13 commits into from
Jul 5, 2019

Conversation

ethomson
Copy link
Member

Build with -Werror's equivalent (/WX) on MSVC.

I neglected to do this in the previous warnings PR, oops. I think that there are also some lingering issues in things like examples that I didn't build locally with /WX and missed since I didn't add this in the CI setup.

Build with -Werror's equivalent (/WX) on MSVC
@ethomson ethomson force-pushed the ethomson/warnings branch 2 times, most recently from cf889f7 to c934c97 Compare June 25, 2019 14:15
pks-t added 7 commits July 5, 2019 11:28
When reallocating commit arrays in `opts_add_commit` and
`opts_add_refish`, respectively, we simply pass the const pointer to
`xrealloc`. As `xrealloc` expects a non-const pointer, though, this will
generate a warning with some compilers.

Cast away the constness to silence compilers.
The memchr(3P) function expects a `size_t` as its last parameter, but we
do pass it an object size, which is of signed type `git_off_t`. As we
can be sure that the result will be non-negative, let's just cast the
parameter to a `size_t`.
When computing the progress, we perform some arithmetics that are
implicitly converting from `size_t` to `int`. In one case we're
calclulating a percentage, so we know that it should always be in the
range of [0,100] and thus we're fine. In the other case we convert from
bytes to kilobytes -- this should be stored in a `size_t` to avoid loss
of precision, even though it probably won't matter due to limited
download rates.
When iterating over index entries, we store the indices in an unsigned
int. As the index entrycount is a `size_t` though, this may be a loss of
precision which a compiler might rightfully complain about.

Use `size_t` instead to fix any warnings.
We use the `__LINE__` macro in several places throughout clar to allow
easier traceability when e.g. a test fails. While `__LINE__` is of type
`size_t`, the clar functions all accept an integer and thus may loose
precision. While unlikely that any file in our codebase will exceed a
linecount of `INT_MAX`, let's convert it anyway to silence any compiler
warnings.
In both `git_win32__stack_format` and `git_win32__stack`, we handle
buffer lengths via an integer variable. As we only ever pass buffer
sizes to it, this should be a `size_t` though to avoid loss of
precision. As we also use it to compare with other `size_t` variables,
this also silences signed/unsigned comparison warnings.
The function `git_win32__stack__set_aux_cb` expects the second parameter
to be a function callback of type `git_win32__stack__aux_cb_lookup`,
which expects a `size_t` parameter. In our test suite
trace::windows::stacktrace, we declare the callback with `unsigned int`
as parameter, though, causing a compiler warning.

Correct the parameter type to silence the warning.
@pks-t pks-t merged commit 398412c into master Jul 5, 2019
@pks-t
Copy link
Member

pks-t commented Jul 5, 2019

Hope you don't mind me pushing this forward! :)

@ethomson
Copy link
Member Author

ethomson commented Jul 5, 2019

ON THE CONTRARY. 🎉🎉🎉🎉🎉

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.

2 participants