gplugin/gplugin

Bring back the break after functions
develop
2020-02-15, Richard Laager
d87c806b1f05
Parents 93144a270d45
Children 92e5207d8580
Bring back the break after functions

With the AlwaysBreak style, functions with many arguments get continued
onto the next line like this:

gplugin_gtk_store_plugin_unloaded_cb(
GObject *manager,
GPluginPlugin *plugin,
gpointer data) {
gplugin_gtk_store_update_plugin_state(
GPLUGIN_GTK_STORE(data), plugin);
}

It is difficult to see where parameters stop and the body starts.

Gary suggested this formatting, which "helps (at least me) visually see
the blocks while scanning the code":

gplugin_gtk_store_plugin_unloaded_cb(
GObject *manager,
GPluginPlugin *plugin,
gpointer data
) {
gplugin_gtk_store_update_plugin_state(
GPLUGIN_GTK_STORE(data), plugin);
}

Unfortunately, that is not something that clang-format supports. We
can get almost the same output (just moving the closing paren), with
the same visual benefits, by using BraceWrapping: AfterFunction: true,
which produces this:

gplugin_gtk_store_plugin_unloaded_cb(
GObject *manager,
GPluginPlugin *plugin,
gpointer data)
{
gplugin_gtk_store_update_plugin_state(
GPLUGIN_GTK_STORE(data), plugin);
}
--- a/.clang-format Sat Feb 15 19:17:01 2020 -0600
+++ b/.clang-format Sat Feb 15 19:22:02 2020 -0600
@@ -28,7 +28,7 @@
AfterClass: false
AfterControlStatement: false
AfterEnum: false
- AfterFunction: false
+ AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false