aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2012-11-30 12:38:54 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-11-30 12:38:54 -0800
commitf7f66c5cfa9e6f7dd56edd3e30d95d64bcd22c17 (patch)
tree92cbf6ed20078148572c5beec0833f61c0fc296b
parent76572c63b8615b55a7883dcf40024653436be4c9 (diff)
parent68c072cfbb2430b55478350ac74aa5279ae4d9be (diff)
downloadslang-jb-mr1.1-release.tar.gz
am 68c072cf: Fix overly strict check for float3 in structures.android-cts-4.2_r2android-4.2.2_r1.2android-4.2.2_r1.1android-4.2.2_r1jb-mr1.1-release
* commit '68c072cfbb2430b55478350ac74aa5279ae4d9be': Fix overly strict check for float3 in structures.
-rw-r--r--slang_rs_export_type.cpp4
-rw-r--r--tests/P_static_struct/static_struct.rs11
-rw-r--r--tests/P_static_struct/stderr.txt.expect0
-rw-r--r--tests/P_static_struct/stdout.txt.expect1
4 files changed, 15 insertions, 1 deletions
diff --git a/slang_rs_export_type.cpp b/slang_rs_export_type.cpp
index 94bd6bb..ae13bf6 100644
--- a/slang_rs_export_type.cpp
+++ b/slang_rs_export_type.cpp
@@ -512,7 +512,9 @@ static bool ValidateTypeHelper(
const clang::Type *ElementType = GET_EXT_VECTOR_ELEMENT_TYPE(EVT);
if (TargetAPI < SLANG_ICS_TARGET_API &&
InCompositeType &&
- EVT->getNumElements() == 3) {
+ EVT->getNumElements() == 3 &&
+ ND &&
+ ND->getLinkage() == clang::ExternalLinkage) {
ReportTypeError(&C.getDiagnostics(), ND, NULL,
"structs containing vectors of dimension 3 cannot "
"be exported at this API level: '%0'");
diff --git a/tests/P_static_struct/static_struct.rs b/tests/P_static_struct/static_struct.rs
new file mode 100644
index 0000000..0b3e9ec
--- /dev/null
+++ b/tests/P_static_struct/static_struct.rs
@@ -0,0 +1,11 @@
+// -target-api 12
+#pragma version(1)
+#pragma rs java_package_name(com.example);
+
+typedef struct Plane_s {
+ float3 point;
+} Plane;
+
+static Plane carouselPlane = {
+ { 0.0f, 0.0f, 0.0f }
+};
diff --git a/tests/P_static_struct/stderr.txt.expect b/tests/P_static_struct/stderr.txt.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/P_static_struct/stderr.txt.expect
diff --git a/tests/P_static_struct/stdout.txt.expect b/tests/P_static_struct/stdout.txt.expect
new file mode 100644
index 0000000..9bf4e1c
--- /dev/null
+++ b/tests/P_static_struct/stdout.txt.expect
@@ -0,0 +1 @@
+Generating ScriptC_static_struct.java ...