Skip to content

Conversation

@Adsun701
Copy link
Contributor

@Adsun701 Adsun701 commented Sep 11, 2019

This removes warnings for mdfour.c (using unsigned long long to avoid casting warning on Windows due to different data models), checksum.h (give a return value of 0 after the switch statement to avoid control reaches end of non-void function warning), and trace.h (set HAVE_PRINTF_Z to off when cross-compiling for Windows in CMakeLists.txt)

@dbaarda
Copy link
Member

dbaarda commented Sep 12, 2019

Thanks for sending this pull request and highlighting the warnings. In retrospect, one of these warnings appeared in the travis test logs. I'll make a point of actually looking at these logs and not just checking that the tests passed in the future.

Interestingly on my system a newer version of gcc also gives a warning for netint.c; one that requires a surprising level of optimization insight to notice. It's noticed that for the following line "d" will not have been initialized if rs_suck_netint() doesn't return RS_DONE;

*v = d;

I think gcc also gives a slightly faster Release build rdiff binary than clang does.

I"m going to play with various ways to make the select's less warn-y and maybe faster and get back to this.

Experimenting here with commiting directly to someone else's pull request in github.

This is the better way to fix this.
gcc version 9.2.1 20190821 (Debian 9.2.1-4)  gave a warning that 'd' is not always initialized by rs_suck_netint(). It noticed that if rs_suck_netint() doesn't return RS_DONE it means it doesn't set the value.

This stops that warning.
@dbaarda dbaarda changed the title remove warnings in mdfour.c, checksum.h, trace.h remove warnings in mdfour.c, checksum.h, trace.h, netint.c Sep 13, 2019
Tests show this is faster for gcc than the switch statements, as well as avoiding warnings.
@dbaarda
Copy link
Member

dbaarda commented Sep 13, 2019

I'm happy with this now. After the tests run and the logs show no warnings I'm going to merge.

Thanks for your contribution.

@dbaarda dbaarda merged commit 28ba484 into librsync:master Sep 13, 2019
@Adsun701 Adsun701 deleted the remove-warnings branch September 13, 2019 01:49
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.

3 participants