[Openmp-dev] default label in switch which covers all enumeration values

Jack Howarth howarth.mailing.lists at gmail.com
Thu Jun 4 18:13:10 PDT 2015


Jonathan,
      There are actually a second of instance of this warning....

/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_i18n.c:918:9:
warning: default label in switch which covers all enumeration values
      [-Wcovered-switch-default]
        default : {
        ^

but at least in this case the default case is at the end of the switch
statement.

    switch ( severity ) {
        case kmp_ms_inform : {
            format = kmp_i18n_fmt_Info;
        } break;
        case kmp_ms_warning : {
            format = kmp_i18n_fmt_Warning;
        } break;
        case kmp_ms_fatal : {
            format = kmp_i18n_fmt_Fatal;
        } break;
        default : {
            KMP_DEBUG_ASSERT( 0 );
        };
    }; // switch

       Jack

On Thu, Jun 4, 2015 at 8:45 PM, Jack Howarth
<howarth.mailing.lists at gmail.com> wrote:
> Jonathan,
>       In current openmp, I noticed the following warning....
>
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_lock.cpp:3596:9:
> warning: default label in switch which covers all enumeration values
>       [-Wcovered-switch-default]
>         default:
>         ^
>
> The clang warning is described at...
>
> http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations
>
> Also, shouldn't the default case be at the end of the switch statement?
>
> void __kmp_set_user_lock_vptrs( kmp_lock_kind_t user_lock_kind )
> {
>     switch ( user_lock_kind ) {
>         case lk_default:
>         default:
>         KMP_ASSERT( 0 );
>
>         case lk_tas: {
>
>
>               Jack



More information about the Openmp-dev mailing list