[gnome-photos] build: Turn off -Wcast-function-type



commit bb290a1e53cbbcf07ca90f74f07b0edf15ae45ad
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jul 30 13:16:32 2018 +0200

    build: Turn off -Wcast-function-type
    
    GCC 8 introduced -Wcast-function-type. It is enabled by -Wextra, which
    is on the AX_COMPILER_FLAGS list. Unfortunately, this cannot be sanely
    used with the GNOME platform. It is exceedingly common practice to
    specify a function as a callback that ignores some of the trailing
    parameters passed to it. In fact, the following snippet that's part of
    the g_list_copy_deep documentation triggers -Wcast-function-type:
      another_list = g_list_copy_deep (list,
                                       (GCopyFunc) g_object_ref,
                                       NULL);
    
    Disabling warnings like this does go against the recommendation of the
    AX_COMPILER_FLAGS documentation, which suggests the use of #pragmas
    instead. However, unlike passing the flags through the command line,
    attempts to ignore -Wcast-function-type through a #pragma will trigger
    -Wpragmas on older versions of GCC, and, ironically, using
    G_GNUC_CHECK_VERSION to conditionally disable it on newer compilers
    will trigger -Wexpansion-to-defined, again, because of -Wextra.

 configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/configure.ac b/configure.ac
index 69e78af9..e910abdc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,11 @@ AM_MAINTAINER_MODE([enable])
 AX_IS_RELEASE([git-directory])
 
 AX_CHECK_ENABLE_DEBUG([yes],,, [$ax_is_release])
-AX_COMPILER_FLAGS([WARN_CFLAGS], [WARN_LDFLAGS], [$ax_is_release])
+AX_COMPILER_FLAGS([WARN_CFLAGS],
+                  [WARN_LDFLAGS],
+                  [$ax_is_release],
+                  [],
+                  [-Wno-cast-function-type -Wno-error=cast-function-type])
 
 AS_IF([test "x$ax_is_release" != "xyes"], [PACKAGE_COMMIT_ID=$(git describe)])
 AS_IF([test -n "$PACKAGE_COMMIT_ID"],


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]