Page MenuHome GnuPG

gpgadduserideditinteractor.cpp: error: case value evaluates to -1, which cannot be narrowed to type 'unsigned int' [-Wc++11-narrowing]
Open, LowPublic

Description

The switch usage in gpgadduserideditinteractor.cpp is incompatible with C++11. It can be silenced with -Wno-narrowing, but it's still an incompatibility.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65801 for some reference

Event Timeline

How did you get this error? I don't even see a warning for this when building gpgme with g++ (SUSE Linux) 12.1.1 20220812.

g++: error: unrecognized command-line option '-Wc++11-narrowing'; did you mean '-Wno-narrowing'?

Is this with clang?

Yes, this is with Clang. I am working on getting it to compile on Windows with clang-cl, using vcpkg, with success. I have several patches to fix the issues that clang detected, and so I wonder if I should create a Task to discuss them all?

EDIT: the WIP vcpkg PR in speech: https://github.com/microsoft/vcpkg/pull/26424

For gpgme (as for the other GnuPG libraries) we use the good old mailing list based process for contributing patches. See doc/HACKING for details. In particular, we'll need a signed DCO from you.

Note that we do not support building gpgme for Windows with anything other than mingw/gcc. But we won't reject patches that do not increase our maintenance costs.

For the original issue I'd prefer to silence the error/warning with -Wno-narrowing because I think it's a non-issue. Or does changing the enum declarations to enum : unsigned int make clang happy?