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 more sign conversion errors #165

Merged
merged 1 commit into from
Aug 19, 2024
Merged

Conversation

k3DW
Copy link
Contributor

@k3DW k3DW commented Aug 19, 2024

These are some more errors I'm seeing in the Unordered tests in unordered#274. This is related to #162 / #163.

I reproduced it locally with GCC 9 with the command used in the CI.

"g++-9"   -std=c++11 -fvisibility-inlines-hidden -fPIC -m64 -pthread -O3 -finline-functions -Wno-inline -Wall -Wextra -pedantic -Werror -fvisibility=hidden -Wconversion -Wfloat-equal -Wno-variadic-macros -Wshadow -Wsign-conversion -Wsign-promo -DBOOST_ALL_NO_LIB=1 -DNDEBUG   -I"."  -c -o "bin.v2/libs/unordered/test/visualization_tests.test/gcc-9/release/x86_64/cxxstd-11-iso/threading-multi/visibility-hidden/visualization_tests.o" "libs/unordered/test/debuggability/visualization_tests.cpp"

Here is a modification of the command that produces the same error on my machine, using only the Uuid library.

g++-9 -Werror -Wsign-conversion -I /mnt/d/boost libs/uuid/include/boost/uuid/uuid_io.hpp
In file included from libs/uuid/include/boost/uuid/uuid_io.hpp:9:
/mnt/d/boost/boost/uuid/uuid.hpp: In member function ‘uint8_t* boost::uuids::uuid::end()’:
/mnt/d/boost/boost/uuid/uuid.hpp:124:49: error: conversion to ‘long int’ from ‘boost::uuids::uuid::size_type’ {aka ‘long unsigned int’} may change the sign of the result [-Werror=sign-conversion]
  124 |     iterator end() noexcept { return data + size(); }
      |                                             ~~~~^~
/mnt/d/boost/boost/uuid/uuid.hpp: In member function ‘const uint8_t* boost::uuids::uuid::end() const’:
/mnt/d/boost/boost/uuid/uuid.hpp:125:61: error: conversion to ‘long int’ from ‘boost::uuids::uuid::size_type’ {aka ‘long unsigned int’} may change the sign of the result [-Werror=sign-conversion]
  125 |     const_iterator end() const noexcept { return data + size(); }
      |                                                         ~~~~^~
In file included from libs/uuid/include/boost/uuid/uuid_io.hpp:10:
/mnt/d/boost/boost/uuid/detail/to_chars.hpp: In function ‘Ch* boost::uuids::detail::to_chars(const boost::uuids::uuid&, Ch*)’:
/mnt/d/boost/boost/uuid/detail/to_chars.hpp:50:35: error: conversion to ‘long int’ from ‘std::size_t’ {aka ‘long unsigned int’} may change the sign of the result [-Werror=sign-conversion]
   50 |         std::uint8_t ch = u.data[ i ];
      |                                   ^
cc1plus: all warnings being treated as errors

@pdimov
Copy link
Member

pdimov commented Aug 19, 2024

The operator() change is incorrect.

@k3DW
Copy link
Contributor Author

k3DW commented Aug 19, 2024

The operator() change is incorrect.

I'll change it back.

@k3DW k3DW force-pushed the sign-conversion branch from 662d55d to 7909c54 Compare August 19, 2024 13:31
@pdimov pdimov merged commit c432e16 into boostorg:develop Aug 19, 2024
63 checks passed
@k3DW k3DW deleted the sign-conversion branch August 19, 2024 22:34
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.

2 participants