-
Notifications
You must be signed in to change notification settings - Fork 143
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
Add a Windows build target to Travis checks. #208
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using cmake works regardless of what build system is chosen on the different target platforms. In particular, this should make it work for Windows builds.
This is the only place we have LIBRSYNC_EXPORT on function definitions in *.c files and they shouldn't be there, as they break compiling tests on windows. Note the introduction of netint_test is the first test that links trace.c, so is the first time we've noticed this failure on Windows.
This is necessary for build systems that support multiple configurations, like Windows.
It seems passing `--config Debug` to cmake in .travis.yml didn't work. Instead we need to pass `-C Debug` to ctest in CMakeLists.txt to make it work on Windows.
Add explicit typecasts whenever truncating or upsizing values. Add 'U' to any literals that were intended to be unsigned.
This silences MSVC warnings about constant overflows from using a multiply.
Add explicit typecasts for truncating or expanding values. This silences MSVC warnings about possible loss of data.
In job.h change copy_len and write_len to size_t from rs_long_t and int. In stream.[hc] and tube.c remove unimplemented/unused rs_buffers_is_empty(), rs_check_tube(), and rs_buffers_check_exit(). Change all len arguments to size_t. Change rs_tube_catchup() return to rs_result from int. Tidy code order in header to reflect order in code. Make trace output more consistent.
This closes out a TODO for this. Move big description comment from stream.c to stream.h. Move rs_buffers_copy() from stream.c to rs_tube_copy_from_stream() in tube.c. Make rs_tube_catchup_write()'s trace output a little more consistent. Make rs_tube_copy_from_scoop() do nothing when there's no input our output space.
Add 2 explicit conversions where trucation is desired behavour.
sourcefrog
reviewed
Jun 2, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This makes the structure and trace output of rs_tube_catchup_write() more consistent with the tube.c copy handling functions.
Fix s_patch_s_copying() to use rs_long_t for the request copy length, and make it -Wconversion compliant. This would have broken long file support on 32bit platforms. Improve trace output from rs_patch_s_cmdbyte(). Make rs_patch_s_params() more -Wconversion compliant by using size_t for a buffer length. Change prototab.h len_1 and len_2 fields from size_t to int, which makes various code more -Wconversion compliant (netint.c use int for lengths of these parameters).
This ensures that Windows compiles don't complain about export stuff when compiling this test.
This ensures literal cmds that are 0 or greater than size_t will abort with an error instead of potentially corrupting the output.
This silences the last warning about hashtable.[ch] when building on windows.
Add `/D_CRT_SECURE_NO_WARNINGS` to MSVC CFLAGS to turn off warnings about posix functions. Also add optional commented out `-Wconversion` and `-Wno-sign-conversion` flags for gcc and clang for easy experimenting with more warnings.
This silences the last warning on Travis when compiling with MSVC.
This silences the last warnings for stats.c when compiling with MSVC.
This silences the last warnings about sumset.[ch] compiling with MSVC. Note this still has `-Wsign-conversion` warnings, but they are annoyingly spurious, and nearly all about mixing size_t with signed ints.
On window io.h is needed for _setmode(), and it has both fileno() and _fileno() but warns that fileno() is deprecated.
Apparently fread() returns a size_t which can never be negative, so returning -1 is not how it indicates an error. Instead you should use ferror() to check if there was an error. This also makes fileutil.c `-Wconversion -Wno-sign-conversion` compliant.
This is finally ready to merge. In the interest of preventing myself from fiddling with it any further I'm going to merge it now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a windows build target to the Travis checks.
Unfortunately I couldn't find a MSVC compatible version of libpopt that could be easily installed in the Travis build image, so this cannot build and test rdiff. This may be an argument to migrate to a more widely used argument parser like GNU's gengetopt, which I believe is available for Windows on Travis via chocolatey in GnuWin.
This revealed some extra compatibility problems and compiler warnings from MSVC, some of which were genuine bugs that needed fixing. Many of these would have been found by gcc/clang's
-Wconversion
warnings, but they can be too noisy to turn on permanently for the old gcc used by Travis. The subset of-Wsign-conversion
warnings are too spammy even for modern gcc/clang. I've made everything-Wconversion -Wno-sign-conversion
compliant when using gcc 9.3.0 or clang 7.0.0, and enabled them in cmake for clang only.Bugs/Fixes included are;
-Wconversion -Wno-sign-conversion
for clang and make all code compile clean.io.h
needed by MSVC forfileutil.c
.fileutil.c
for MSVC, includingio.h
and preferring_fileno()
to stop warnings.rs_file_copy_cb()
infileutil.c
.patch.c
regression added in Fix patch bug for zero-length copies and improve bad copy_cb() handling. #206 that would break patching large files on 32bit architectures.stream.h
, removing unimplemented/unused functions and improving argument types.stream.c
, moving lastrs_buffers_copy()
tors_tube_copy_from_stream()
intube.c
.LIBRSYNC_EXPORT
statements fromtrace.c
.