Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame^] | 1 | From 6697fcf9d7f53126b442bf19890640b5f88c8aa4 Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com> |
| 3 | Date: Fri, 29 Jul 2016 21:24:20 +0200 |
| 4 | Subject: [PATCH] suppress string format literal warning to fix build with gcc6 |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | works around: |
| 10 | | ../../libgnomeui-2.24.5/libgnomeui/gnome-dateedit.c: In function 'day_selected': |
| 11 | | ../../libgnomeui-2.24.5/libgnomeui/gnome-dateedit.c:156:9: error: format not a string literal, format string not checked [-Werror=format-nonliteral] |
| 12 | | strftime_date_format, &mtm) == 0) |
| 13 | | ^~~~~~~~~~~~~~~~~~~~ |
| 14 | | ../../libgnomeui-2.24.5/libgnomeui/gnome-dateedit.c: In function 'gnome_date_edit_set_time': |
| 15 | | ../../libgnomeui-2.24.5/libgnomeui/gnome-dateedit.c:704:2: error: format not a string literal, format string not checked [-Werror=format-nonliteral] |
| 16 | | if (strftime (buffer, sizeof (buffer), strftime_date_format, mytm) == 0) |
| 17 | | ^~ |
| 18 | |
| 19 | Upstream-Status: Pending |
| 20 | |
| 21 | Signed-off-by: Andreas MΓΌller <schnitzeltony@googlemail.com> |
| 22 | --- |
| 23 | libgnomeui/gnome-dateedit.c | 6 ++++++ |
| 24 | libgnomeui/gnome-gconf-ui.c | 3 +++ |
| 25 | 2 files changed, 9 insertions(+) |
| 26 | |
| 27 | diff --git a/libgnomeui/gnome-dateedit.c b/libgnomeui/gnome-dateedit.c |
| 28 | index 69ab699..41541c3 100644 |
| 29 | --- a/libgnomeui/gnome-dateedit.c |
| 30 | +++ b/libgnomeui/gnome-dateedit.c |
| 31 | @@ -152,9 +152,12 @@ day_selected (GtkCalendar *calendar, GnomeDateEdit *gde) |
| 32 | else |
| 33 | mtm.tm_year = year; |
| 34 | |
| 35 | +#pragma GCC diagnostic push |
| 36 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" |
| 37 | if (strftime (buffer, sizeof (buffer), |
| 38 | strftime_date_format, &mtm) == 0) |
| 39 | strcpy (buffer, "???"); |
| 40 | +#pragma GCC diagnostic pop |
| 41 | buffer[sizeof(buffer)-1] = '\0'; |
| 42 | |
| 43 | /* FIXME: what about set time */ |
| 44 | @@ -701,8 +704,11 @@ gnome_date_edit_set_time (GnomeDateEdit *gde, time_t the_time) |
| 45 | mytm = localtime (&the_time); |
| 46 | |
| 47 | /* Set the date */ |
| 48 | +#pragma GCC diagnostic push |
| 49 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" |
| 50 | if (strftime (buffer, sizeof (buffer), strftime_date_format, mytm) == 0) |
| 51 | strcpy (buffer, "???"); |
| 52 | +#pragma GCC diagnostic pop |
| 53 | buffer[sizeof(buffer)-1] = '\0'; |
| 54 | |
| 55 | str_utf8 = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL); |
| 56 | diff --git a/libgnomeui/gnome-gconf-ui.c b/libgnomeui/gnome-gconf-ui.c |
| 57 | index 43c0f44..a84b2c0 100644 |
| 58 | --- a/libgnomeui/gnome-gconf-ui.c |
| 59 | +++ b/libgnomeui/gnome-gconf-ui.c |
| 60 | @@ -180,12 +180,15 @@ error_idle_func (gpointer data) |
| 61 | "configuration settings may not work properly."); |
| 62 | } |
| 63 | |
| 64 | +#pragma GCC diagnostic push |
| 65 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" |
| 66 | dialog = gtk_message_dialog_new (NULL /* parent */, |
| 67 | 0 /* flags */, |
| 68 | GTK_MESSAGE_ERROR, |
| 69 | GTK_BUTTONS_OK, |
| 70 | fmt, |
| 71 | gnome_program_get_human_readable_name(gnome_program_get())); |
| 72 | +#pragma GCC diagnostic pop |
| 73 | gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); |
| 74 | g_signal_connect (dialog, "response", |
| 75 | G_CALLBACK (gtk_widget_destroy), |
| 76 | -- |
| 77 | 2.5.5 |
| 78 | |