Skip to content

Commit

Permalink
test: dump_bytecode: Squash clang cast increases alignment warnings
Browse files Browse the repository at this point in the history
We have codeptr as a pointer to our place in the calc lwc_string
data. This pointer is of type uint8_t.

We then cast back to css_code_t, css_fixed, and uint32_t. Now we
cast back to them through void.
  • Loading branch information
tlsa committed May 27, 2024
1 parent d991ff1 commit 3ac1c5e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*ptr += sprintf(*ptr, "/* -> ");
dump_unit(0, unit, ptr);
*ptr += sprintf(*ptr, " */ calc(");
while ((calc_opcode = *((css_code_t *)codeptr)) != CALC_FINISH) {
while ((calc_opcode = *((css_code_t *)(void *)codeptr)) != CALC_FINISH) {
codeptr += sizeof(calc_opcode);
switch (calc_opcode) {
case CALC_ADD:
Expand All @@ -836,16 +836,16 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*ptr += sprintf(*ptr, "/ ");
break;
case CALC_PUSH_VALUE: {
css_fixed num = *((css_fixed *)codeptr);
css_fixed num = *((css_fixed *)(void *)codeptr);
codeptr += sizeof(num);
uint32_t unit = *((uint32_t *)codeptr);
uint32_t unit = *((uint32_t *)(void *)codeptr);
codeptr += sizeof(unit);
dump_unit(num, unit, ptr);
*ptr += sprintf(*ptr, " ");
break;
}
case CALC_PUSH_NUMBER: {
css_fixed num = *((css_fixed *)codeptr);
css_fixed num = *((css_fixed *)(void *)codeptr);
codeptr += sizeof(num);
dump_number(num, ptr);
*ptr += sprintf(*ptr, " ");
Expand Down

0 comments on commit 3ac1c5e

Please sign in to comment.