https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115185
--- Comment #19 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Wentao Zhang from comment #18) > > will get expanded to > > [POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD] = { > .prop_name = "CHARGE_CONTROL_START_THRESHOLD", > .attr_name = "j" "\0", > .text_values = ((void *)0), > .text_values_len = 0, > }, > > It still triggers the warning even if "\0" is explicitly specified and the > length is exactly MAX_PROP_NAME_LEN + 1 (31). Actually it gets expanded to something like: char t[31] = "CHARGE_CONTROL_START_THRESHOLD""\0"; Yes I think the above should not warn in the case of -Wunterminated-string-initialization but it should warn in the case of -Wc++-compat . Let me file a bug about that.