Skip to content
Snippets Groups Projects
  • Reid Kleckner's avatar
    b2df6a41
    [MS] Silence -Wextern-init on const selectany variables · b2df6a41
    Reid Kleckner authored
    In C, 'extern' is typically used to avoid tentative definitions when
    declaring variables in headers, but adding an intializer makes it a
    defintion. This is somewhat confusing, so GCC and Clang both warn on it.
    In C++, 'extern' is often used to give implictly static 'const'
    variables external linkage, so don't warn in that case. If selectany is
    present, this might be header code intended for C and C++ inclusion, so
    apply the C++ rules.
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279116 91177308-0d34-0410-b5e6-96231b3b80d8
    b2df6a41
    History
    [MS] Silence -Wextern-init on const selectany variables
    Reid Kleckner authored
    In C, 'extern' is typically used to avoid tentative definitions when
    declaring variables in headers, but adding an intializer makes it a
    defintion. This is somewhat confusing, so GCC and Clang both warn on it.
    In C++, 'extern' is often used to give implictly static 'const'
    variables external linkage, so don't warn in that case. If selectany is
    present, this might be header code intended for C and C++ inclusion, so
    apply the C++ rules.
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279116 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.