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

Use proper sign-ness #917

Closed
kgizdov opened this issue Mar 3, 2019 · 0 comments
Closed

Use proper sign-ness #917

kgizdov opened this issue Mar 3, 2019 · 0 comments

Comments

@kgizdov
Copy link
Contributor

kgizdov commented Mar 3, 2019

The following code is problematic:

for( int i = 0; i < pipelines.size(); i++ )
{
oss << pipelines[i]->ToString();
if( i != pipelines.size() - 1 )
{
oss << " && ";
}
}

Not to mention it fails the tests with current config:

/usr/bin/cc -pthread -DNDEBUG -g -fwrapv -O3 -Wall --std=c++0x -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -I/build/xrootd/src/xrootd-4.9.0/src -I/build/xrootd/src/build/src -I/usr/include/python3.7m -c /build/xrootd/src/xrootd-4.9.0/bindings/python/src/PyXRootDFileSystem.cc -o build/temp.linux-x86_64-3.7/build/xrootd/src/xrootd-4.9.0/bindings/python/src/PyXRootDFileSystem.o -g
In file included from /build/xrootd/src/xrootd-4.9.0/tests/XrdClTests/OperationsWorkflowTest.cc:31:
/build/xrootd/src/xrootd-4.9.0/src/XrdCl/XrdClParallelOperation.hh: In instantiation of ‘std::__cxx11::string XrdCl::ParallelOperation<<anonymous> >::ToString() [with bool HasHndl = true; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
/build/xrootd/src/xrootd-4.9.0/src/XrdCl/XrdClParallelOperation.hh:88:19:   required from here
/build/xrootd/src/xrootd-4.9.0/src/XrdCl/XrdClParallelOperation.hh:92:27: error: comparison of integer expressions of different signedness: ‘intand ‘std::vector<XrdCl::Pipeline>::size_type’ {aka ‘long unsigned int’} [-Werror=sign-compare]
         for( int i = 0; i < pipelines.size(); i++ )
                         ~~^~~~~~~~~~~~~~~~~~
/build/xrootd/src/xrootd-4.9.0/src/XrdCl/XrdClParallelOperation.hh:95:17: error: comparison of integer expressions of different signedness: ‘intand ‘std::vector<XrdCl::Pipeline>::size_type’ {aka ‘long unsigned int’} [-Werror=sign-compare]
           if( i != pipelines.size() - 1 )
               ~~^~~~~~~~~~~~~~~~~~~~~~~

int i should be size_t i - no reason not to be.
Also, change the if- statement to use +. I'll attach a pull request in a bit.

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