Conversation
73892de to
57f1918
Compare
pks-t
left a comment
There was a problem hiding this comment.
Oooh, thanks for working on this! I think I've never before seen a warning-free build on MSVC. Didn't know that this was possible
| size_t buflen = u->field_data[UF_HOST].off + u->field_data[UF_HOST].len; | ||
|
|
||
| if (buflen > UINT16_MAX) | ||
| return 1; |
There was a problem hiding this comment.
It's unfortunate that we're diverging from upstream http-parser. I think we should apply this for now, but try to upstream those changes and then re-sync our copy.
| return -1; | ||
| } | ||
|
|
||
| entry = git_pool_malloc(&frame->entry_pool, (uint32_t)entry_size); |
There was a problem hiding this comment.
I'd argue that git_pool_malloc should be using size_t, but as it's of theoretical value only I'm happy with this, too.
| git_error_set(GIT_ERROR_MERGE, "merged file contents too large for index"); | ||
| error = -1; | ||
| goto done; | ||
| } |
There was a problem hiding this comment.
So this means we're not able to solve merge conflicts on 4GB files? Unlikely, but it could very well be that somebody has written a merge conflict driver for binary files that is able to resolve such conflicts. On the other hand, this is not a new restriction and at least we're being explicit now.
There was a problem hiding this comment.
Right, I'd forgotten how the index handles files > 4GB. In fact, we should be truncating the file size to a uint32_t in the cache. I updated this to remove this (incorrect) check.
There was a problem hiding this comment.
Just to be sure, I can't remember how this looked before. Is this already the updated version? Cannot see any "outdated" marker.
There was a problem hiding this comment.
Right! Sorry, I must not have pushed up a fixed. (It's now pushed up.)
|
|
||
| /* | ||
| * Return the position of the start of the last line. If len is 0, return -1. | ||
| * Return the position of the start of the last line. If len is 0, return 0. |
There was a problem hiding this comment.
We cannot discern text with zero length and text with a single line only, now, can we? Both would return 0. I think it'd be cleaner to just use an out parameter here
fc2cbb7 to
664dabb
Compare
We're warning free on MSVC x86 builds today; this just fixes up amd64. One of the tricky bits here is that in the win32 ecosystem is that |
|
/rebuild |
|
Sorry @azuredevopsuser, you're not allowed to do that. |
1e393c0 to
0801b76
Compare
|
Mhh. It's unfortunate that VSTS deletes the latest build on still existing pull requests :/ Makes it impossible to see what's caused the error without a rebuild |
|
/rebuild |
|
Sorry @pks-t, I was not able to find any builds to requeue. |
|
Huh. Not even rebuilding works. Bummer |
|
(Build manually requeued: https://dev.azure.com/libgit2/libgit2/_build/results?buildId=2082) |
|
Cool, thanks @tiennou! |
Yeah, I need to fix this so that we retain builds >30 days. |
bf20e94 to
599bbde
Compare
|
So we're now warning-free on all our core platforms (with the exception of xdiff) and I've enabled For xdiff, there are warnings on Windows, largely due to LP vs LLP differences. Fixing them here would be a lot of code churn, so instead, I'd like to work with core git itself to ensure that we have a shared implementation that's warning-free on all platforms. As a result, I've disabled |
|
I'd love to get this merged reasonably soon, so that we don't accrue more warnings as time goes on. 😀 But I'll leave this open for a bit longer to make sure that everyone has some time to get 👀 on it. |
pks-t
left a comment
There was a problem hiding this comment.
Sorry, forgot to actually publish my comments a few days ago
| ELSE() | ||
| ENABLE_WARNINGS(format) | ||
| ENABLE_WARNINGS(format-security) | ||
| DISABLE_WARNINGS(documentation-deprecated-sync) |
There was a problem hiding this comment.
What about this flag? Shouldn't we keep on setting this for both platforms?
There was a problem hiding this comment.
mingw fails with cc1.exe: warning: unrecognized command line option '-Wno-documentation-deprecated-sync'. This is despite cmake believing that it's supported:
-- Performing Test IS_WNO_DOCUMENTATION_DEPRECATED_SYNC_SUPPORTED
-- Performing Test IS_WNO_DOCUMENTATION_DEPRECATED_SYNC_SUPPORTED - Success
(sigh.)
There was a problem hiding this comment.
Yeah, this one seems to be very peculiar. I've noticed several times that it's popping up in CMake logs when there's compiler errors. Maybe we should just drop that flag altogether? Does any modern platform support it?
There was a problem hiding this comment.
Also:
~ $ gcc -Wdocumentation-deprecated-sync
gcc: error: unrecognized command line option '-Wdocumentation-deprecated-sync'
gcc: fatal error: no input files
compilation terminated.
~ $ gcc -Wno-documentation-deprecated-sync
gcc: fatal error: no input files
compilation terminated.
It recognizes that it doesn't know it in the positive case, but it doesn't notice in the negative one. Maybe it's a bug in GCC?
There was a problem hiding this comment.
googling suggests that clang supports it...? Let's see what happens without it.
There was a problem hiding this comment.
Yep, clang is definitely unhappy. We certainly could add the GIT_DEPRECATED macro back to add that attribute in, but that still seemed rather heavy-handed today.
It looks like gcc is perfectly happy with or without that option, though. We should just add that flag for clang...
There was a problem hiding this comment.
sigh Yeah, I agree that it'd be too heavy-handed. With so many deprecations going on, users would probably get overwhelmed with a huge amount of warnings. Not much of a fan of adding compiler-specific flags either, but if that's the only way forward then let's do that?
| z_off64_t len2; | ||
| { | ||
| return adler32_combine_(adler1, adler2, len2); | ||
| } |
There was a problem hiding this comment.
Fair enough. I do expect that this will creep in again when updating zlib in the future, though
599bbde to
6c0a76d
Compare
|
By the way, you also need to rebase ;) |
Our progress information messages are short (and bounded by their format string), cast the length to int for callers.
Ensure that the server has not sent us overly-large sideband messages (ensure that they are no more than `INT_MAX` bytes), then cast to `int`.
2b326ba to
1393d78
Compare
pks-t
left a comment
There was a problem hiding this comment.
Honestly I only skipped over some of that code, but from a glance it looks good to me.
| git_error_set(GIT_ERROR_MERGE, "merged file contents too large for index"); | ||
| error = -1; | ||
| goto done; | ||
| } |
There was a problem hiding this comment.
Just to be sure, I can't remember how this looked before. Is this already the updated version? Cannot see any "outdated" marker.
Move `git_win32__file_attribute_to_stat` to a regular function instead of an inlined function. This helps avoid header ordering issues and declarations.
For MSVC, support warnings as errors by providing the /WX compiler flags. (/WX is the moral equivalent of -Werror.) Disable warnings as errors ass part of xdiff, since it contains warnings. But as a component of git itself, we want to avoid skew and keep our implementation as similar as possible to theirs. We'll work with upstream to fix these issues, but in the meantime, simply let those continue to warn.
RtlCaptureStackBackTrace is well-defined in Windows, no need to redefine it.
MinGW uses gcc, which expects POSIX formatting for printf, but uses the Windows C library, which uses its own format specifiers. Therefore, it gets confused about format specifiers. Disable warnings for format specifiers.
MinGW does not define DWORD_MAX. Specify it when it's not defined.
GetProcAddress is prototyped to return a `FARPROC`, which is meant to be a generic function pointer. It's literally `int (FAR WINAPI * FARPROC)()` which gcc complains if you attempt to cast to a `void (*)(GIT_SRWLOCK *)`. Cast to a `void *` before casting to avoid warnings about the arguments.
GetProcAddress is prototyped to return a `FARPROC`, which is meant to be a generic function pointer. It's literally `int (FAR WINAPI * FARPROC)()` which gcc complains if you attempt to cast to a `void (*)(GIT_SRWLOCK *)`. Cast to a `void *` before casting to avoid warnings about the arguments.
Add the `-Wno-documentation-deprecated-sync` switch when compiling with clang, since our documentation adds `deprecated` markers, but we do not add the deprecation attribute in the code itself. (ie, the code is out of sync with the docs). In fact, we do not _want_ to mark these items as deprecated in the code, at least not yet, as we are not quite ready to bother our end-users with this since they're not going away.
1393d78 to
e61b92e
Compare
We've still got some warnings when compiling on Windows amd64. I want them eliminated.