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

Fix our own compiler warnings #1677

Merged
merged 11 commits into from Feb 1, 2019

Conversation

Projects
3 participants
@wezrule
Copy link
Collaborator

commented Feb 1, 2019

This solves the "Internal warnings" part of #1658

A *full clean build was done on:
Windows (Visual Studio 2017)
Mac (XCode + Clang)
Fedora (gcc)

*The wallet was only build on Windows

All warnings were analysed and ones which were caused by us (i.e not third party ones) should now be fixed, with an exception detailed at the end. These include:

  • 'peer_put' overrides a member function but is not marked 'override'. Solution - add override
  • clGetPlatformIDs' is deprecated. Solution - add CL_SILENCE_DEPRECATION above the opencl includes inside #define __APPLE__
  • Field 'pull' will be initialized after field 'known_account'. Solution - put them in matching order
  • Lambda capture 'block_a' is not used. Solution - remove it
  • Array index -8388608 is before the beginning of the array. This was a somewhat special one, as the test was checking the address sanitizer, but currently it is DISABLED_. It only appears with gcc/clang so I have suppressed the warning for these compilers.
  • Unused variable 'value' Solution - remove if not used, otherwise add (void)
    'argument': conversion from 'size_t' to 'uint32_t', possible loss of data. Solution - do appropriate casts

warning C4996: 'localtime': This function or variable may be unsafe. Consider using localtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

  • The suggested functions above are not standard (MSVC specific) and are only optional with the current compilers we support. Solution - Add -D_CRT_SECURE_NO_WARNINGS to cmake file when using Windows.

  • warning: zero-length gnu_printf format string [-Wformat-zero-length] printf (""); . Solution - remove it

The only warnings left are:
warning C4996: 'xrb_generate_random': was declared deprecated

We recently deprecated them, so wasn't sure if we should suppress the warnings, as it will be nice to have a constant reminder about them so that they don't get forgotten.

Other changes:
interface.cpp - The array only needs a buffer of 65.
promise.get_future () is called before the thread is created as it is not guaranteed to be thread safe (only in areas where code was changed, I haven't checked them all).

@wezrule wezrule self-assigned this Feb 1, 2019

Show resolved Hide resolved nano/node/rpc.cpp Outdated
Show resolved Hide resolved nano/node/testing.cpp

@argakiig argakiig added this to the V18.0 milestone Feb 1, 2019

@argakiig argakiig merged commit 885522b into nanocurrency:master Feb 1, 2019

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@wezrule wezrule referenced this pull request Feb 3, 2019

Open

Fix all warnings #1658

1 of 3 tasks complete

@wezrule wezrule deleted the wezrule:fix_warnings branch Feb 3, 2019

@zhyatt zhyatt added this to During RC in V18 Feb 6, 2019

@zhyatt zhyatt moved this from RC2 to CP 3/RC 1 (2018-02-01) in V18 Feb 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.