[gnome-terminal/wip/rishi/turn-off-Wcast-function-type] build: Turn off -Wcast-function-type



commit ba9af620acf5afa7bea6d499bb63ed6e066dd166
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Mar 29 17:27:50 2019 +0100

    build: Turn off -Wcast-function-type
    
    GCC 8 introduced -Wcast-function-type. It is enabled by -Wextra, which
    is on the list of used compiler flags. 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 is better than using #pragmas. 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.
    
    In the future, it might be better to move away from -Wextra and instead
    explicitly list out the desired warnings from the -Wextra umbrella.
    
    https://gitlab.gnome.org/GNOME/gnome-terminal/issues/96

 configure.ac | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/configure.ac b/configure.ac
index 9121b3c3..0642387a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -255,6 +255,8 @@ CC_CHECK_FLAGS_APPEND([WARN_CFLAGS],[CFLAGS],[ \
   -Wvla \
   -Wwrite-strings \
   -Wformat-signedness \
+  -Wno-cast-function-type \
+  -Wno-error=cast-function-type \
   -fno-common \
   -fdiagnostics-show-option \
   -fno-strict-aliasing \


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