Index: /home/ggreif/llvm/tools/clang/lib/Sema/AttributeList.cpp
===================================================================
--- /home/ggreif/llvm/tools/clang/lib/Sema/AttributeList.cpp	(revision 116400)
+++ /home/ggreif/llvm/tools/clang/lib/Sema/AttributeList.cpp	(working copy)
@@ -54,6 +54,10 @@
   if (AttrName.startswith("__") && AttrName.endswith("__"))
     AttrName = AttrName.substr(2, AttrName.size() - 4);
 
+  // Else normalize the attribute name further, __bar becoming bar.
+  else if (AttrName.startswith("__"))
+    AttrName = AttrName.substr(2, AttrName.size() - 2);
+
   return llvm::StringSwitch<AttributeList::Kind>(AttrName)
     .Case("weak", AT_weak)
     .Case("weakref", AT_weakref)
Index: /home/ggreif/llvm/tools/clang/test/Sema/builtins.c
===================================================================
--- /home/ggreif/llvm/tools/clang/test/Sema/builtins.c	(revision 116400)
+++ /home/ggreif/llvm/tools/clang/test/Sema/builtins.c	(working copy)
@@ -37,7 +37,7 @@
 
 void test9(short v) {
   unsigned i, old;
-  
+
   old = __sync_fetch_and_add();  // expected-error {{too few arguments to function call}}
   old = __sync_fetch_and_add(&old);  // expected-error {{too few arguments to function call}}
   old = __sync_fetch_and_add((unsigned*)0, 42i); // expected-warning {{imaginary constants are an extension}}
@@ -56,14 +56,14 @@
 void test10(void) __attribute__((noreturn));
 
 void test10(void) {
-  __asm__("int3");  
+  __asm__("int3");
   __builtin_unreachable();
- 
+
   // No warning about falling off the end of a noreturn function.
 }
 
 void test11(int X) {
-  switch (X) {  
+  switch (X) {
   case __builtin_eh_return_data_regno(0):  // constant foldable.
     break;
   }
@@ -101,4 +101,10 @@
   return __builtin_constant_p() + // expected-error{{too few arguments}}
          __builtin_constant_p(1, 2); // expected-error {{too many arguments}}
 }
-  
+
+// PR8371
+void test17(void) __attribute__((__noreturn)); // no warning on __noreturn
+void test17(void) {
+  __builtin_trap();
+}
+
