cgen: remove unnecessary parens for ptr-to-array

This commit is contained in:
Nigel Tao committed 2023-06-13 22:39:21 +10:00
1 parent 43beae1d3d
commit 724aec33df
2 files changed
+11 -5

No files matched your search

+8 -2
View File
@@ -586,7 +586,11 @@ func (g *gen) writeCTypeName(b *buffer, n *a.TypeExpr, varNamePrefix string, var
}
if isPointerToArray {
b.writes("(*")
if x.Inner().Inner().IsNumType() {
b.writes("*")
} else {
b.writes("(*")
}
} else {
for i := 0; i < numPointers; i++ {
b.writeb('*')
@@ -601,8 +605,10 @@ func (g *gen) writeCTypeName(b *buffer, n *a.TypeExpr, varNamePrefix string, var
x = n
if isPointerToArray {
b.writes(")")
x = x.Inner().Inner()
if !x.IsNumType() {
b.writes(")")
}
}
for ; x != nil && x.IsEitherArrayType(); x = x.Inner() {
b.writeb('[')
+3 -3
View File
@@ -41586,7 +41586,7 @@ wuffs_jpeg__decoder__decode_mcu__choosy_default(
uint32_t v_dc_blm1 = 0;
uint32_t v_dc_ht_slow = 0;
uint32_t v_dc_value = 0;
const uint16_t(* v_ac_huff_table_fast) = NULL;
const uint16_t* v_ac_huff_table_fast = NULL;
uint8_t v_ac_h = 0;
uint32_t v_ac_symbol = 0;
uint32_t v_ac_ht_fast = 0;
@@ -41790,7 +41790,7 @@ wuffs_jpeg__decoder__decode_mcu_progressive_ac_high_bits(
const uint8_t* io1_v_r WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_v_r WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint32_t v_pos = 0;
const uint16_t(* v_ac_huff_table_fast) = NULL;
const uint16_t* v_ac_huff_table_fast = NULL;
uint8_t v_ac_h = 0;
uint32_t v_ac_symbol = 0;
uint32_t v_ac_ht_fast = 0;
@@ -41948,7 +41948,7 @@ wuffs_jpeg__decoder__decode_mcu_progressive_ac_low_bit(
const uint8_t* io1_v_r WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_v_r WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint32_t v_pos = 0;
const uint16_t(* v_ac_huff_table_fast) = NULL;
const uint16_t* v_ac_huff_table_fast = NULL;
uint8_t v_ac_h = 0;
uint32_t v_ac_symbol = 0;
uint32_t v_ac_ht_fast = 0;