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

Big amount of -Wconversion warnings #3

Closed
raul-klg opened this issue Feb 26, 2019 · 2 comments
Closed

Big amount of -Wconversion warnings #3

raul-klg opened this issue Feb 26, 2019 · 2 comments

Comments

@raul-klg
Copy link

Hello:
Thanks for this piece of software which I have found very helpful.
I use it in one of our projects where we happen to also use the -Wconversion gcc flag. When doing like this, a lot of warning are issued by the compiler. For instance:

In file included from ../../src/main.cpp:38:0:
../../../inc/CRC.h: In instantiation of ‘static CRCType CRC::CalculateRemainder(const void*, size_t, const CRC::Parameters<CRCType, CRCWidth>&, CRCType) [with CRCType = unsigned char; short unsigned int CRCWidth = 8u; size_t = long unsigned int]’:
../../../inc/CRC.h:438:43:   required from ‘static CRCType CRC::Calculate(const void*, size_t, const CRC::Parameters<CRCType, CRCWidth>&) [with CRCType = unsigned char; short unsigned int CRCWidth = 8u; size_t = long unsigned int]’
../../src/main.cpp:102:41:   required from ‘void CRCBitByBitTest(const char*, size_t, const CRC::Parameters<CRCType, CRCWidth>&, CRCType, const string&) [with CRCType = unsigned char; short unsigned int CRCWidth = 8u; size_t = long unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]’
../../src/main.cpp:208:5:   required from here
../../../inc/CRC.h:624:23: warning: conversion to ‘unsigned char’ from ‘int’ may alter its value [-Wconversion]
             remainder ^= *current++;
             ~~~~~~~~~~^~~~~~~~~~~~~

Find attached the whole build log and a patch to reproduce the problem.
Steps to reproduce (on Debian Stretch but could work for other distros) :

  • Clone the repository
  • Apply patch
  • go to test/prj/gcc subdirectory
  • make

build.log
gcc-Wconversion-diff.txt

@d-bahr
Copy link
Owner

d-bahr commented May 8, 2019

Thanks for filing this issue; I was able to reproduce it. I'll have a fix shortly.

d-bahr added a commit that referenced this issue May 8, 2019
Fix issue #3. All configurations compile without warnings with -Wall -Werror -Wextra -pedantic -Wconversion. Bump to version 1.0.0.0.
@d-bahr
Copy link
Owner

d-bahr commented May 8, 2019

Issue is fixed in master and will be included in release-1.0.0.0.

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

No branches or pull requests

2 participants