Include what you use
commit4efcbab33234d13a7c6d1dea2901535d9317e4e1
authorMatthew Brush <matt@geany.org>
Mon, 19 May 2014 00:31:51 +0000 (18 17:31 -0700)
committerMatthew Brush <matt@geany.org>
Wed, 21 May 2014 22:37:19 +0000 (21 15:37 -0700)
tree70a7d29c1fd7f7b20dc1fcbd779cd243c2bfe88d
parent6f87aac118fac7730fd981d11b41c8438e2f4649
Include what you use

This is a mega-commit - because most of it had to be done in one go
otherwise some commits would fail to compile - that attempts to fix a
few problems with Geany's includes as well as various other related
cleanups. After this change it's easier to use includes and there's
little worry about which order things are included in or who includes
what.

Overview of changes:

* Include config.h at the start of each source file if HAVE_CONFIG_H
  is defined (and never in headers).
* Go through each source file and make the includes section generally
  like this:
  - Always config.h first as above
  - Then if the file has a header with the same name, include that
  - Then include in alphabetical order each other internal/geany header.
  - Then include standard headers
  - Then include non-standard system headers
  - Then include GLib/GTK+ related stuff
* Doing as above makes it easier to find implicit header include
  dependencies and it exposed quite a few weird problems with includes
  or forward declarations, fix those.
* Make geany.h contain not much besides some defines.
  - Add a little header file "app.h" for GeanyApp and move it there
  - Move "app" global to new "app.h" file
  - Move "ignore_callback" global to "callbacks.h"
  - Move "geany_object" global to "geanyobject.h"
* Add an include in "geany.h" for "app.h" since GeanyApp used to be
  defined there and some plugins included this header to access
  GeanyApp.
* Include "gtkcompat.h" everywhere instead of gtk/gtk.h so that
  everywhere sees the same definitions (not a problem in practice AFAIK
  so this could be changed back if better that way.
* Remove forward declarations from previous commits as some people
  apparently consider this bad style, despite that it reduces inter-
  header dependencies.

TODO:
* As always, to test on win32
* As always, to test with not Autotools
* Test plugins better, both builtin and geany-plugins, likely API/ABI bump
* Test with various defines/flags that may change what is included
* win32.[ch] not really touched since I couldn't test
82 files changed:
plugins/geanyplugin.h
src/Makefile.am
src/about.c
src/app.h [new file with mode: 0644]
src/build.c
src/build.h
src/callbacks.c
src/callbacks.h
src/dialogs.c
src/dialogs.h
src/document.c
src/document.h
src/documentprivate.h
src/editor.c
src/editor.h
src/encodings.c
src/encodings.h
src/filetypes.c
src/filetypes.h
src/filetypesprivate.h
src/gb.c
src/geany.h
src/geanyentryaction.c
src/geanyentryaction.h
src/geanymenubuttonaction.c
src/geanymenubuttonaction.h
src/geanyobject.c
src/geanyobject.h
src/geanywraplabel.c
src/geanywraplabel.h
src/highlighting.c
src/highlighting.h
src/highlightingmappings.h
src/keybindings.c
src/keybindings.h
src/keybindingsprivate.h
src/keyfile.c
src/log.c
src/main.c
src/msgwindow.c
src/msgwindow.h
src/navqueue.c
src/navqueue.h
src/notebook.c
src/notebook.h
src/plugindata.h
src/pluginprivate.h
src/plugins.c
src/pluginutils.c
src/pluginutils.h
src/prefix.c
src/prefs.c
src/printing.c
src/printing.h
src/project.c
src/projectprivate.h
src/sciwrappers.c
src/sciwrappers.h
src/search.c
src/search.h
src/sidebar.c
src/sidebar.h
src/socket.c
src/stash.c
src/stash.h
src/symbols.c
src/symbols.h
src/templates.c
src/templates.h
src/toolbar.c
src/toolbar.h
src/tools.c
src/tools.h
src/ui_utils.c
src/ui_utils.h
src/utils.c
src/utils.h
src/vte.c
src/vte.h
src/win32.c
src/win32.h
wscript