[Piglit] [PATCH 2/3] Use alloca instead of variable length arrays
Jan Vesely
jan.vesely at rutgers.edu
Fri Dec 12 11:33:23 PST 2014
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c | 2 +-
tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c | 2 +-
tests/spec/ext_image_dma_buf_import/invalid_attributes.c | 2 +-
tests/spec/ext_image_dma_buf_import/invalid_hints.c | 2 +-
tests/spec/ext_image_dma_buf_import/missing_attributes.c | 2 +-
tests/spec/ext_image_dma_buf_import/ownership_transfer.c | 2 +-
tests/util/piglit-util.h | 2 ++
7 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c
index cc4f96e..e4b15a5 100644
--- a/tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c
+++ b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c
@@ -101,7 +101,7 @@ piglit_display(void)
const unsigned w = 2;
const unsigned h = 2;
const unsigned cpp = 4;
- const unsigned char pixels[w * h * cpp];
+ const unsigned char *pixels = alloca(w * h * cpp);
struct piglit_dma_buf *buf;
unsigned stride;
unsigned offset;
diff --git a/tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c b/tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c
index 836a7fe..7966291 100644
--- a/tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c
+++ b/tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c
@@ -62,7 +62,7 @@ piglit_display(void)
const unsigned w = 2;
const unsigned h = 2;
const unsigned cpp = 4;
- const unsigned char pixels[w * h * cpp];
+ const unsigned char *pixels = alloca(w * h * cpp);
struct piglit_dma_buf *buf;
unsigned stride;
unsigned offset;
diff --git a/tests/spec/ext_image_dma_buf_import/invalid_attributes.c b/tests/spec/ext_image_dma_buf_import/invalid_attributes.c
index 8c44298..b77e47b 100644
--- a/tests/spec/ext_image_dma_buf_import/invalid_attributes.c
+++ b/tests/spec/ext_image_dma_buf_import/invalid_attributes.c
@@ -209,7 +209,7 @@ piglit_display(void)
const unsigned w = 2;
const unsigned h = 2;
const unsigned cpp = 4;
- const unsigned char pixels[w * h * cpp];
+ const unsigned char *pixels = alloca(w * h * cpp);
struct piglit_dma_buf *buf;
unsigned stride;
unsigned offset;
diff --git a/tests/spec/ext_image_dma_buf_import/invalid_hints.c b/tests/spec/ext_image_dma_buf_import/invalid_hints.c
index c1c9be3..fa006f0 100644
--- a/tests/spec/ext_image_dma_buf_import/invalid_hints.c
+++ b/tests/spec/ext_image_dma_buf_import/invalid_hints.c
@@ -97,7 +97,7 @@ piglit_display(void)
const unsigned w = 2;
const unsigned h = 2;
const unsigned cpp = 4;
- const unsigned char pixels[w * h * cpp];
+ const unsigned char *pixels = alloca(w * h * cpp);
struct piglit_dma_buf *buf;
unsigned stride;
unsigned offset;
diff --git a/tests/spec/ext_image_dma_buf_import/missing_attributes.c b/tests/spec/ext_image_dma_buf_import/missing_attributes.c
index a0309d6..d7d89e6 100644
--- a/tests/spec/ext_image_dma_buf_import/missing_attributes.c
+++ b/tests/spec/ext_image_dma_buf_import/missing_attributes.c
@@ -105,7 +105,7 @@ piglit_display(void)
const unsigned w = 2;
const unsigned h = 2;
const unsigned cpp = 2;
- const unsigned char pixels[w * h * cpp];
+ const unsigned char *pixels = alloca(w * h * cpp);
EGLint all[2 * NUM_MANDATORY_ATTRS];
EGLint missing[2 * (NUM_MANDATORY_ATTRS - 1) + 1];
struct piglit_dma_buf *buf;
diff --git a/tests/spec/ext_image_dma_buf_import/ownership_transfer.c b/tests/spec/ext_image_dma_buf_import/ownership_transfer.c
index cfcf56f..2da455b 100644
--- a/tests/spec/ext_image_dma_buf_import/ownership_transfer.c
+++ b/tests/spec/ext_image_dma_buf_import/ownership_transfer.c
@@ -113,7 +113,7 @@ piglit_display(void)
const unsigned w = 2;
const unsigned h = 2;
const unsigned cpp = 4;
- const unsigned char pixels[w * h* cpp];
+ const unsigned char *pixels = alloca(w * h * cpp);
struct piglit_dma_buf *buf;
unsigned stride;
unsigned offset;
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index e869dc2..5b82807 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -70,6 +70,8 @@ extern "C" {
#define snprintf _snprintf
+#define alloca _alloca
+
#endif /* defined(_MSC_VER) */
#ifdef _WIN32
--
2.1.0
More information about the Piglit
mailing list