← Back to team overview

desktop-packages team mailing list archive

[Bug 1234218] Re: 4.8 doesn't throw -Wreturn-type anymore for wrong returns in macros

 

** Package changed: gcc-4.8 (Ubuntu) => glib2.0 (Ubuntu)

** Bug watch added: GNOME Bug Tracker #753310
   https://bugzilla.gnome.org/show_bug.cgi?id=753310

** Also affects: glib via
   https://bugzilla.gnome.org/show_bug.cgi?id=753310
   Importance: Unknown
       Status: Unknown

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to glib2.0 in Ubuntu.
https://bugs.launchpad.net/bugs/1234218

Title:
  4.8 doesn't throw -Wreturn-type anymore for wrong returns in macros

Status in GLib:
  Unknown
Status in glib2.0 package in Ubuntu:
  Fix Committed

Bug description:
  GLib has a macro g_return_if_fail(), that returns from a function when
  a precondition isn't met. gcc used to warn when calling it in a
  function that returns a value, but stopped doing so in 4.8.

  $ cat return-warning.c

  #include <glib.h>

  int function (int c)
  {
    g_return_if_fail (c > 100);
  }
  $ gcc-4.7 -c -Wreturn-type `pkg-config --cflags glib-2.0` return-warning.c 
  return-warning.c: In function ‘function’:
  return-warning.c:6:3: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
  $ gcc-4.8 -c -Wreturn-type `pkg-config --cflags glib-2.0` return-warning.c 
  $

To manage notifications about this bug go to:
https://bugs.launchpad.net/glib/+bug/1234218/+subscriptions