Avoid diagnostics for gcc-11 false positive out of bounds accesses
This commit is contained in:
parent
b1d7ca744e
commit
05e46452c9
@ -11,3 +11,75 @@ index 063b8d0..cb4c9ac 100644
|
|||||||
|
|
||||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||||
{
|
{
|
||||||
|
diff --git a/gtk/gtktextchild.c b/gtk/gtktextchild.c
|
||||||
|
index 4d5e30e..915b991 100644
|
||||||
|
--- a/gtk/gtktextchild.c
|
||||||
|
+++ b/gtk/gtktextchild.c
|
||||||
|
@@ -169,6 +169,12 @@ const GtkTextLineSegmentClass gtk_text_paintable_type = {
|
||||||
|
GtkTextLineSegment *
|
||||||
|
_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;
|
||||||
|
guint flags;
|
||||||
|
|
||||||
|
@@ -204,6 +210,7 @@ _gtk_paintable_segment_new (GdkPaintable *paintable)
|
||||||
|
g_object_ref (paintable);
|
||||||
|
|
||||||
|
return seg;
|
||||||
|
+#pragma GCC diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -280,6 +287,12 @@ const GtkTextLineSegmentClass gtk_text_child_type = {
|
||||||
|
GtkTextLineSegment *
|
||||||
|
_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;
|
||||||
|
|
||||||
|
seg = g_slice_alloc (WIDGET_SEG_SIZE);
|
||||||
|
@@ -303,6 +316,7 @@ _gtk_widget_segment_new (GtkTextChildAnchor *anchor)
|
||||||
|
g_object_ref (anchor);
|
||||||
|
|
||||||
|
return seg;
|
||||||
|
+#pragma GCC diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
diff --git a/gtk/gtktextsegment.c b/gtk/gtktextsegment.c
|
||||||
|
index a202ab6..aaac291 100644
|
||||||
|
--- a/gtk/gtktextsegment.c
|
||||||
|
+++ b/gtk/gtktextsegment.c
|
||||||
|
@@ -425,6 +425,13 @@ char_segment_check_func (GtkTextLineSegment *segPtr, GtkTextLine *line)
|
||||||
|
GtkTextLineSegment*
|
||||||
|
_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;
|
||||||
|
|
||||||
|
seg = g_slice_alloc (TSEG_SIZE);
|
||||||
|
@@ -440,6 +447,7 @@ _gtk_toggle_segment_new (GtkTextTagInfo *info, gboolean on)
|
||||||
|
seg->body.toggle.inNodeCounts = 0;
|
||||||
|
|
||||||
|
return seg;
|
||||||
|
+#pragma GCC diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
Name: gtk4
|
Name: gtk4
|
||||||
Version: 3.99.4
|
Version: 3.99.4
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: GTK graphical user interface library
|
Summary: GTK graphical user interface library
|
||||||
|
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
@ -218,6 +218,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
|
|||||||
%{_mandir}/man1/gtk4-widget-factory.1*
|
%{_mandir}/man1/gtk4-widget-factory.1*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Dec 09 2020 Jeff Law <law@redhat.com> - 3.99.4-3
|
||||||
|
- Avoid diagnostics for gcc-11 false positive out of bounds accesses
|
||||||
|
|
||||||
* Sun Nov 15 2020 Jeff Law <law@redhat.com> - 3.99.4-2
|
* Sun Nov 15 2020 Jeff Law <law@redhat.com> - 3.99.4-2
|
||||||
- Fix bogus volatile caught by gcc-11
|
- Fix bogus volatile caught by gcc-11
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user