microsoft/compiler: Misc fixes caught by GCC

* Fix const-correctness on dxil_mdnode pointer arrays
* Fix warning for a missing scope in a case block

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780>
This commit is contained in:
Jesse Natalie
2020-12-01 08:44:40 -08:00
committed by Marge Bot
parent 456620a6ad
commit e593329b0c
5 changed files with 17 additions and 16 deletions

View File

@@ -649,7 +649,7 @@ dump_mdnodes(struct dxil_dumper *d, struct list_head *list)
}
static void
dump_mdnode(struct dxil_dumper *d, struct dxil_mdnode *node)
dump_mdnode(struct dxil_dumper *d, const struct dxil_mdnode *node)
{
dxil_dump_indent(d);
switch (node->type) {

View File

@@ -50,7 +50,7 @@ dump_instrs(struct dxil_dumper *buf, struct list_head *list);
static void
dump_mdnodes(struct dxil_dumper *buf, struct list_head *list);
static void
dump_mdnode(struct dxil_dumper *d, struct dxil_mdnode *node);
dump_mdnode(struct dxil_dumper *d, const struct dxil_mdnode *node);
static void
dump_named_nodes(struct dxil_dumper *d, struct list_head *list);
static void

View File

@@ -281,7 +281,7 @@ struct dxil_mdnode {
} value;
struct {
struct dxil_mdnode **subnodes;
const struct dxil_mdnode **subnodes;
size_t num_subnodes;
} node;
};
@@ -292,7 +292,7 @@ struct dxil_mdnode {
struct dxil_named_node {
char *name;
struct dxil_mdnode **subnodes;
const struct dxil_mdnode **subnodes;
size_t num_subnodes;
struct list_head head;
};

View File

@@ -2273,12 +2273,12 @@ dxil_get_metadata_node(struct dxil_module *m,
n = create_mdnode(m, MD_NODE);
if (n) {
n->node.subnodes = ralloc_array(n, struct dxil_mdnode *, num_subnodes);
if (!n->node.subnodes)
void *tmp = ralloc_array(n, struct dxil_mdnode *, num_subnodes);
if (!tmp)
return NULL;
memcpy(n->node.subnodes, subnodes, sizeof(struct dxil_mdnode *) *
num_subnodes);
memcpy(tmp, subnodes, sizeof(struct dxil_mdnode *) * num_subnodes);
n->node.subnodes = tmp;
n->node.num_subnodes = num_subnodes;
}
return n;
@@ -2354,12 +2354,12 @@ dxil_add_metadata_named_node(struct dxil_module *m, const char *name,
if (!n->name)
return false;
n->subnodes = ralloc_array(n, struct dxil_mdnode *, num_subnodes);
if (!n->subnodes)
void *tmp = ralloc_array(n, struct dxil_mdnode *, num_subnodes);
if (!tmp)
return false;
memcpy(n->subnodes, subnodes, sizeof(struct dxil_mdnode *) *
num_subnodes);
memcpy(tmp, subnodes, sizeof(struct dxil_mdnode *) * num_subnodes);
n->subnodes = tmp;
n->num_subnodes = num_subnodes;
list_addtail(&n->head, &m->md_named_node_list);

View File

@@ -88,7 +88,7 @@ load_comps_to_vec32(nir_builder *b, unsigned src_bit_size,
vec32comps[i] = src_comps[i];
break;
case 16:
case 8:
case 8: {
unsigned src_offs = i * comps_per32b;
vec32comps[i] = nir_u2u32(b, src_comps[src_offs]);
@@ -100,6 +100,7 @@ load_comps_to_vec32(nir_builder *b, unsigned src_bit_size,
break;
}
}
}
return nir_vec(b, vec32comps, num_vec32comps);
}