r181810 - Really fix the declaration of __clear_cache.

Rafael Espindola rafael.espindola at gmail.com
Tue May 14 11:06:10 PDT 2013


Author: rafael
Date: Tue May 14 13:06:10 2013
New Revision: 181810

URL: http://llvm.org/viewvc/llvm-project?rev=181810&view=rev
Log:
Really fix the declaration of __clear_cache.

When I tested gcc's behaviour before, I forgot the extern "C", so it
would warn when the types *did* match.

So in the end
* __clear_cache takes two void pointers.
* aarch64 was correct before.
* libgcc's manual is wrong.
* this patch fixes arm.

Modified:
    cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
    cfe/trunk/include/clang/Basic/BuiltinsARM.def
    cfe/trunk/test/Sema/builtins-aarch64.c
    cfe/trunk/test/Sema/builtins-arm.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=181810&r1=181809&r2=181810&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Tue May 14 13:06:10 2013
@@ -15,4 +15,4 @@
 // The format of this database matches clang/Basic/Builtins.def.
 
 // In libgcc
-BUILTIN(__clear_cache, "vc*c*", "")
+BUILTIN(__clear_cache, "vv*v*", "")

Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=181810&r1=181809&r2=181810&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Tue May 14 13:06:10 2013
@@ -15,7 +15,7 @@
 // The format of this database matches clang/Basic/Builtins.def.
 
 // In libgcc
-BUILTIN(__clear_cache, "vc*c*", "")
+BUILTIN(__clear_cache, "vv*v*", "")
 BUILTIN(__builtin_thread_pointer, "v*", "")
 
 // Saturating arithmetic

Modified: cfe/trunk/test/Sema/builtins-aarch64.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/builtins-aarch64.c?rev=181810&r1=181809&r2=181810&view=diff
==============================================================================
--- cfe/trunk/test/Sema/builtins-aarch64.c (original)
+++ cfe/trunk/test/Sema/builtins-aarch64.c Tue May 14 13:06:10 2013
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -DTEST1 -fsyntax-only -verify %s
 
 #ifdef TEST1
-void __clear_cache(char *start, char *end);
+void __clear_cache(void *start, void *end);
 #endif
 
 void test_clear_cache_chars(char *start, char *end) {

Modified: cfe/trunk/test/Sema/builtins-arm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/builtins-arm.c?rev=181810&r1=181809&r2=181810&view=diff
==============================================================================
--- cfe/trunk/test/Sema/builtins-arm.c (original)
+++ cfe/trunk/test/Sema/builtins-arm.c Tue May 14 13:06:10 2013
@@ -2,14 +2,14 @@
 // RUN: %clang_cc1 -triple armv7 -target-abi apcs-gnu \
 // RUN:   -fsyntax-only -verify %s
 
-void f(char *a, char *b) {
-  __clear_cache(); // expected-error {{too few arguments to function call, expected 2, have 0}} // expected-note {{'__clear_cache' is a builtin with type 'void (char *, char *)}}
+void f(void *a, void *b) {
+  __clear_cache(); // expected-error {{too few arguments to function call, expected 2, have 0}} // expected-note {{'__clear_cache' is a builtin with type 'void (void *, void *)}}
   __clear_cache(a); // expected-error {{too few arguments to function call, expected 2, have 1}}
   __clear_cache(a, b);
 }
 
-void __clear_cache(void*, void*); // expected-error {{conflicting types for '__clear_cache'}}
-void __clear_cache(char*, char*);
+void __clear_cache(char*, char*); // expected-error {{conflicting types for '__clear_cache'}}
+void __clear_cache(void*, void*);
 
 #if defined(__ARM_PCS) || defined(__ARM_EABI__)
 // va_list on ARM AAPCS is struct { void* __ap }.





More information about the cfe-commits mailing list