Commit 15d3974b by Jakub Jelinek Committed by Jakub Jelinek

gimple-ssa-warn-restrict.c (maybe_diag_overlap): Use warning_n instead of…

gimple-ssa-warn-restrict.c (maybe_diag_overlap): Use warning_n instead of warning_at with conditional singular and plural...

	* gimple-ssa-warn-restrict.c (maybe_diag_overlap): Use warning_n
	instead of warning_at with conditional singular and plural messages
	where possible.

From-SVN: r258078
parent be583c04
2018-02-28 Jakub Jelinek <jakub@redhat.com> 2018-02-28 Jakub Jelinek <jakub@redhat.com>
* gimple-ssa-warn-restrict.c (maybe_diag_overlap): Use warning_n
instead of warning_at with conditional singular and plural messages
where possible.
PR target/52991 PR target/52991
* stor-layout.c (update_alignment_for_field): For * stor-layout.c (update_alignment_for_field): For
targetm.ms_bitfield_layout_p (rli->t), if !is_bitfield targetm.ms_bitfield_layout_p (rli->t), if !is_bitfield
......
...@@ -1399,24 +1399,21 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs) ...@@ -1399,24 +1399,21 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs)
call, func, sizrange[0], call, func, sizrange[0],
offstr[0], offstr[1], ovlsiz[0], offstr[2]); offstr[0], offstr[1], ovlsiz[0], offstr[2]);
else if (ovlsiz[1] >= 0 && ovlsiz[1] < maxobjsize.to_shwi ()) else if (ovlsiz[1] >= 0 && ovlsiz[1] < maxobjsize.to_shwi ())
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, sizrange[0],
sizrange[0] == 1 "%G%qD accessing %wu byte at offsets %s "
? G_("%G%qD accessing %wu byte at offsets %s "
"and %s overlaps between %wu and %wu bytes " "and %s overlaps between %wu and %wu bytes "
"at offset %s") "at offset %s",
: G_("%G%qD accessing %wu bytes at offsets %s " "%G%qD accessing %wu bytes at offsets %s "
"and %s overlaps between %wu and %wu bytes " "and %s overlaps between %wu and %wu bytes "
"at offset %s"), "at offset %s",
call, func, sizrange[0], call, func, sizrange[0], offstr[0], offstr[1],
offstr[0], offstr[1], ovlsiz[0], ovlsiz[1], ovlsiz[0], ovlsiz[1], offstr[2]);
offstr[2]);
else else
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, sizrange[0],
sizrange[0] == 1 "%G%qD accessing %wu byte at offsets %s and "
? G_("%G%qD accessing %wu byte at offsets %s and " "%s overlaps %wu or more bytes at offset %s",
"%s overlaps %wu or more bytes at offset %s") "%G%qD accessing %wu bytes at offsets %s and "
: G_("%G%qD accessing %wu bytes at offsets %s and " "%s overlaps %wu or more bytes at offset %s",
"%s overlaps %wu or more bytes at offset %s"),
call, func, sizrange[0], call, func, sizrange[0],
offstr[0], offstr[1], ovlsiz[0], offstr[2]); offstr[0], offstr[1], ovlsiz[0], offstr[2]);
return true; return true;
...@@ -1425,14 +1422,13 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs) ...@@ -1425,14 +1422,13 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs)
if (sizrange[1] >= 0 && sizrange[1] < maxobjsize.to_shwi ()) if (sizrange[1] >= 0 && sizrange[1] < maxobjsize.to_shwi ())
{ {
if (ovlsiz[0] == ovlsiz[1]) if (ovlsiz[0] == ovlsiz[1])
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, ovlsiz[0],
ovlsiz[0] == 1 "%G%qD accessing between %wu and %wu bytes "
? G_("%G%qD accessing between %wu and %wu bytes "
"at offsets %s and %s overlaps %wu byte at " "at offsets %s and %s overlaps %wu byte at "
"offset %s") "offset %s",
: G_("%G%qD accessing between %wu and %wu bytes " "%G%qD accessing between %wu and %wu bytes "
"at offsets %s and %s overlaps %wu bytes " "at offsets %s and %s overlaps %wu bytes "
"at offset %s"), "at offset %s",
call, func, sizrange[0], sizrange[1], call, func, sizrange[0], sizrange[1],
offstr[0], offstr[1], ovlsiz[0], offstr[2]); offstr[0], offstr[1], ovlsiz[0], offstr[2]);
else if (ovlsiz[1] >= 0 && ovlsiz[1] < maxobjsize.to_shwi ()) else if (ovlsiz[1] >= 0 && ovlsiz[1] < maxobjsize.to_shwi ())
...@@ -1457,12 +1453,11 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs) ...@@ -1457,12 +1453,11 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs)
ovlsiz[1] = maxobjsize.to_shwi (); ovlsiz[1] = maxobjsize.to_shwi ();
if (ovlsiz[0] == ovlsiz[1]) if (ovlsiz[0] == ovlsiz[1])
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, ovlsiz[0],
ovlsiz[0] == 1 "%G%qD accessing %wu or more bytes at offsets "
? G_("%G%qD accessing %wu or more bytes at offsets " "%s and %s overlaps %wu byte at offset %s",
"%s and %s overlaps %wu byte at offset %s") "%G%qD accessing %wu or more bytes at offsets "
: G_("%G%qD accessing %wu or more bytes at offsets " "%s and %s overlaps %wu bytes at offset %s",
"%s and %s overlaps %wu bytes at offset %s"),
call, func, sizrange[0], offstr[0], offstr[1], call, func, sizrange[0], offstr[0], offstr[1],
ovlsiz[0], offstr[2]); ovlsiz[0], offstr[2]);
else if (ovlsiz[1] >= 0 && ovlsiz[1] < maxobjsize.to_shwi ()) else if (ovlsiz[1] >= 0 && ovlsiz[1] < maxobjsize.to_shwi ())
...@@ -1501,40 +1496,36 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs) ...@@ -1501,40 +1496,36 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs)
if (ovlsiz[1] == 1) if (ovlsiz[1] == 1)
{ {
if (open_range) if (open_range)
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, sizrange[1],
sizrange[1] == 1 "%G%qD accessing %wu byte may overlap "
? G_("%G%qD accessing %wu byte may overlap " "%wu byte",
"%wu byte") "%G%qD accessing %wu bytes may overlap "
: G_("%G%qD accessing %wu bytes may overlap " "%wu byte",
"%wu byte"),
call, func, sizrange[1], ovlsiz[1]); call, func, sizrange[1], ovlsiz[1]);
else else
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, sizrange[1],
sizrange[1] == 1 "%G%qD accessing %wu byte at offsets %s "
? G_("%G%qD accessing %wu byte at offsets %s " "and %s may overlap %wu byte at offset %s",
"and %s may overlap %wu byte at offset %s") "%G%qD accessing %wu bytes at offsets %s "
: G_("%G%qD accessing %wu bytes at offsets %s " "and %s may overlap %wu byte at offset %s",
"and %s may overlap %wu byte at offset %s"),
call, func, sizrange[1], offstr[0], offstr[1], call, func, sizrange[1], offstr[0], offstr[1],
ovlsiz[1], offstr[2]); ovlsiz[1], offstr[2]);
return true; return true;
} }
if (open_range) if (open_range)
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, sizrange[1],
sizrange[1] == 1 "%G%qD accessing %wu byte may overlap "
? G_("%G%qD accessing %wu byte may overlap " "up to %wu bytes",
"up to %wu bytes") "%G%qD accessing %wu bytes may overlap "
: G_("%G%qD accessing %wu bytes may overlap " "up to %wu bytes",
"up to %wu bytes"),
call, func, sizrange[1], ovlsiz[1]); call, func, sizrange[1], ovlsiz[1]);
else else
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, sizrange[1],
sizrange[1] == 1 "%G%qD accessing %wu byte at offsets %s and "
? G_("%G%qD accessing %wu byte at offsets %s and " "%s may overlap up to %wu bytes at offset %s",
"%s may overlap up to %wu bytes at offset %s") "%G%qD accessing %wu bytes at offsets %s and "
: G_("%G%qD accessing %wu bytes at offsets %s and " "%s may overlap up to %wu bytes at offset %s",
"%s may overlap up to %wu bytes at offset %s"),
call, func, sizrange[1], offstr[0], offstr[1], call, func, sizrange[1], offstr[0], offstr[1],
ovlsiz[1], offstr[2]); ovlsiz[1], offstr[2]);
return true; return true;
...@@ -1543,33 +1534,30 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs) ...@@ -1543,33 +1534,30 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs)
if (sizrange[1] >= 0 && sizrange[1] < maxobjsize.to_shwi ()) if (sizrange[1] >= 0 && sizrange[1] < maxobjsize.to_shwi ())
{ {
if (open_range) if (open_range)
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, ovlsiz[1],
ovlsiz[1] == 1 "%G%qD accessing between %wu and %wu bytes "
? G_("%G%qD accessing between %wu and %wu bytes " "may overlap %wu byte",
"may overlap %wu byte") "%G%qD accessing between %wu and %wu bytes "
: G_("%G%qD accessing between %wu and %wu bytes " "may overlap up to %wu bytes",
"may overlap up to %wu bytes"),
call, func, sizrange[0], sizrange[1], ovlsiz[1]); call, func, sizrange[0], sizrange[1], ovlsiz[1]);
else else
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, ovlsiz[1],
ovlsiz[1] == 1 "%G%qD accessing between %wu and %wu bytes "
? G_("%G%qD accessing between %wu and %wu bytes "
"at offsets %s and %s may overlap %wu byte " "at offsets %s and %s may overlap %wu byte "
"at offset %s") "at offset %s",
: G_("%G%qD accessing between %wu and %wu bytes " "%G%qD accessing between %wu and %wu bytes "
"at offsets %s and %s may overlap up to %wu " "at offsets %s and %s may overlap up to %wu "
"bytes at offset %s"), "bytes at offset %s",
call, func, sizrange[0], sizrange[1], call, func, sizrange[0], sizrange[1],
offstr[0], offstr[1], ovlsiz[1], offstr[2]); offstr[0], offstr[1], ovlsiz[1], offstr[2]);
return true; return true;
} }
warning_at (loc, OPT_Wrestrict, warning_n (loc, OPT_Wrestrict, ovlsiz[1],
ovlsiz[1] == 1 "%G%qD accessing %wu or more bytes at offsets %s "
? G_("%G%qD accessing %wu or more bytes at offsets %s " "and %s may overlap %wu byte at offset %s",
"and %s may overlap %wu byte at offset %s") "%G%qD accessing %wu or more bytes at offsets %s "
: G_("%G%qD accessing %wu or more bytes at offsets %s " "and %s may overlap up to %wu bytes at offset %s",
"and %s may overlap up to %wu bytes at offset %s"),
call, func, sizrange[0], offstr[0], offstr[1], call, func, sizrange[0], offstr[0], offstr[1],
ovlsiz[1], offstr[2]); ovlsiz[1], offstr[2]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment