summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
diff options
context:
space:
mode:
authorAndrey Bokhanko <andreybokhanko@gmail.com>2016-04-15 08:03:51 +0000
committerAndrey Bokhanko <andreybokhanko@gmail.com>2016-04-15 08:03:51 +0000
commitf7fa634887cf327ebca2a71327631ee00f0057a8 (patch)
tree6115bdd74d32215b36ca02a348f2eb780a95b716 /clang/test/Sema
parent18e69f4f635434eefadb35caffef71d2b429933c (diff)
downloadbcm5719-llvm-f7fa634887cf327ebca2a71327631ee00f0057a8.tar.gz
bcm5719-llvm-f7fa634887cf327ebca2a71327631ee00f0057a8.zip
[MSVC Compat] Implementation of __unaligned (MS extension) as a type qualifier
This patch implements __unaligned as a type qualifier; before that, it was modeled as an attribute. Proper mangling of __unaligned is implemented as well. Some OpenCL code/tests are tangenially affected, as they relied on existing number and sizes of type qualifiers. Differential Revision: http://reviews.llvm.org/D18596 llvm-svn: 266415
Diffstat (limited to 'clang/test/Sema')
-rw-r--r--clang/test/Sema/MicrosoftExtensions.c8
-rw-r--r--clang/test/Sema/address_spaces.c4
-rw-r--r--clang/test/Sema/invalid-assignment-constant-address-space.c2
3 files changed, 11 insertions, 3 deletions
diff --git a/clang/test/Sema/MicrosoftExtensions.c b/clang/test/Sema/MicrosoftExtensions.c
index e7032305fc0..713daf5593f 100644
--- a/clang/test/Sema/MicrosoftExtensions.c
+++ b/clang/test/Sema/MicrosoftExtensions.c
@@ -170,3 +170,11 @@ void myprintf(const char *f, ...) {
__va_start(ap, f); // expected-warning {{incompatible pointer types passing 'my_va_list'}}
}
}
+
+// __unaligned handling
+void test_unaligned() {
+ __unaligned int *p1 = 0;
+ int *p2 = p1; // expected-warning {{initializing 'int *' with an expression of type '__unaligned int *' discards qualifiers}}
+ __unaligned int *p3 = p2;
+}
+
diff --git a/clang/test/Sema/address_spaces.c b/clang/test/Sema/address_spaces.c
index 1922c8ae4f6..3fe93155451 100644
--- a/clang/test/Sema/address_spaces.c
+++ b/clang/test/Sema/address_spaces.c
@@ -20,7 +20,7 @@ void foo(_AS3 float *a,
_AS1 int arrarr[5][5]; // expected-error {{automatic variable qualified with an address space}}
__attribute__((address_space(-1))) int *_boundsA; // expected-error {{address space is negative}}
- __attribute__((address_space(0xFFFFFF))) int *_boundsB;
+ __attribute__((address_space(0x7FFFFF))) int *_boundsB;
__attribute__((address_space(0x1000000))) int *_boundsC; // expected-error {{address space is larger than the maximum supported}}
// chosen specifically to overflow 32 bits and come out reasonable
__attribute__((address_space(4294967500))) int *_boundsD; // expected-error {{address space is larger than the maximum supported}}
@@ -71,4 +71,4 @@ __attribute__((address_space("12"))) int *i; // expected-error {{'address_space'
// Clang extension doesn't forbid operations on pointers to different address spaces.
char* cmp(_AS1 char *x, _AS2 char *y) {
return x < y ? x : y; // expected-warning {{pointer type mismatch ('__attribute__((address_space(1))) char *' and '__attribute__((address_space(2))) char *')}}
-} \ No newline at end of file
+}
diff --git a/clang/test/Sema/invalid-assignment-constant-address-space.c b/clang/test/Sema/invalid-assignment-constant-address-space.c
index de2af64d00e..77d6b331c20 100644
--- a/clang/test/Sema/invalid-assignment-constant-address-space.c
+++ b/clang/test/Sema/invalid-assignment-constant-address-space.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
-#define OPENCL_CONSTANT 16776962
+#define OPENCL_CONSTANT 8388354
int __attribute__((address_space(OPENCL_CONSTANT))) c[3] = {0};
void foo() {
OpenPOWER on IntegriCloud