i965: Fix build error with clang.

Technically, variable sized arrays are a required feature of C99,
redacted to be optional in C11, and not actually part of C++ whatsoever.

Gcc allows using them in C++ unless you specify -pedantic, and Clang
appears to allow them for simple/POD types.

exec_list is arguably POD, since it doesn't have virtual methods, but I
can see why Clang would be like "meh, it's a C++ struct, say no", seeing as
it's meant to support C99.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58970
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Kenneth Graunke 2013-01-08 12:46:05 -08:00
parent fea648db08
commit 2c4ad502ce
1 changed files with 7 additions and 3 deletions

View File

@ -70,7 +70,7 @@ class fs_copy_prop_dataflow
{
public:
fs_copy_prop_dataflow(void *mem_ctx, cfg_t *cfg,
exec_list out_acp[][ACP_HASH_SIZE]);
exec_list *out_acp[ACP_HASH_SIZE]);
void setup_kills();
void run();
@ -86,7 +86,7 @@ public:
} /* anonymous namespace */
fs_copy_prop_dataflow::fs_copy_prop_dataflow(void *mem_ctx, cfg_t *cfg,
exec_list out_acp[][ACP_HASH_SIZE])
exec_list *out_acp[ACP_HASH_SIZE])
: mem_ctx(mem_ctx), cfg(cfg)
{
bd = rzalloc_array(mem_ctx, struct block_data, cfg->num_blocks);
@ -429,7 +429,9 @@ fs_visitor::opt_copy_propagate()
bool progress = false;
void *mem_ctx = ralloc_context(this->mem_ctx);
cfg_t cfg(this);
exec_list out_acp[cfg.num_blocks][ACP_HASH_SIZE];
exec_list *out_acp[cfg.num_blocks];
for (int i = 0; i < cfg.num_blocks; i++)
out_acp[i] = new exec_list [ACP_HASH_SIZE];
/* First, walk through each block doing local copy propagation and getting
* the set of copies available at the end of the block.
@ -461,6 +463,8 @@ fs_visitor::opt_copy_propagate()
progress = opt_copy_propagate_local(mem_ctx, block, in_acp) || progress;
}
for (int i = 0; i < cfg.num_blocks; i++)
delete [] out_acp[i];
ralloc_free(mem_ctx);
if (progress)