mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 23:24:16 +00:00
Merge branch 'wip/kalev/gcc-11' into 'master'
Avoid diagnostics for gcc-11 false positive out of bounds accesses See merge request GNOME/gtk!3064
This commit is contained in:
commit
5044031b53
@ -169,6 +169,12 @@ const GtkTextLineSegmentClass gtk_text_paintable_type = {
|
|||||||
GtkTextLineSegment *
|
GtkTextLineSegment *
|
||||||
_gtk_paintable_segment_new (GdkPaintable *paintable)
|
_gtk_paintable_segment_new (GdkPaintable *paintable)
|
||||||
{
|
{
|
||||||
|
/* gcc-11 issues a diagnostic here because the size allocated
|
||||||
|
for SEG does not cover the entire size of a GtkTextLineSegment
|
||||||
|
and gcc has no way to know that the union will only be used
|
||||||
|
for limited types and the additional space is not needed. */
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||||
GtkTextLineSegment *seg;
|
GtkTextLineSegment *seg;
|
||||||
guint flags;
|
guint flags;
|
||||||
|
|
||||||
@ -204,6 +210,7 @@ _gtk_paintable_segment_new (GdkPaintable *paintable)
|
|||||||
g_object_ref (paintable);
|
g_object_ref (paintable);
|
||||||
|
|
||||||
return seg;
|
return seg;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -280,6 +287,12 @@ const GtkTextLineSegmentClass gtk_text_child_type = {
|
|||||||
GtkTextLineSegment *
|
GtkTextLineSegment *
|
||||||
_gtk_widget_segment_new (GtkTextChildAnchor *anchor)
|
_gtk_widget_segment_new (GtkTextChildAnchor *anchor)
|
||||||
{
|
{
|
||||||
|
/* gcc-11 issues a diagnostic here because the size allocated
|
||||||
|
for SEG does not cover the entire size of a GtkTextLineSegment
|
||||||
|
and gcc has no way to know that the union will only be used
|
||||||
|
for limited types and the additional space is not needed. */
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||||
GtkTextLineSegment *seg;
|
GtkTextLineSegment *seg;
|
||||||
|
|
||||||
seg = g_slice_alloc (WIDGET_SEG_SIZE);
|
seg = g_slice_alloc (WIDGET_SEG_SIZE);
|
||||||
@ -303,6 +316,7 @@ _gtk_widget_segment_new (GtkTextChildAnchor *anchor)
|
|||||||
g_object_ref (anchor);
|
g_object_ref (anchor);
|
||||||
|
|
||||||
return seg;
|
return seg;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -425,6 +425,12 @@ char_segment_check_func (GtkTextLineSegment *segPtr, GtkTextLine *line)
|
|||||||
GtkTextLineSegment*
|
GtkTextLineSegment*
|
||||||
_gtk_toggle_segment_new (GtkTextTagInfo *info, gboolean on)
|
_gtk_toggle_segment_new (GtkTextTagInfo *info, gboolean on)
|
||||||
{
|
{
|
||||||
|
/* gcc-11 issues a diagnostic here because the size allocated
|
||||||
|
for SEG does not cover the entire size of a GtkTextLineSegment
|
||||||
|
and gcc has no way to know that the union will only be used
|
||||||
|
for limited types and the additional space is not needed. */
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||||
GtkTextLineSegment *seg;
|
GtkTextLineSegment *seg;
|
||||||
|
|
||||||
seg = g_slice_alloc (TSEG_SIZE);
|
seg = g_slice_alloc (TSEG_SIZE);
|
||||||
@ -440,6 +446,7 @@ _gtk_toggle_segment_new (GtkTextTagInfo *info, gboolean on)
|
|||||||
seg->body.toggle.inNodeCounts = 0;
|
seg->body.toggle.inNodeCounts = 0;
|
||||||
|
|
||||||
return seg;
|
return seg;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user