[glib: 1/2] Revert "gdatetime: Enable compile time check of g_date_time_format() format"
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] Revert "gdatetime: Enable compile time check of g_date_time_format() format"
- Date: Thu, 1 Nov 2018 18:13:30 +0000 (UTC)
commit 664fb6303bf68876e66a0e8538ba4fd6534924b6
Author: Philip Withnall <withnall endlessm com>
Date: Thu Nov 1 16:11:41 2018 +0000
Revert "gdatetime: Enable compile time check of g_date_time_format() format"
This reverts commits:
• 9ddcc79502349e02a1e796b363d891e177337af5
• ae02adc3c3795bb32348c07d8f48504b41e9e2c7
g_date_time_format() supports a few non-standard format placeholders:
• %:z
• %::z
• %:::z
These are all gnulib strtime() extensions, and hence are not recognised
by the compiler when the function is annotated with G_GNUC_STRFTIME.
However, this wasn’t noticed when we originally merged this change
because the errors were disabled in the tests which covered those
placeholders.
glib/gdatetime.h | 2 +-
glib/tests/gdatetime.c | 8 --------
tests/datetime.c | 8 --------
3 files changed, 1 insertion(+), 17 deletions(-)
---
diff --git a/glib/gdatetime.h b/glib/gdatetime.h
index 8bf8cd98d..65f9965ac 100644
--- a/glib/gdatetime.h
+++ b/glib/gdatetime.h
@@ -261,7 +261,7 @@ GDateTime * g_date_time_to_utc (GDateTi
GLIB_AVAILABLE_IN_ALL
gchar * g_date_time_format (GDateTime *datetime,
- const gchar *format);
+ const gchar *format)
G_GNUC_MALLOC;
G_END_DECLS
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 4e262d9a9..f4000d96c 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -25,14 +25,6 @@
#include <glib/gstdio.h>
#include <locale.h>
-/* The tests below exercise invalid formats and y2k-unsafe formats,
- * so we need to silence the warnings here to pass.
- */
-#ifdef __GNUC__
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-y2k"
-#endif
-
#define ASSERT_DATE(dt,y,m,d) G_STMT_START { \
g_assert_nonnull ((dt)); \
g_assert_cmpint ((y), ==, g_date_time_get_year ((dt))); \
diff --git a/tests/datetime.c b/tests/datetime.c
index 16f4a95e2..ae46bbaea 100644
--- a/tests/datetime.c
+++ b/tests/datetime.c
@@ -18,14 +18,6 @@
#include <locale.h>
#include <glib/glib.h>
-/* The whole purpose of this test is to pass the command line argument
- * to g_date_time_format(), so the format argument cannot be compile-
- * time checked. Disable the inevitable compiler warning.
- */
-#ifdef __GNUC__
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
-#endif
-
int
main (int argc, char *argv[])
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]