Public bug reported:

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 
$

** Affects: gcc-4.8 (Ubuntu)
     Importance: Undecided
         Status: New

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

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1234218/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to