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

Bug #1234218 reported by Lars Karlitski on 2013-10-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GLib
Fix Released
Low
glib2.0 (Ubuntu)
High
Unassigned

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
$

Matthias Klose (doko) on 2015-10-02
affects: gcc-4.8 (Ubuntu) → glib2.0 (Ubuntu)
Changed in glib2.0 (Ubuntu):
status: New → Fix Committed
importance: Undecided → High
Changed in glib:
importance: Unknown → Low
status: Unknown → Fix Released
Changed in glib2.0 (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.