I need to use enumerations with a limited range so that I can pass them as specific types to our serializer. I gave explicit integer values for the enum members of Enum1
.
Thus, I put two enumerations with the scope corresponding to the one described above in the bit field
enum class Enum1 { value1 = 0x0, value2 = 0x1, value3 = 0x2 }; enum class Enum2 { value1 = 0x0, value2, value3,
Now, wherever I use the Example
type, I get the warning “Example :: value1 'is too small to contain all the values of Enum1", and similarly for Enum2
. Please note that this does not apply to the values that we have defined, and we are not at all interested in values outside of them.
This is a pretty serious distraction in our build process - the project is large and complex, and we do not need to scan many of these warnings (and there are many).
I searched for the GCC flag (G ++) to disable a specific warning. Is there one that I can pass on the command line? Ideally, I would use a warning pragma to disable it locally, if possible.
At the moment there are few opportunities to change the structure of the code, but we can really use these false warnings.
Edit: added voluminous listings with changed identifiers.
source share