Reputation: 193
I keep getting 'warning: control reaches end of non-void function' with this code:
static show_message(GtkMessageType type, const char* text, const char* details)
{
GtkWidget *dialog;
g_assert(text);
dialog = gtk_message_dialog_new(NULL, DIALOG_FLAGS, type, GTK_BUTTONS_CLOSE,
"%s", text);
if (details) {
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", details);
}
gtk_dialog_run(GTK_DIALOG (dialog));
gtk_widget_destroy(dialog);
}
When I compile the above code I get Warning (ie control reaches end of non-void function):
gui.c: warning: return type defaults to 'int'
gui.c: In function 'show_message':
gui.c: warning: control reaches end of non-void function
How can I get rid of this warning?
Thanks.
Upvotes: 2
Views: 626
Reputation: 5602
You need to specify the return value of the show_message()
function as void
, otherwise it is assumed int
. Like this:
static void show_message(GtkMessageType type, const char* text, const char* details)
{
/* ... */
}
Upvotes: 6