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

Minor compiler warnings under Linux #23

Open
mcuee opened this issue Aug 15, 2021 · 1 comment
Open

Minor compiler warnings under Linux #23

mcuee opened this issue Aug 15, 2021 · 1 comment

Comments

@mcuee
Copy link

mcuee commented Aug 15, 2021

Here are some warnings under Linux (gcc 10.3, ARM64).

[ 74%] Building CXX object src/tools/CMakeFiles/hidpp10-load-temp-profile.dir/hidpp10-load-temp-profile.cpp.o
/home/mcuee/build/libusb/hidpp/src/tools/hidpp10-load-temp-profile.cpp: In function ‘int main(int, char**)’:
/home/mcuee/build/libusb/hidpp/src/tools/hidpp10-load-temp-profile.cpp:119:67: warning: narrowing conversion of ‘((profile_format.std::unique_ptr<HIDPP::AbstractProfileFormat>::operator->()->HIDPP::AbstractProfileFormat::size() + 1) / 2)’ from ‘size_t’ {aka ‘long unsigned int’} to ‘unsigned int’ [-Wnarrowing]
  119 |   HIDPP::Address macro_address { 0, 0, (profile_format->size ()+1)/2 };
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
...

[ 98%] Building CXX object src/tools/CMakeFiles/hidpp20-led-control.dir/hidpp20-led-control.cpp.o
/home/mcuee/build/libusb/hidpp/src/tools/hidpp20-led-control.cpp: In function ‘int main(int, char**)’:
/home/mcuee/build/libusb/hidpp/src/tools/hidpp20-led-control.cpp:244:11: warning: unused variable ‘mode’ [-Wunused-variable]
  244 |      auto mode = Modes.value(argv[first_arg+1]);
      |           ^~~~


@mcuee
Copy link
Author

mcuee commented Apr 15, 2023

There is a warning under MSYS2 mingw as well.

[79/99] Building CXX object src/tools/CMakeFiles/hidpp10-load-temp-profile.dir/hidpp10-load-temp-profile.cpp.obj
C:/work/libusb/hidpp/src/tools/hidpp10-load-temp-profile.cpp: In function 'int main(int, char**)':
C:/work/libusb/hidpp/src/tools/hidpp10-load-temp-profile.cpp:115:81: warning: narrowing conversion of '((profile_format.std::unique_ptr<HIDPP::AbstractProfileFormat>::operator->()->HIDPP::AbstractProfileFormat::size() + 1) / 2)' from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' [-Wnarrowing]
  115 |                 HIDPP::Address macro_address { 0, 0, (profile_format->size ()+1)/2 };
      |                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
[99/99] Linking CXX executable src\tools\hidpp-persistent-profiles.exe

PS C:\work\libusb\hidpp> gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-12.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=nocona --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev10, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Rev10, Built by MSYS2 project)

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

1 participant