[MSVC] Recognize `static_assert` keyword in C and C++98

Summary:
The main effect is that clang now accepts the following conforming C11
code with MSVC headers:
  #include <assert.h>
  static_assert(1, "true");

This is a non-conforming extension (the keyword is outside the
implementer's namespace), so it is placed under -fms-compatibility
instead of -fms-extensions like most MSVC-specific keyword extensions.

Normally, in C11, the compiler is supposed to provide the _Static_assert
keyword, and assert.h should define static_assert to _Static_assert.
However, that is not what MSVC does, and MSVC doesn't even provide
_Static_assert.

This also has the less important side effect of enabling static_assert
in C++98 mode with -fms-compatibility. It's exceptionally difficult to
use modern MSVC headers without C++14 even, so this is relatively
unimportant.

Fixes PR26672

Patch by Andrey Bokhanko!

Reviewers: rsmith, thakis

Subscribers: cfe-commits, STL_MSFT

Differential Revision: https://reviews.llvm.org/D17444

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354162 91177308-0d34-0410-b5e6-96231b3b80d8
4 files changed