64-bitwarningsc++builderenumerationc++builder-xe5

enumeration values not handled in switch


When compiling my project as a 64bit target (this isn't considered a warning on 32bit target) I get this warning:

5 enumeration values not handled in switch: 'kCreated', 'kLoaded', 'kConnected'...

I have somehow managed to turn off the error/warning message numbers, so I don't know what number to suppress in my code with #pragma warn.

I need to use #pragma warn because I only want to suppress approved places in my code (turning the warning off and on again).

Bonus question: Does anyone know how to get back the error/warning numbers again?


Solution

  • The 64bit compiler is based on CLang, which does not use warning numbers, which is why you do not see them. The following info comes from Bruneau Babet, one of C++Builder's chief developers, in the Embarcadero forums:

    How do I suppress 64bit XE3 warnings?

    Warnings in clang, hence bcc64, don't have the Wxxxx numbers. Behind the scene there is a unique id generated for each warning but it's auto-generated and cannot be assumed to remain constant across builds. Instead each warning has a group. Related warnings are often in the same group. Some groups have just one warning. To disable warnings of a group you can use "-Wno-" on the command line, or via something like the following in code:

    #pragma clang diagnostic ignored "-W<groupname>".

    For example, the first warning you listed is under the group "float-equal". So, "-Wno-float-equal" should disable that warning. And to disable the one about an enumerator not handled in the switch you can use the following in code:

    #pragma clang diagnostic ignored "-Wswitch"

    So the next obvious question is how to find out about each group. The "-fdiagnostics-show-option" should trigger the compiler to display the option but unfortunately the IDE does not honor that option. So you must either use the command line to find out about the group ach warning belongs to, or you can peek at the Warning declarations here:

    https://github.com/llvm/llvm-project/tree/main/clang/include/clang/Basic

    The *.td files declare the various warnings. The ones mentioned above are https://github.com/llvm/llvm-project/tree/main/clang/include/clang/Basic/DiagnosticSemaKinds.td

    Oddly, #pragma clang is still not documented on the Embarcadero DocWiki.