]> granicus.if.org Git - clang/commit
Reapply: Silence false positive diagnostics regarding passing an object of enumeratio...
authorAaron Ballman <aaron@aaronballman.com>
Thu, 15 Sep 2016 18:07:51 +0000 (18:07 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 15 Sep 2016 18:07:51 +0000 (18:07 +0000)
commit614458efc4072fc12d2b34cc26db2123bf23638a
tree675a89429e180a34193951281afbcbb8417f78d1
parent4de9f91b652c1cb7f248d15e0c5f5bb5f1059895
Reapply: Silence false positive diagnostics regarding passing an object of enumeration type to va_start().

The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former.

This patch addresses PR29140.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281632 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaChecking.cpp
test/Sema/varargs.c