From: Richard Russon Date: Sat, 21 Sep 2019 15:25:13 +0000 (+0100) Subject: iwyu: optimise #include usage X-Git-Tag: 2019-10-25~37^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f014a0e46645a006d6ba72740b6a02b7ac1c239f;p=neomutt iwyu: optimise #include usage --- diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c index f47c86aa0..6ed3d7638 100644 --- a/autocrypt/autocrypt.c +++ b/autocrypt/autocrypt.c @@ -38,7 +38,6 @@ #include "autocrypt.h" #include "curs_lib.h" #include "globals.h" -#include "mutt_curses.h" #include "muttlib.h" #include "mx.h" #include "ncrypt/ncrypt.h" diff --git a/conn/conn_raw.c b/conn/conn_raw.c index 8f2819033..32d2ef544 100644 --- a/conn/conn_raw.c +++ b/conn/conn_raw.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include "mutt/mutt.h" diff --git a/conn/ssl.c b/conn/ssl.c index 872a9b1c9..70302f6cc 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -45,7 +45,9 @@ #include #include #include +#include #include +#include #include #include "mutt/mutt.h" #include "address/lib.h" diff --git a/conn/ssl_gnutls.c b/conn/ssl_gnutls.c index 3fbade93c..31ccba782 100644 --- a/conn/ssl_gnutls.c +++ b/conn/ssl_gnutls.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "mutt/mutt.h" #include "config/lib.h" #include "conn_globals.h" diff --git a/context.c b/context.c index 40738ef9f..421e76eff 100644 --- a/context.c +++ b/context.c @@ -29,6 +29,7 @@ #include "config.h" #include #include "mutt/mutt.h" +#include "config/lib.h" #include "email/lib.h" #include "core/lib.h" #include "context.h" diff --git a/curs_lib.h b/curs_lib.h index 325880134..70c8bc5ce 100644 --- a/curs_lib.h +++ b/curs_lib.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include "config/lib.h" #include "mutt.h" #include "browser.h" diff --git a/email/email.h b/email/email.h index cfbb6fe26..c763a68c0 100644 --- a/email/email.h +++ b/email/email.h @@ -31,8 +31,6 @@ #include "ncrypt/ncrypt.h" #include "tags.h" -struct Notify; - /** * struct Email - The envelope/body of an email */ diff --git a/enter_state.h b/enter_state.h index 14586a2da..7dad4fd33 100644 --- a/enter_state.h +++ b/enter_state.h @@ -24,6 +24,7 @@ #define MUTT_ENTER_STATE_H #include +#include /** * struct EnterState - Keep our place when entering a string diff --git a/hcache/hcache.h b/hcache/hcache.h index 8d7857f6b..30835d588 100644 --- a/hcache/hcache.h +++ b/hcache/hcache.h @@ -52,7 +52,6 @@ #include #include -#include struct Email; diff --git a/hcache/serialize.h b/hcache/serialize.h index b3e96988a..4c515dadc 100644 --- a/hcache/serialize.h +++ b/hcache/serialize.h @@ -26,6 +26,7 @@ #ifndef MUTT_HCACHE_SERIALIZE_H #define MUTT_HCACHE_SERIALIZE_H +#include #include #include #include "hcache.h" diff --git a/icommands.c b/icommands.c index c7743e9d5..a4e898ffe 100644 --- a/icommands.c +++ b/icommands.c @@ -35,6 +35,7 @@ #include "keymap.h" #include "muttlib.h" #include "opcodes.h" +#include "pager.h" #include "version.h" /** diff --git a/imap/browse.c b/imap/browse.c index 7748882ac..44e6ac3b3 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -29,7 +29,6 @@ #include "config.h" #include -#include #include #include #include diff --git a/imap/command.c b/imap/command.c index 8731fd61d..cd644205b 100644 --- a/imap/command.c +++ b/imap/command.c @@ -37,7 +37,6 @@ #include #include #include -#include #include "imap_private.h" #include "mutt/mutt.h" #include "email/lib.h" diff --git a/imap/imap.c b/imap/imap.c index f843e3701..19c414f76 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -35,7 +35,6 @@ #include #include #include -#include #include "imap_private.h" #include "mutt/mutt.h" #include "config/lib.h" diff --git a/init.c b/init.c index 7ab7da38c..21abc5be5 100644 --- a/init.c +++ b/init.c @@ -40,9 +40,7 @@ #include #include #include -#include #include -#include #include "mutt/mutt.h" #include "address/lib.h" #include "email/lib.h" @@ -55,7 +53,6 @@ #include "hcache/hcache.h" #include "keymap.h" #include "monitor.h" -#include "mutt_curses.h" #include "mutt_menu.h" #include "mutt_window.h" #include "mx.h" diff --git a/keymap.c b/keymap.c index 745849639..a6b64515a 100644 --- a/keymap.c +++ b/keymap.c @@ -33,7 +33,6 @@ #include #include #include -#include #include "mutt/mutt.h" #include "mutt.h" #include "keymap.h" @@ -47,6 +46,9 @@ #include "ncrypt/ncrypt.h" #include "opcodes.h" #include "options.h" +#ifndef USE_SLANG_CURSES +#include +#endif #ifdef USE_IMAP #include "imap/imap.h" #endif diff --git a/maildir/maildir.c b/maildir/maildir.c index de47cd18d..ad6b731ad 100644 --- a/maildir/maildir.c +++ b/maildir/maildir.c @@ -40,11 +40,9 @@ #include #include #include -#include #include #include "maildir_private.h" #include "mutt/mutt.h" -#include "config/lib.h" #include "email/lib.h" #include "core/lib.h" #include "globals.h" diff --git a/maildir/mh.c b/maildir/mh.c index 10d4a9b8a..a5bb65d0d 100644 --- a/maildir/mh.c +++ b/maildir/mh.c @@ -42,7 +42,6 @@ #include #include "maildir_private.h" #include "mutt/mutt.h" -#include "config/lib.h" #include "email/lib.h" #include "core/lib.h" #include "errno.h" diff --git a/maildir/shared.c b/maildir/shared.c index c1f0667ec..c778446c9 100644 --- a/maildir/shared.c +++ b/maildir/shared.c @@ -40,8 +40,6 @@ #include #include #include -#include -#include #include #include #include "maildir_private.h" diff --git a/menu.c b/menu.c index 39ff50877..1b1564965 100644 --- a/menu.c +++ b/menu.c @@ -37,7 +37,6 @@ #include "email/lib.h" #include "core/lib.h" #include "mutt.h" -#include "color.h" #include "commands.h" #include "context.h" #include "curs_lib.h" @@ -52,6 +51,9 @@ #include "options.h" #include "pattern.h" #include "protos.h" +#ifndef USE_SLANG_CURSES +#include "color.h" +#endif #ifdef USE_SIDEBAR #include "sidebar.h" #endif diff --git a/monitor.h b/monitor.h index 348b45c70..d82a29a09 100644 --- a/monitor.h +++ b/monitor.h @@ -23,11 +23,13 @@ #ifndef MUTT_MONITOR_H #define MUTT_MONITOR_H -extern bool MonitorFilesChanged; ///< true after a monitored file has changed -extern bool MonitorContextChanged; ///< true after the current mailbox has changed +#include struct Mailbox; +extern bool MonitorFilesChanged; ///< true after a monitored file has changed +extern bool MonitorContextChanged; ///< true after the current mailbox has changed + int mutt_monitor_add(struct Mailbox *m); int mutt_monitor_remove(struct Mailbox *m); int mutt_monitor_poll(void); diff --git a/mutt/file.c b/mutt/file.c index cdab2b0ee..10385de11 100644 --- a/mutt/file.c +++ b/mutt/file.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -49,6 +48,9 @@ #include "message.h" #include "path.h" #include "string2.h" +#ifdef USE_FLOCK +#include +#endif char *C_Tmpdir; ///< Config: Directory for temporary files diff --git a/mutt/md5.c b/mutt/md5.c index e596a029a..2fa282935 100644 --- a/mutt/md5.c +++ b/mutt/md5.c @@ -30,6 +30,7 @@ #include "config.h" #include #include +#include #include #include "md5.h" diff --git a/mutt_curses.h b/mutt_curses.h index 81ecdf8a6..b65fff553 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -24,9 +24,11 @@ #ifndef MUTT_MUTT_CURSES_H #define MUTT_MUTT_CURSES_H +#include "config.h" #include +#include +#include #include "mutt/mutt.h" -#include "pattern.h" #ifdef USE_SLANG_CURSES diff --git a/mutt_logging.c b/mutt_logging.c index 655c8cd73..6fd6d71af 100644 --- a/mutt_logging.c +++ b/mutt_logging.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "mutt/mutt.h" #include "config/lib.h" #include "curs_lib.h" diff --git a/mutt_window.h b/mutt_window.h index 1056a4b7f..5668cb25c 100644 --- a/mutt_window.h +++ b/mutt_window.h @@ -24,8 +24,6 @@ #define MUTT_MUTT_WINDOW_H #include "config.h" -#include -#include "mutt/mutt.h" /** * struct MuttWindow - A division of the screen diff --git a/mx.c b/mx.c index 5ef920822..feb82c41c 100644 --- a/mx.c +++ b/mx.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include "mutt/mutt.h" #include "address/lib.h" diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index ced1162c2..70fb61392 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -81,6 +81,8 @@ #include #endif +struct Mailbox; + // clang-format off /* Values used for comparing addresses. */ #define CRYPT_KV_VALID (1 << 0) diff --git a/ncrypt/crypt_mod.h b/ncrypt/crypt_mod.h index 11fc34f0b..694d74aa9 100644 --- a/ncrypt/crypt_mod.h +++ b/ncrypt/crypt_mod.h @@ -31,8 +31,9 @@ struct Address; struct AddressList; struct Body; -struct Envelope; struct Email; +struct Envelope; +struct Mailbox; struct State; /** diff --git a/ncrypt/cryptglue.c b/ncrypt/cryptglue.c index 10bd46da3..bb7e5dcfa 100644 --- a/ncrypt/cryptglue.c +++ b/ncrypt/cryptglue.c @@ -40,19 +40,20 @@ #include #include "mutt/mutt.h" #include "crypt_mod.h" -#include "curs_lib.h" -#include "globals.h" #include "ncrypt.h" -#include "options.h" +#ifndef CRYPT_BACKEND_GPGME +#include "curs_lib.h" +#endif #ifdef USE_AUTOCRYPT #include "autocrypt/autocrypt.h" +#include "globals.h" +#include "options.h" +#include "email/lib.h" #endif struct Address; struct AddressList; -struct Body; -struct Envelope; -struct Email; +struct Mailbox; struct State; /* These Config Variables are only used in ncrypt/cryptglue.c */ diff --git a/ncrypt/cryptglue.h b/ncrypt/cryptglue.h index b4c6e419a..b22c7f125 100644 --- a/ncrypt/cryptglue.h +++ b/ncrypt/cryptglue.h @@ -28,6 +28,7 @@ struct AddressList; struct Body; +struct Email; struct State; struct Body *crypt_pgp_encrypt_message(struct Email *e, struct Body *a, char *keylist, int sign); diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 9218c36fc..dceeecdee 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -34,7 +34,6 @@ #include "config.h" #include -#include #include #include #include diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index 6015ea60c..224b5abc1 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -41,7 +41,6 @@ #include "globals.h" #include "mutt_curses.h" #include "mutt_logging.h" -#include "mutt_window.h" #include "muttlib.h" #include "ncrypt.h" #include "pgpkey.h" diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 0f55e5447..9f2cbc130 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -54,7 +54,6 @@ #include "mutt_curses.h" #include "mutt_logging.h" #include "mutt_menu.h" -#include "mutt_window.h" #include "muttlib.h" #include "ncrypt.h" #include "opcodes.h" diff --git a/ncrypt/smime.h b/ncrypt/smime.h index 24eab8a9b..86e3b9d5a 100644 --- a/ncrypt/smime.h +++ b/ncrypt/smime.h @@ -25,9 +25,14 @@ #ifndef MUTT_NCRYPT_SMIME_H #define MUTT_NCRYPT_SMIME_H -#include +#include "config.h" #include #include "ncrypt.h" +#ifdef USE_SLANG_CURSES +#include "mutt_curses.h" +#else +#include +#endif struct AddressList; struct Body; diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 806a3cb71..4b31a5519 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -52,7 +52,6 @@ #include "mutt_account.h" #include "mutt_logging.h" #include "mutt_socket.h" -#include "mutt_window.h" #include "muttlib.h" #include "nntp.h" #include "protos.h" diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 31e8e01d9..7bcfd8623 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include "notmuch_private.h" #include "mutt/mutt.h" diff --git a/notmuch/nm_db.c b/notmuch/nm_db.c index 46a00983c..0832791f6 100644 --- a/notmuch/nm_db.c +++ b/notmuch/nm_db.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "notmuch_private.h" #include "mutt/mutt.h" #include "email/lib.h" diff --git a/pop/pop.c b/pop/pop.c index e5ceefab1..584f88d8b 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include "pop_private.h" #include "mutt/mutt.h" diff --git a/pop/pop_private.h b/pop/pop_private.h index 81ac671b3..966389a31 100644 --- a/pop/pop_private.h +++ b/pop/pop_private.h @@ -27,7 +27,7 @@ #include #include #include "conn/conn.h" -#include "mutt/buffer.h" +#include "mutt/mutt.h" struct Mailbox; struct Progress; diff --git a/progress.c b/progress.c index bb10d7093..af405b23d 100644 --- a/progress.c +++ b/progress.c @@ -28,11 +28,9 @@ */ #include "config.h" -#include #include #include #include -#include #include "mutt/mutt.h" #include "progress.h" #include "curs_lib.h" diff --git a/progress.h b/progress.h index 5af067256..8f086d8c0 100644 --- a/progress.h +++ b/progress.h @@ -24,6 +24,7 @@ #ifndef MUTT_PROGRESS_H #define MUTT_PROGRESS_H +#include #include /* These Config Variables are only used in progress.c */ diff --git a/recvattach.c b/recvattach.c index 7212d36fc..f5254cf36 100644 --- a/recvattach.c +++ b/recvattach.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include "mutt/mutt.h" diff --git a/resize.c b/resize.c index 746c3b014..1d403e76f 100644 --- a/resize.c +++ b/resize.c @@ -29,11 +29,13 @@ #include "config.h" #include -#include #include #include "mutt/mutt.h" #include "mutt_curses.h" #include "mutt_window.h" +#ifdef USE_SLANG_CURSES +#include +#endif #ifdef HAVE_SYS_IOCTL_H #include #else diff --git a/send.c b/send.c index 59292c1a5..9d8c9458b 100644 --- a/send.c +++ b/send.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/send.h b/send.h index 35b95df0e..9e9c993c4 100644 --- a/send.h +++ b/send.h @@ -28,6 +28,7 @@ #include struct Address; +struct AddressList; struct Body; struct Context; struct Email; diff --git a/system.c b/system.c index 1332c36a5..eee2f80bc 100644 --- a/system.c +++ b/system.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include "mutt/mutt.h" #include "mutt.h" diff --git a/wcscasecmp.c b/wcscasecmp.c index 612cfbfed..51b1928e7 100644 --- a/wcscasecmp.c +++ b/wcscasecmp.c @@ -27,7 +27,7 @@ */ #include "config.h" -#include +#include #include /**