From d1a98a01b8579faac2a53c32081df1453842e2fd Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Sun, 27 Jan 2019 07:54:48 +0100 Subject: [PATCH] Backport two fixes from upstream - calendar: Use the new "%OB" format if supported - Fix compiler warnings with GCC 8.1 https://bugzilla.redhat.com/show_bug.cgi?id=1669768 --- 0001-Fix-compiler-warnings-with-GCC-8.1.patch | 67 +++++++++++++++++++ ...r-Use-the-new-OB-format-if-supported.patch | 63 +++++++++++++++++ gtk2.spec | 18 +++-- 3 files changed, 141 insertions(+), 7 deletions(-) create mode 100644 0001-Fix-compiler-warnings-with-GCC-8.1.patch create mode 100644 0001-calendar-Use-the-new-OB-format-if-supported.patch diff --git a/0001-Fix-compiler-warnings-with-GCC-8.1.patch b/0001-Fix-compiler-warnings-with-GCC-8.1.patch new file mode 100644 index 0000000..52d3e87 --- /dev/null +++ b/0001-Fix-compiler-warnings-with-GCC-8.1.patch @@ -0,0 +1,67 @@ +From 889a63dffc72c048502d0f7d2b26bfc8532462eb Mon Sep 17 00:00:00 2001 +From: John Lindgren +Date: Tue, 15 May 2018 21:47:12 -0400 +Subject: [PATCH] Fix compiler warnings with GCC 8.1. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GCC 8.1 added some new warnings, including warning about parentheses +with no effect in variable declarations. GTK2 headers have a few of +these, which produce a lot of warnings in projects using GTK2. + +The warnings look like: +/usr/include/gtk-2.0/gtk/gtkfilechooserbutton.h:59:8: warning: +unnecessary parentheses in declaration of ‘__gtk_reserved1’ [-Wparentheses] + void (*__gtk_reserved1); + ^ + +Removing the parentheses is harmless and fixes the warnings. +--- + gtk/gtkfilechooserbutton.h | 14 +++++++------- + gtk/gtkstatusicon.h | 4 ++-- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/gtk/gtkfilechooserbutton.h b/gtk/gtkfilechooserbutton.h +index b3d9112cf9..fdacc4b6ec 100644 +--- a/gtk/gtkfilechooserbutton.h ++++ b/gtk/gtkfilechooserbutton.h +@@ -56,13 +56,13 @@ struct _GtkFileChooserButtonClass + + void (* file_set) (GtkFileChooserButton *fc); + +- void (*__gtk_reserved1); +- void (*__gtk_reserved2); +- void (*__gtk_reserved3); +- void (*__gtk_reserved4); +- void (*__gtk_reserved5); +- void (*__gtk_reserved6); +- void (*__gtk_reserved7); ++ void *__gtk_reserved1; ++ void *__gtk_reserved2; ++ void *__gtk_reserved3; ++ void *__gtk_reserved4; ++ void *__gtk_reserved5; ++ void *__gtk_reserved6; ++ void *__gtk_reserved7; + }; + + +diff --git a/gtk/gtkstatusicon.h b/gtk/gtkstatusicon.h +index 19dbd1cdeb..c45caca5ae 100644 +--- a/gtk/gtkstatusicon.h ++++ b/gtk/gtkstatusicon.h +@@ -73,8 +73,8 @@ struct _GtkStatusIconClass + gboolean keyboard_mode, + GtkTooltip *tooltip); + +- void (*__gtk_reserved1); +- void (*__gtk_reserved2); ++ void *__gtk_reserved1; ++ void *__gtk_reserved2; + }; + + GType gtk_status_icon_get_type (void) G_GNUC_CONST; +-- +2.20.1 + diff --git a/0001-calendar-Use-the-new-OB-format-if-supported.patch b/0001-calendar-Use-the-new-OB-format-if-supported.patch new file mode 100644 index 0000000..32be854 --- /dev/null +++ b/0001-calendar-Use-the-new-OB-format-if-supported.patch @@ -0,0 +1,63 @@ +From 2ea743ab466703091a44a74e1a4ac7db983c0bca Mon Sep 17 00:00:00 2001 +From: Rafal Luzynski +Date: Sat, 10 Feb 2018 14:07:56 +0100 +Subject: [PATCH] calendar: Use the new "%OB" format if supported + +Due to the recent changes introduced in glibc 2.27 "%OB" is the +correct format to obtain a month name as used in the calendar +header. The same rule has been working in BSD family (including +OS X) since 1990s. This simple hack checks whether "%OB" is supported +at runtime and uses it if it is, falls back to the old "%B" otherwise. + +Closes: #9 +--- + gtk/gtkcalendar.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c +index 2dd68d6394..28baba16f1 100644 +--- a/gtk/gtkcalendar.c ++++ b/gtk/gtkcalendar.c +@@ -689,6 +689,7 @@ gtk_calendar_init (GtkCalendar *calendar) + #ifdef G_OS_WIN32 + wchar_t wbuffer[100]; + #else ++ static const char *month_format = NULL; + char buffer[255]; + time_t tmp_time; + #endif +@@ -714,7 +715,7 @@ gtk_calendar_init (GtkCalendar *calendar) + { + #ifndef G_OS_WIN32 + tmp_time= (i+3)*86400; +- strftime ( buffer, sizeof (buffer), "%a", gmtime (&tmp_time)); ++ strftime (buffer, sizeof (buffer), "%a", gmtime (&tmp_time)); + default_abbreviated_dayname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL); + #else + if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SABBREVDAYNAME1 + (i+6)%7, +@@ -730,7 +731,21 @@ gtk_calendar_init (GtkCalendar *calendar) + { + #ifndef G_OS_WIN32 + tmp_time=i*2764800; +- strftime ( buffer, sizeof (buffer), "%B", gmtime (&tmp_time)); ++ if (G_UNLIKELY (month_format == NULL)) ++ { ++ buffer[0] = '\0'; ++ month_format = "%OB"; ++ strftime (buffer, sizeof (buffer), month_format, gmtime (&tmp_time)); ++ /* "%OB" is not supported in Linux with glibc < 2.27 */ ++ if (!strcmp (buffer, "%OB") || !strcmp (buffer, "OB") || !strcmp (buffer, "")) ++ { ++ month_format = "%B"; ++ strftime (buffer, sizeof (buffer), month_format, gmtime (&tmp_time)); ++ } ++ } ++ else ++ strftime (buffer, sizeof (buffer), month_format, gmtime (&tmp_time)); ++ + default_monthname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL); + #else + if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SMONTHNAME1 + i, +-- +2.20.1 + diff --git a/gtk2.spec b/gtk2.spec index f3432ec..5b69a6d 100644 --- a/gtk2.spec +++ b/gtk2.spec @@ -20,7 +20,7 @@ Summary: GTK+ graphical user interface library Name: gtk2 Version: 2.24.32 -Release: 3%{?dist} +Release: 4%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.gtk.org @@ -38,6 +38,10 @@ Patch8: tooltip-positioning.patch # https://bugzilla.gnome.org/show_bug.cgi?id=611313 Patch15: window-dragging.patch +# Backported from upstream: +Patch20: 0001-calendar-Use-the-new-OB-format-if-supported.patch +Patch21: 0001-Fix-compiler-warnings-with-GCC-8.1.patch + BuildRequires: pkgconfig(atk) >= %{atk_version} BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version} BuildRequires: pkgconfig(gobject-introspection-1.0) >= %{gobject_introspection_version} @@ -143,12 +147,7 @@ Requires: gtk2 = %{version}-%{release} This package contains developer documentation for the GTK+ widget toolkit. %prep -%setup -q -n gtk+-%{version} - -%patch1 -p1 -b .system-python -%patch2 -p1 -b .icon-padding -%patch8 -p1 -b .tooltip-positioning -%patch15 -p1 -b .window-dragging +%autosetup -n gtk+-%{version} -p1 %build export CFLAGS='-fno-strict-aliasing %optflags' @@ -324,6 +323,11 @@ gtk-query-immodules-2.0-%{__isa_bits} --update-cache %doc tmpdocs/examples %changelog +* Sun Jan 27 2019 Kalev Lember - 2.24.32-4 +- Backport two fixes from upstream (#1669768) +- calendar: Use the new "%OB" format if supported +- Fix compiler warnings with GCC 8.1 + * Fri Jul 13 2018 Fedora Release Engineering - 2.24.32-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild