Add back incorrectly dropped patch in previous commit

It turns out only part of it was upstreamed. Add the rest back to fix
the build with gcc 11 in rawhide.
This commit is contained in:
Kalev Lember 2021-01-09 20:17:20 +01:00
parent 1892939779
commit b2909fb1bf
2 changed files with 73 additions and 0 deletions

72
gtk4-gcc11.patch Normal file
View File

@ -0,0 +1,72 @@
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

View File

@ -23,6 +23,7 @@ Summary: GTK graphical user interface library
License: LGPLv2+
URL: https://www.gtk.org
Source0: https://download.gnome.org/sources/gtk/4.0/gtk-%{version}.tar.xz
Patch0: gtk4-gcc11.patch
BuildRequires: cups-devel
BuildRequires: desktop-file-utils