Initial pass with Include What You Use

This commit is contained in:
David Adam 2015-07-25 23:14:25 +08:00
parent 30ea4fc416
commit 78162a2a13
83 changed files with 360 additions and 564 deletions

View file

@ -3,14 +3,21 @@
The classes responsible for autoloading functions and completions. The classes responsible for autoloading functions and completions.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include "autoload.h" #include "autoload.h"
#include "wutil.h" #include "wutil.h"
#include "common.h" #include "common.h"
#include "signal.h" #include "signal.h" // IWYU pragma: keep - needed for CHECK_BLOCK
#include "env.h" #include "env.h"
#include "exec.h" #include "exec.h"
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
#include <wchar.h>
#include <string>
#include <utility>
#include <vector>
#include <algorithm> #include <algorithm>
/* The time before we'll recheck an autoloaded file */ /* The time before we'll recheck an autoloaded file */

View file

@ -6,10 +6,10 @@
#ifndef FISH_AUTOLOAD_H #ifndef FISH_AUTOLOAD_H
#define FISH_AUTOLOAD_H #define FISH_AUTOLOAD_H
#include <wchar.h> #include <pthread.h>
#include <map> #include <stddef.h>
#include <time.h>
#include <set> #include <set>
#include <list>
#include "common.h" #include "common.h"
#include "lru.h" #include "lru.h"
@ -40,7 +40,6 @@ struct builtin_script_t
const char *def; const char *def;
}; };
struct builtin_script_t;
class env_vars_snapshot_t; class env_vars_snapshot_t;
/** /**

View file

@ -17,27 +17,27 @@
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include <unistd.h> #include <unistd.h>
#include <termios.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <dirent.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <wctype.h> #include <wctype.h>
#include <sys/time.h>
#include <time.h> #include <time.h>
#include <stack> #include <stack>
#include <assert.h>
#include <algorithm>
#include <map>
#include <string>
#include <utility>
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wutil.h" #include "wutil.h"
#include "builtin.h" #include "builtin.h"
@ -47,12 +47,8 @@
#include "parser.h" #include "parser.h"
#include "reader.h" #include "reader.h"
#include "env.h" #include "env.h"
#include "common.h"
#include "wgetopt.h" #include "wgetopt.h"
#include "sanity.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "wildcard.h"
#include "input_common.h"
#include "input.h" #include "input.h"
#include "intern.h" #include "intern.h"
#include "event.h" #include "event.h"
@ -65,6 +61,7 @@
#include "path.h" #include "path.h"
#include "history.h" #include "history.h"
#include "parse_tree.h" #include "parse_tree.h"
#include "parse_constants.h"
#include "wcstringutil.h" #include "wcstringutil.h"
/** /**

View file

@ -5,12 +5,13 @@
#ifndef FISH_BUILTIN_H #ifndef FISH_BUILTIN_H
#define FISH_BUILTIN_H #define FISH_BUILTIN_H
#include <wchar.h> #include <stddef.h> // for size_t
#include <vector> // for vector
#include "util.h"
#include "io.h" #include "io.h"
#include "common.h" #include "common.h"
class completion_t;
class parser_t; class parser_t;
enum enum

View file

@ -10,6 +10,8 @@ Implemented from scratch (yes, really) by way of IEEE 1003.1 as reference.
#include "builtin.h" #include "builtin.h"
#include "wutil.h" #include "wutil.h"
#include "proc.h" #include "proc.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <memory> #include <memory>

View file

@ -2,7 +2,12 @@
*/ */
#include "color.h" #include "color.h"
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <wchar.h>
#include <cstddef>
bool rgb_color_t::try_parse_special(const wcstring &special) bool rgb_color_t::try_parse_special(const wcstring &special)
{ {

View file

@ -3,9 +3,8 @@
#ifndef FISH_COLOR_H #ifndef FISH_COLOR_H
#define FISH_COLOR_H #define FISH_COLOR_H
#include <stdint.h> #include <string.h>
#include <cstddef> #include <string>
#include "config.h"
#include "common.h" #include "common.h"
/* 24 bit color */ /* 24 bit color */

View file

@ -9,10 +9,6 @@ parts of fish.
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_STROPTS_H
#include <stropts.h>
#endif
#ifdef HAVE_SIGINFO_H #ifdef HAVE_SIGINFO_H
#include <siginfo.h> #include <siginfo.h>
#endif #endif
@ -22,53 +18,35 @@ parts of fish.
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <dirent.h>
#include <sys/types.h> #include <sys/types.h>
#include <assert.h>
#include <math.h>
#include <signal.h>
#ifdef HAVE_SYS_IOCTL_H #ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include <wctype.h> #include <wctype.h>
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <locale.h> #include <locale.h>
#include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <fcntl.h>
#include <algorithm> #include <algorithm>
#ifdef HAVE_EXECINFO_H #ifdef HAVE_EXECINFO_H
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h>
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include "fallback.h" #include "fallback.h"
#include "util.h"
#include "wutil.h" #include "wutil.h"
#include "common.h" #include "common.h"
#include "expand.h" #include "expand.h"
#include "proc.h"
#include "wildcard.h" #include "wildcard.h"
#include "parser.h"
#include "complete.h"
#include "util.cpp" #include "util.cpp"
#include "fallback.cpp" #include "fallback.cpp"

View file

@ -17,10 +17,13 @@
#include <vector> #include <vector>
#include <pthread.h> #include <pthread.h>
#include <string.h> #include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <sys/types.h>
#include <errno.h> #include <errno.h>
#include <assert.h> #include "config.h"
#include "util.h" #include "fallback.h"
/** /**
Avoid writing the type name twice in a common "static_cast-initialization". Avoid writing the type name twice in a common "static_cast-initialization".
@ -28,8 +31,6 @@
*/ */
#define CAST_INIT(type, dst, src) type dst = static_cast<type >(src) #define CAST_INIT(type, dst, src) type dst = static_cast<type >(src)
class completion_t;
/* Common string type */ /* Common string type */
typedef std::wstring wcstring; typedef std::wstring wcstring;
typedef std::vector<wcstring> wcstring_list_t; typedef std::vector<wcstring> wcstring_list_t;

View file

@ -4,29 +4,23 @@
*/ */
#include "config.h" #include "config.h"
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stddef.h>
#include <limits.h>
#include <string.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <termios.h>
#include <ctype.h>
#include <pwd.h> #include <pwd.h>
#include <signal.h>
#include <wchar.h>
#include <pthread.h> #include <pthread.h>
#include <algorithm> #include <algorithm>
#include <list>
#include <map>
#include <set>
#include <string>
#include <utility>
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h" #include "util.h"
#include "tokenizer.h"
#include "wildcard.h" #include "wildcard.h"
#include "proc.h" #include "proc.h"
#include "parser.h" #include "parser.h"
@ -37,15 +31,13 @@
#include "exec.h" #include "exec.h"
#include "expand.h" #include "expand.h"
#include "common.h" #include "common.h"
#include "reader.h"
#include "history.h"
#include "intern.h"
#include "parse_util.h" #include "parse_util.h"
#include "parser_keywords.h"
#include "wutil.h" #include "wutil.h"
#include "path.h" #include "path.h"
#include "parse_tree.h" #include "parse_tree.h"
#include "iothread.h" #include "iothread.h"
#include "autoload.h"
#include "parse_constants.h"
/* /*
Completion description strings, mostly for different types of files, such as sockets, block devices, etc. Completion description strings, mostly for different types of files, such as sockets, block devices, etc.

View file

@ -12,11 +12,9 @@
*/ */
#define FISH_COMPLETE_H #define FISH_COMPLETE_H
#include <vector>
#include <wchar.h>
#include <stdint.h> #include <stdint.h>
#include "util.h"
#include "common.h" #include "common.h"
/** /**
* Use all completions * Use all completions

32
env.cpp
View file

@ -1,46 +1,26 @@
/** \file env.c /** \file env.c
Functions for setting and getting environment variables. Functions for setting and getting environment variables.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h> #include <stdlib.h>
#include <wchar.h> #include <wchar.h>
#include <string.h>
#include <stdio.h>
#include <locale.h> #include <locale.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#include <assert.h> #include <assert.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <pthread.h> #include <pthread.h>
#include <pwd.h> #include <pwd.h>
#include <set> #include <set>
#include <map> #include <map>
#include <algorithm> #include <algorithm>
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h>
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#if HAVE_LIBINTL_H
#include <libintl.h>
#endif
#include <errno.h> #include <errno.h>
#include <stddef.h>
#include <wctype.h>
#include <utility>
#include <vector>
#include "fallback.h" #include "fallback.h"
#include "util.h"
#include "wutil.h" #include "wutil.h"
#include "proc.h" #include "proc.h"
@ -50,13 +30,11 @@
#include "expand.h" #include "expand.h"
#include "history.h" #include "history.h"
#include "reader.h" #include "reader.h"
#include "parser.h"
#include "env_universal_common.h" #include "env_universal_common.h"
#include "input.h" #include "input.h"
#include "event.h" #include "event.h"
#include "path.h" #include "path.h"
#include "complete.h"
#include "fish_version.h" #include "fish_version.h"
/** Value denoting a null string */ /** Value denoting a null string */

3
env.h
View file

@ -6,9 +6,10 @@
#define FISH_ENV_H #define FISH_ENV_H
#include <wchar.h> #include <wchar.h>
#include <stdint.h>
#include <string>
#include <map> #include <map>
#include "util.h"
#include "common.h" #include "common.h"
/* Flags that may be passed as the 'mode' in env_set / env_get_string */ /* Flags that may be passed as the 'mode' in env_set / env_get_string */

View file

@ -10,26 +10,39 @@
#include "env_universal_common.h" #include "env_universal_common.h"
#include <fcntl.h> #include <fcntl.h>
#include <sys/un.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/file.h> #include <sys/file.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <arpa/inet.h> #include <arpa/inet.h> // IWYU pragma: keep - needed for htonl
#include <pwd.h> #include <pwd.h>
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <wchar.h>
#include <wctype.h>
#include <map>
#include <utility>
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h" #include "util.h"
#include "common.h" #include "common.h"
#include "wutil.h" #include "wutil.h"
#include "utf8.h" #include "utf8.h"
#include "path.h"
#include "iothread.h"
#if __APPLE__ #if __APPLE__
#define FISH_NOTIFYD_AVAILABLE 1 #define FISH_NOTIFYD_AVAILABLE 1

View file

@ -1,12 +1,13 @@
#ifndef FISH_ENV_UNIVERSAL_COMMON_H #ifndef FISH_ENV_UNIVERSAL_COMMON_H
#define FISH_ENV_UNIVERSAL_COMMON_H #define FISH_ENV_UNIVERSAL_COMMON_H
#include <wchar.h>
#include <queue>
#include <string> #include <string>
#include <set> #include <set>
#include <pthread.h>
#include <stdio.h>
#include <vector>
#include "common.h"
#include "wutil.h" #include "wutil.h"
#include "util.h"
#include "env.h" #include "env.h"
/** /**
@ -24,8 +25,6 @@ typedef enum
*/ */
#define ENV_UNIVERSAL_BUFFER_SIZE 1024 #define ENV_UNIVERSAL_BUFFER_SIZE 1024
typedef std::vector<struct callback_data_t> callback_data_list_t;
/** /**
Callback data, reflecting a change in universal variables Callback data, reflecting a change in universal variables
*/ */
@ -40,6 +39,8 @@ struct callback_data_t
} }
}; };
typedef std::vector<struct callback_data_t> callback_data_list_t;
/** Class representing universal variables */ /** Class representing universal variables */
class env_universal_t class env_universal_t
{ {

View file

@ -3,28 +3,23 @@
Functions for handling event triggers Functions for handling event triggers
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <unistd.h>
#include <termios.h>
#include <signal.h> #include <signal.h>
#include <string.h>
#include <algorithm> #include <algorithm>
#include <assert.h>
#include <stddef.h>
#include <string>
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h" #include "wutil.h" // IWYU pragma: keep - needed for gettext
#include "wutil.h"
#include "function.h"
#include "input_common.h" #include "input_common.h"
#include "proc.h" #include "proc.h"
#include "parser.h" #include "parser.h"
#include "common.h" #include "common.h"
#include "event.h" #include "event.h"
#include "signal.h" #include "signal.h"
#include "io.h"
/** /**

View file

@ -12,7 +12,8 @@
#ifndef FISH_EVENT_H #ifndef FISH_EVENT_H
#define FISH_EVENT_H #define FISH_EVENT_H
#include <memory> #include <ctime>
#include <vector>
#include "common.h" #include "common.h"

View file

@ -5,37 +5,32 @@
manual, though the changes performed have been massive. manual, though the changes performed have been massive.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include <signal.h> #include <signal.h>
#include <sys/wait.h>
#include <assert.h> #include <assert.h>
#include <dirent.h>
#include <time.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <memory> #include <spawn.h>
#include <wctype.h>
#include <map>
#include <string>
#include <memory> // IWYU pragma: keep - suggests <tr1/memory> instead
#include <utility>
#ifdef HAVE_SIGINFO_H #ifdef HAVE_SIGINFO_H
#include <siginfo.h> #include <siginfo.h>
#endif #endif
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "iothread.h"
#include "postfork.h" #include "postfork.h"
#include "common.h" #include "common.h"
#include "wutil.h" #include "wutil.h"
#include "proc.h" #include "proc.h"
@ -44,12 +39,10 @@
#include "builtin.h" #include "builtin.h"
#include "function.h" #include "function.h"
#include "env.h" #include "env.h"
#include "wildcard.h"
#include "sanity.h"
#include "expand.h"
#include "signal.h" #include "signal.h"
#include "parse_util.h" #include "parse_util.h"
#include "io.h"
#include "parse_tree.h"
/** /**
file descriptor redirection error message file descriptor redirection error message

5
exec.h
View file

@ -8,11 +8,9 @@
*/ */
#define FISH_EXEC_H #define FISH_EXEC_H
#include <wchar.h> #include <stddef.h>
#include <vector> #include <vector>
#include "proc.h"
#include "util.h"
#include "common.h" #include "common.h"
/** /**
@ -41,6 +39,7 @@
*/ */
class job_t;
class parser_t; class parser_t;
void exec_job(parser_t &parser, job_t *j); void exec_job(parser_t &parser, job_t *j);

View file

@ -5,27 +5,20 @@ parameter expansion.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h>
#include <stddef.h>
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
#include <wctype.h> #include <wctype.h>
#include <errno.h> #include <errno.h>
#include <pwd.h> #include <pwd.h>
#include <unistd.h>
#include <limits.h>
#include <sys/param.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
#include <termios.h>
#include <dirent.h> #include <dirent.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#include <algorithm> #include <algorithm>
#include <assert.h> #include <assert.h>
@ -35,7 +28,7 @@ parameter expansion.
#include <procfs.h> #include <procfs.h>
#endif #endif
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h" #include "util.h"
#include "common.h" #include "common.h"
@ -46,7 +39,6 @@ parameter expansion.
#include "expand.h" #include "expand.h"
#include "wildcard.h" #include "wildcard.h"
#include "exec.h" #include "exec.h"
#include "signal.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "complete.h" #include "complete.h"
#include "iothread.h" #include "iothread.h"

View file

@ -15,12 +15,14 @@
*/ */
#define FISH_EXPAND_H #define FISH_EXPAND_H
#include <wchar.h> #include "config.h" // for __warn_unused
#include <wchar.h>
#include <string> // for string
#include <vector> // for vector
#include "util.h"
#include "common.h" #include "common.h"
#include "parse_constants.h" #include "parse_constants.h"
#include <list>
enum enum
{ {
@ -134,8 +136,6 @@ enum
*/ */
#define ARRAY_BOUNDS_ERR _(L"Array index out of bounds") #define ARRAY_BOUNDS_ERR _(L"Array index out of bounds")
class parser_t;
/** /**
Perform various forms of expansion on in, such as tilde expansion Perform various forms of expansion on in, such as tilde expansion
(\~USER becomes the users home directory), variable expansion (\~USER becomes the users home directory), variable expansion

View file

@ -22,20 +22,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "config.h" #include "config.h"
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/stat.h>
#include <string>
#include <vector>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <unistd.h>
#include <termios.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/param.h> #include <sys/socket.h> // IWYU pragma: keep - suggests internal header
#include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/types.h>
#include <pwd.h> #include <pwd.h>
#ifdef HAVE_GETOPT_H #ifdef HAVE_GETOPT_H
@ -43,29 +44,24 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#endif #endif
#include <locale.h> #include <locale.h>
#include <signal.h>
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "common.h" #include "common.h"
#include "reader.h" #include "reader.h"
#include "builtin.h" #include "builtin.h"
#include "function.h" #include "function.h"
#include "complete.h"
#include "wutil.h" #include "wutil.h"
#include "env.h" #include "env.h"
#include "sanity.h"
#include "proc.h" #include "proc.h"
#include "parser.h" #include "parser.h"
#include "expand.h" #include "expand.h"
#include "intern.h" #include "intern.h"
#include "exec.h"
#include "event.h" #include "event.h"
#include "output.h"
#include "history.h" #include "history.h"
#include "path.h" #include "path.h"
#include "input.h" #include "input.h"
#include "io.h"
#include "fish_version.h" #include "fish_version.h"
/* PATH_MAX may not exist */ /* PATH_MAX may not exist */

View file

@ -25,15 +25,20 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <stdio.h> #include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include <vector> #include <vector>
#include <map>
#ifdef HAVE_GETOPT_H #ifdef HAVE_GETOPT_H
#include <getopt.h> #include <getopt.h>
#endif #endif
#include <assert.h>
#include <locale.h>
#include <stddef.h>
#include <string>
#include "color.h"
#include "highlight.h"
#include "parse_constants.h"
#include "wutil.h" #include "wutil.h"
#include "common.h" #include "common.h"
#include "output.h" #include "output.h"
#include "screen.h"
#include "env.h" #include "env.h"
#include "input.h" #include "input.h"
#include "parse_tree.h" #include "parse_tree.h"

View file

@ -7,35 +7,28 @@
handling library. handling library.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h> #include <wchar.h>
#include <unistd.h>
#include <termios.h>
#include <signal.h>
#include <pthread.h> #include <pthread.h>
#include <errno.h>
#include <map> #include <map>
#include <set> #include <set>
#include <dirent.h>
#include <stddef.h>
#include <string>
#include <utility>
#include "wutil.h" #include "wutil.h"
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "autoload.h"
#include "function.h" #include "function.h"
#include "proc.h"
#include "parser.h"
#include "common.h" #include "common.h"
#include "intern.h" #include "intern.h"
#include "event.h" #include "event.h"
#include "reader.h" #include "reader.h"
#include "parse_util.h"
#include "parser_keywords.h" #include "parser_keywords.h"
#include "env.h" #include "env.h"
#include "expand.h"
/** /**
Table containing all functions Table containing all functions

View file

@ -10,16 +10,14 @@
#ifndef FISH_FUNCTION_H #ifndef FISH_FUNCTION_H
#define FISH_FUNCTION_H #define FISH_FUNCTION_H
#include <wchar.h> #include <vector>
#include <map> #include <map>
#include "util.h"
#include "common.h" #include "common.h"
#include "event.h" #include "event.h"
#include "env.h" #include "env.h"
class parser_t; class parser_t;
class env_vars_snapshot_t;
/** /**
Structure describing a function. This is used by the parser to Structure describing a function. This is used by the parser to

View file

@ -1,36 +1,31 @@
/** \file highlight.c /** \file highlight.c
Functions for syntax highlighting Functions for syntax highlighting
*/ */
#include "config.h"
#include <stdlib.h> #include "config.h" // IWYU pragma: keep
#include <stdio.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h>
#include <termios.h>
#include <signal.h>
#include <algorithm> #include <algorithm>
#include <dirent.h>
#include <map>
#include <set>
#include <string>
#include "fallback.h" #include "fallback.h"
#include "util.h"
#include "wutil.h" #include "wutil.h"
#include "highlight.h" #include "highlight.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "proc.h"
#include "parser.h"
#include "parse_util.h" #include "parse_util.h"
#include "parser_keywords.h" #include "parse_constants.h"
#include "builtin.h" #include "builtin.h"
#include "function.h" #include "function.h"
#include "env.h" #include "env.h"
#include "expand.h" #include "expand.h"
#include "sanity.h"
#include "common.h" #include "common.h"
#include "complete.h"
#include "output.h" #include "output.h"
#include "wildcard.h" #include "wildcard.h"
#include "path.h" #include "path.h"

View file

@ -5,10 +5,13 @@
#ifndef FISH_HIGHLIGHT_H #ifndef FISH_HIGHLIGHT_H
#define FISH_HIGHLIGHT_H #define FISH_HIGHLIGHT_H
#include <wchar.h> #include <assert.h> // for assert
#include <stddef.h> // for size_t
#include <stdint.h> // for uint32_t
#include <vector> // for vector
#include "common.h" // for wcstring, wcstring_list_t
#include "env.h" #include "env.h"
#include "util.h"
#include "color.h" #include "color.h"
/* Internally, we specify highlight colors using a set of bits. Each highlight_spec is a 32 bit uint. We divide this into low 16 (foreground) and high 16 (background). Each half we further subdivide into low 8 (primary) and high 8 (modifiers). The primary is not a bitmask; specify exactly one. The modifiers are a bitmask; specify any number */ /* Internally, we specify highlight colors using a set of bits. Each highlight_spec is a 32 bit uint. We divide this into low 16 (foreground) and high 16 (background). Each half we further subdivide into low 8 (primary) and high 8 (modifiers). The primary is not a bitmask; specify exactly one. The modifiers are a bitmask; specify any number */

View file

@ -7,8 +7,6 @@
#include <stdio.h> #include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include <errno.h> #include <errno.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
@ -16,22 +14,23 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <wctype.h>
#include <iterator>
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "sanity.h" #include "sanity.h"
#include "tokenizer.h"
#include "reader.h" #include "reader.h"
#include "parse_tree.h" #include "parse_tree.h"
#include "wutil.h" #include "wutil.h"
#include "history.h" #include "history.h"
#include "common.h" #include "common.h"
#include "intern.h"
#include "path.h" #include "path.h"
#include "signal.h" #include "signal.h"
#include "autoload.h"
#include "iothread.h" #include "iothread.h"
#include "env.h"
#include "lru.h"
#include "parse_constants.h"
#include <map> #include <map>
#include <algorithm> #include <algorithm>

View file

@ -5,15 +5,18 @@
#ifndef FISH_HISTORY_H #ifndef FISH_HISTORY_H
#define FISH_HISTORY_H #define FISH_HISTORY_H
#include <wchar.h>
#include "common.h" #include "common.h"
#include "pthread.h"
#include "wutil.h" #include "wutil.h"
#include <deque> #include <deque>
#include <vector> #include <vector>
#include <utility> #include <utility>
#include <list>
#include <set> #include <set>
#include <pthread.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <string>
/* fish supports multiple shells writing to history at once. Here is its strategy: /* fish supports multiple shells writing to history at once. Here is its strategy:

View file

@ -6,19 +6,8 @@
#include "config.h" #include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include <errno.h> #include <errno.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <wchar.h> #include <wchar.h>
@ -36,30 +25,21 @@
#include <ncurses/term.h> #include <ncurses/term.h>
#endif #endif
#include <signal.h>
#include <dirent.h>
#include <wctype.h> #include <wctype.h>
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "reader.h" #include "reader.h"
#include "proc.h" #include "proc.h"
#include "common.h" #include "common.h"
#include "sanity.h"
#include "input_common.h" #include "input_common.h"
#include "input.h" #include "input.h"
#include "parser.h" #include "parser.h"
#include "env.h" #include "env.h"
#include "expand.h"
#include "event.h" #include "event.h"
#include "signal.h" #include "signal.h" // IWYU pragma: keep - needed for CHECK_BLOCK
#include "io.h"
#include "output.h" #include "output.h"
#include "intern.h"
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>

View file

@ -8,8 +8,12 @@ inputrc information for key bindings.
#ifndef FISH_INPUT_H #ifndef FISH_INPUT_H
#define FISH_INPUT_H #define FISH_INPUT_H
#include <wchar.h> #include <stddef.h>
#include <utility> #include <string>
#include <vector>
#include "common.h"
#include "env.h"
#include "input_common.h" #include "input_common.h"

View file

@ -6,28 +6,26 @@ Implementation file for the low level input library
#include "config.h" #include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <wchar.h>
#include <stack>
#include <list> #include <list>
#include <queue> #include <queue>
#include <cwchar> // for wint_t
#include <deque> // for deque
#include <utility> // for swap, pair
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h" #include "util.h"
#include "common.h" #include "common.h"
#include "wutil.h"
#include "input_common.h" #include "input_common.h"
#include "env_universal_common.h" #include "env_universal_common.h"
#include "env.h"
#include "iothread.h" #include "iothread.h"
/** /**

View file

@ -6,7 +6,7 @@ Header file for the low level input library
#ifndef INPUT_COMMON_H #ifndef INPUT_COMMON_H
#define INPUT_COMMON_H #define INPUT_COMMON_H
#include <wchar.h> #include <stddef.h>
/** /**
Use unencoded private-use keycodes for internal characters Use unencoded private-use keycodes for internal characters

View file

@ -3,20 +3,14 @@
Library for pooling common strings Library for pooling common strings
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include <unistd.h> #include <pthread.h>
#include <set> #include <vector>
#include <algorithm> #include <algorithm>
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wutil.h"
#include "common.h" #include "common.h"
#include "intern.h" #include "intern.h"

View file

@ -7,8 +7,6 @@
#ifndef FISH_INTERN_H #ifndef FISH_INTERN_H
#define FISH_INTERN_H #define FISH_INTERN_H
#include <wchar.h>
/** /**
Return an identical copy of the specified string from a pool of unique strings. If the string was not in the pool, add a copy. Return an identical copy of the specified string from a pool of unique strings. If the string was not in the pool, add a copy.

33
io.cpp
View file

@ -3,42 +3,15 @@
Utilities for io redirection. Utilities for io redirection.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <wchar.h>
#include <string.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <assert.h>
#include <set>
#include <algorithm>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <fcntl.h>
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h>
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include "fallback.h"
#include "util.h"
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" #include "wutil.h"
#include "exec.h" #include "exec.h"
#include "common.h" #include "common.h"

4
io.h
View file

@ -2,6 +2,8 @@
#define FISH_IO_H #define FISH_IO_H
#include <vector> #include <vector>
#include <stddef.h>
#include <stdlib.h>
// Note that we have to include something to get any _LIBCPP_VERSION defined so we can detect libc++ // Note that we have to include something to get any _LIBCPP_VERSION defined so we can detect libc++
// So it's key that vector go above. If we didn't need vector for other reasons, we might include ciso646, which does nothing // So it's key that vector go above. If we didn't need vector for other reasons, we might include ciso646, which does nothing
@ -16,6 +18,8 @@ using std::shared_ptr;
using std::tr1::shared_ptr; using std::tr1::shared_ptr;
#endif #endif
#include "common.h"
/** /**
Describes what type of IO operation an io_data_t represents Describes what type of IO operation an io_data_t represents
*/ */

View file

@ -1,16 +1,17 @@
#include "config.h" #include "config.h" // IWYU pragma: keep
#include "iothread.h" #include "iothread.h"
#include "common.h" #include "common.h"
#include <pthread.h> #include <pthread.h>
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <limits.h> // IWYU pragma: keep - for _POSIX_THREADS_MAX, suggests internal header
#include <stdlib.h> #include <sys/select.h>
#include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <fcntl.h> #include <fcntl.h>
#include <queue> #include <queue>
#include <algorithm>
#ifdef _POSIX_THREAD_THREADS_MAX #ifdef _POSIX_THREAD_THREADS_MAX
#if _POSIX_THREAD_THREADS_MAX < 64 #if _POSIX_THREAD_THREADS_MAX < 64

View file

@ -6,26 +6,15 @@
with the X clipboard. with the X clipboard.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h> #include <stddef.h>
#include <stdio.h>
#include <wchar.h>
#include <termios.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <algorithm> #include <algorithm>
#include <list>
#include <string>
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wutil.h"
#include "kill.h" #include "kill.h"
#include "proc.h"
#include "sanity.h"
#include "common.h" #include "common.h"
#include "env.h" #include "env.h"
#include "exec.h" #include "exec.h"

2
kill.h
View file

@ -7,7 +7,7 @@
#ifndef FISH_KILL_H #ifndef FISH_KILL_H
#define FISH_KILL_H #define FISH_KILL_H
#include <wchar.h> #include "common.h"
/** /**
Replace the specified string in the killring Replace the specified string in the killring

1
lru.h
View file

@ -6,6 +6,7 @@
#ifndef FISH_LRU_H #ifndef FISH_LRU_H
#define FISH_LRU_H #define FISH_LRU_H
#include <assert.h>
#include <wchar.h> #include <wchar.h>
#include <map> #include <map>
#include <set> #include <set>

View file

@ -7,18 +7,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <sys/time.h>
#include <unistd.h>
#include <wctype.h>
#if HAVE_NCURSES_H #if HAVE_NCURSES_H
#include <ncurses.h> #include <ncurses.h>
@ -34,22 +22,14 @@
#include <ncurses/term.h> #include <ncurses/term.h>
#endif #endif
#include <signal.h>
#include <fcntl.h>
#include <dirent.h>
#include <time.h>
#include <wchar.h> #include <wchar.h>
#include <limits.h>
#include <string>
#include "fallback.h" #include "fallback.h"
#include "util.h" #include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "wutil.h"
#include "expand.h"
#include "common.h" #include "common.h"
#include "output.h" #include "output.h"
#include "highlight.h"
#include "env.h"
/** /**
Number of color names in the col array Number of color names in the col array

View file

@ -8,9 +8,10 @@
#ifndef FISH_OUTPUT_H #ifndef FISH_OUTPUT_H
#define FISH_OUTPUT_H #define FISH_OUTPUT_H
#include <wchar.h> #include <stddef.h>
#include <vector>
#include "common.h"
#include "fallback.h" #include "fallback.h"
#include "screen.h"
#include "color.h" #include "color.h"
/** /**

View file

@ -1,11 +1,14 @@
#include "config.h" #include "config.h" // IWYU pragma: keep
#include "pager.h" #include <assert.h>
#include "highlight.h" #include <wchar.h>
#include "input_common.h" #include <wctype.h>
#include "wutil.h"
#include <vector> #include <vector>
#include <map> #include <map>
#include "util.h"
#include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "pager.h"
#include "highlight.h"
typedef pager_t::comp_t comp_t; typedef pager_t::comp_t comp_t;
typedef std::vector<completion_t> completion_list_t; typedef std::vector<completion_t> completion_list_t;

View file

@ -2,6 +2,10 @@
Pager support Pager support
*/ */
#include <stddef.h>
#include <string>
#include <vector>
#include "common.h"
#include "complete.h" #include "complete.h"
#include "screen.h" #include "screen.h"
#include "reader.h" #include "reader.h"

View file

@ -8,17 +8,33 @@
*/ */
#include "parse_execution.h" #include "parse_execution.h"
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include <wchar.h>
#include <wctype.h>
#include <string>
#include <memory> // IWYU pragma: keep - suggests <tr1/memory> instead
#include <vector>
#include "env.h"
#include "event.h"
#include "tokenizer.h"
#include "util.h"
#include "parse_util.h" #include "parse_util.h"
#include "complete.h" #include "complete.h"
#include "wildcard.h" #include "wildcard.h"
#include "builtin.h"
#include "parser.h" #include "parser.h"
#include "expand.h" #include "expand.h"
#include "reader.h" #include "reader.h"
#include "wutil.h" #include "wutil.h"
#include "exec.h"
#include "path.h" #include "path.h"
#include <algorithm> #include "function.h"
#include "builtin.h"
#include "exec.h"
/* These are the specific statement types that support redirections */ /* These are the specific statement types that support redirections */
static bool specific_statement_type_is_redirectable_block(const parse_node_t &node) static bool specific_statement_type_is_redirectable_block(const parse_node_t &node)

View file

@ -6,12 +6,14 @@
#ifndef FISH_PARSE_EXECUTION_H #ifndef FISH_PARSE_EXECUTION_H
#define FISH_PARSE_EXECUTION_H #define FISH_PARSE_EXECUTION_H
#include "config.h" #include <stddef.h>
#include "util.h" #include "common.h"
#include "io.h"
#include "parse_constants.h"
#include "parse_tree.h" #include "parse_tree.h"
#include "proc.h" #include "proc.h"
class job_t; class parser_t;
struct block_t; struct block_t;
enum parse_execution_result_t enum parse_execution_result_t

View file

@ -1,4 +1,7 @@
#include "parse_productions.h" #include "parse_productions.h"
#include <assert.h>
#include <stdio.h>
#include "parse_tree.h"
using namespace parse_productions; using namespace parse_productions;
#define NO_PRODUCTION ((production_option_idx_t)(-1)) #define NO_PRODUCTION ((production_option_idx_t)(-1))

View file

@ -6,8 +6,11 @@
#ifndef FISH_PARSE_TREE_CONSTRUCTION_H #ifndef FISH_PARSE_TREE_CONSTRUCTION_H
#define FISH_PARSE_TREE_CONSTRUCTION_H #define FISH_PARSE_TREE_CONSTRUCTION_H
#include "parse_tree.h" #include <stdint.h> // for uint8_t, uint32_t
#include <inttypes.h> #include "common.h" // for wcstring
#include "parse_constants.h" // for parse_token_type_t, etc
struct parse_token_t;
namespace parse_productions namespace parse_productions
{ {

View file

@ -1,9 +1,18 @@
#include <assert.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <wchar.h>
#include <string>
#include "common.h"
#include "parse_constants.h"
#include "parse_productions.h" #include "parse_productions.h"
#include "parse_tree.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "fallback.h" #include "fallback.h"
#include "wutil.h" #include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "proc.h" #include "proc.h"
#include "expand.h"
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>

View file

@ -6,17 +6,15 @@
#ifndef FISH_PARSE_PRODUCTIONS_H #ifndef FISH_PARSE_PRODUCTIONS_H
#define FISH_PARSE_PRODUCTIONS_H #define FISH_PARSE_PRODUCTIONS_H
#include <wchar.h> #include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include "config.h"
#include "util.h"
#include "common.h" #include "common.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "parse_constants.h" #include "parse_constants.h"
#include <vector> #include <vector>
#include <inttypes.h>
class parse_node_t;
class parse_node_tree_t; class parse_node_tree_t;
typedef uint32_t node_offset_t; typedef uint32_t node_offset_t;

View file

@ -8,38 +8,24 @@
parsing the code. parsing the code.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdarg.h>
#include <sys/types.h>
#include <unistd.h>
#include <wctype.h>
#include <wchar.h> #include <wchar.h>
#include <map> #include <string>
#include <set>
#include <algorithm>
#include <time.h>
#include <assert.h> #include <assert.h>
#include "fallback.h" #include "fallback.h"
#include "util.h" #include "util.h"
#include "wutil.h" // IWYU pragma: keep
#include "wutil.h"
#include "common.h" #include "common.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "parse_util.h" #include "parse_util.h"
#include "expand.h" #include "expand.h"
#include "intern.h"
#include "exec.h"
#include "env.h" #include "env.h"
#include "signal.h"
#include "wildcard.h" #include "wildcard.h"
#include "parse_tree.h" #include "parse_tree.h"
#include "parser.h"
#include "builtin.h" #include "builtin.h"
/** Error message for improper use of the exec builtin */ /** Error message for improper use of the exec builtin */

View file

@ -7,11 +7,10 @@
#ifndef FISH_PARSE_UTIL_H #ifndef FISH_PARSE_UTIL_H
#define FISH_PARSE_UTIL_H #define FISH_PARSE_UTIL_H
#include "autoload.h" #include <stddef.h>
#include "parse_tree.h" #include <vector>
#include <wchar.h> #include "common.h"
#include <map> #include "parse_constants.h"
#include <set>
/** /**
Find the beginning and end of the first subshell in the specified string. Find the beginning and end of the first subshell in the specified string.
@ -186,6 +185,7 @@ parser_test_error_bits_t parse_util_detect_errors(const wcstring &buff_src, pars
This does NOT currently detect unterminated quotes. This does NOT currently detect unterminated quotes.
*/ */
class parse_node_t;
parser_test_error_bits_t parse_util_detect_errors_in_argument(const parse_node_t &node, const wcstring &arg_src, parse_error_list_t *out_errors = NULL); parser_test_error_bits_t parse_util_detect_errors_in_argument(const parse_node_t &node, const wcstring &arg_src, parse_error_list_t *out_errors = NULL);
/* Given a string containing a variable expansion error, append an appropriate error to the errors list. The global_token_pos is the offset of the token in the larger source, and the dollar_pos is the offset of the offending dollar sign within the token. */ /* Given a string containing a variable expansion error, append an appropriate error to the errors list. The global_token_pos is the offset of the token in the larger source, and the dollar_pos is the offset of the offending dollar sign within the token. */

View file

@ -4,44 +4,28 @@ The fish parser. Contains functions for parsing and evaluating code.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include <sys/types.h> #include <assert.h>
#include <sys/stat.h> #include <string>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <termios.h>
#include <pwd.h>
#include <dirent.h>
#include <algorithm> #include <algorithm>
#include "fallback.h" #include "fallback.h"
#include "util.h"
#include "common.h" #include "common.h"
#include "wutil.h" #include "wutil.h"
#include "proc.h" #include "proc.h"
#include "parser.h" #include "parser.h"
#include "parser_keywords.h"
#include "tokenizer.h"
#include "exec.h"
#include "wildcard.h"
#include "function.h" #include "function.h"
#include "builtin.h"
#include "env.h" #include "env.h"
#include "expand.h" #include "expand.h"
#include "reader.h" #include "reader.h"
#include "sanity.h" #include "sanity.h"
#include "event.h" #include "event.h"
#include "intern.h" #include "intern.h"
#include "signal.h" // IWYU pragma: keep - needed for CHECK_BLOCK
#include "parse_util.h" #include "parse_util.h"
#include "path.h"
#include "signal.h"
#include "complete.h"
#include "parse_tree.h" #include "parse_tree.h"
#include "parse_execution.h" #include "parse_execution.h"

View file

@ -5,13 +5,16 @@
#ifndef FISH_PARSER_H #ifndef FISH_PARSER_H
#define FISH_PARSER_H #define FISH_PARSER_H
#include <wchar.h> #include <stddef.h> // for size_t
#include <list> // for _List_const_iterator, list, etc
#include "common.h"
#include "proc.h" #include "proc.h"
#include "util.h"
#include "event.h" #include "event.h"
#include "function.h"
#include "parse_tree.h" #include "parse_tree.h"
#include "io.h"
#include "parse_constants.h"
#include <vector> #include <vector>
/** /**
@ -226,8 +229,8 @@ struct profile_item_t
wcstring cmd; wcstring cmd;
}; };
struct tokenizer_t;
class parse_execution_context_t; class parse_execution_context_t;
class completion_t;
class parser_t class parser_t
{ {

View file

@ -3,13 +3,9 @@
Functions having to do with parser keywords, like testing if a function is a block command. Functions having to do with parser keywords, like testing if a function is a block command.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include "fallback.h" // IWYU pragma: keep
#include <stdlib.h>
#include <stdio.h>
#include "fallback.h"
#include "common.h" #include "common.h"
#include "parser_keywords.h" #include "parser_keywords.h"

View file

@ -6,6 +6,8 @@ Functions having to do with parser keywords, like testing if a function is a blo
#ifndef FISH_PARSER_KEYWORD_H #ifndef FISH_PARSER_KEYWORD_H
#define FISH_PARSER_KEYWORD_H #define FISH_PARSER_KEYWORD_H
#include "common.h"
/** /**
Tests if the specified commands parameters should be interpreted as another command, which will be true if the command is either 'command', 'exec', 'if', 'while', or 'builtin'. This does not handle "else if" which is more complicated. Tests if the specified commands parameters should be interpreted as another command, which will be true if the command is either 'command', 'exec', 'if', 'while', or 'builtin'. This does not handle "else if" which is more complicated.

View file

@ -1,17 +1,14 @@
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <libgen.h> #include <assert.h>
#include <string>
#include "fallback.h" #include <vector>
#include "util.h"
#include "fallback.h" // IWYU pragma: keep
#include "common.h" #include "common.h"
#include "env.h" #include "env.h"
#include "wutil.h" #include "wutil.h"

2
path.h
View file

@ -9,6 +9,8 @@
#ifndef FISH_PATH_H #ifndef FISH_PATH_H
#define FISH_PATH_H #define FISH_PATH_H
#include <stddef.h>
#include "common.h"
#include "env.h" #include "env.h"
/** /**

View file

@ -4,6 +4,15 @@
*/ */
#include <fcntl.h> #include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <memory> // IWYU pragma: keep - suggests <tr1/memory> instead
#include "common.h"
#include "proc.h"
#include "wutil.h"
#include "signal.h" #include "signal.h"
#include "postfork.h" #include "postfork.h"
#include "iothread.h" #include "iothread.h"

View file

@ -6,17 +6,10 @@
#ifndef FISH_POSTFORK_H #ifndef FISH_POSTFORK_H
#define FISH_POSTFORK_H #define FISH_POSTFORK_H
#include <wchar.h> #include <stddef.h>
#include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <sys/time.h>
#include <list>
#include "config.h" #include "config.h"
#include "common.h"
#include "util.h"
#include "proc.h"
#include "wutil.h"
#include "io.h" #include "io.h"
#if HAVE_SPAWN_H #if HAVE_SPAWN_H
@ -40,6 +33,8 @@
Returns 0 on sucess, -1 on failiure. Returns 0 on sucess, -1 on failiure.
*/ */
class job_t;
class process_t;
int set_child_group(job_t *j, process_t *p, int print_errors); int set_child_group(job_t *j, process_t *p, int print_errors);
/** /**

View file

@ -6,6 +6,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stddef.h>
#include <sys/types.h>
#include "print_help.h" #include "print_help.h"

View file

@ -18,27 +18,16 @@ Some of the code in this file is based on code from the Glibc manual.
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <termios.h> #include <termios.h>
#include <sys/types.h> #include <pthread.h>
#include <sys/stat.h> #include <wctype.h>
#include <algorithm> #include <algorithm>
#include <memory> // IWYU pragma: keep - suggests <tr1/memory> instead
#ifdef HAVE_SYS_IOCTL_H #include <vector>
#include <sys/ioctl.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <dirent.h>
#include <sys/time.h> #include <sys/time.h>
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h>
#else
#include <curses.h>
#endif
#if HAVE_TERM_H #if HAVE_TERM_H
#include <term.h> #include <term.h>
#elif HAVE_NCURSES_TERM_H #elif HAVE_NCURSES_TERM_H
@ -53,7 +42,7 @@ Some of the code in this file is based on code from the Glibc manual.
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h" #include "util.h"
#include "wutil.h" #include "wutil.h"
@ -61,7 +50,6 @@ Some of the code in this file is based on code from the Glibc manual.
#include "common.h" #include "common.h"
#include "reader.h" #include "reader.h"
#include "sanity.h" #include "sanity.h"
#include "env.h"
#include "parser.h" #include "parser.h"
#include "signal.h" #include "signal.h"
#include "event.h" #include "event.h"

8
proc.h
View file

@ -11,13 +11,14 @@
#ifndef FISH_PROC_H #ifndef FISH_PROC_H
#define FISH_PROC_H #define FISH_PROC_H
#include <wchar.h>
#include <signal.h> #include <signal.h>
#include <unistd.h>
#include <sys/time.h> #include <sys/time.h>
#include <list> #include <list>
#include <assert.h> // for assert
#include <stddef.h> // for size_t
#include <termios.h> // for pid_t, termios
#include "util.h" #include "config.h" // for HAVE__PROC_SELF_STAT
#include "io.h" #include "io.h"
#include "common.h" #include "common.h"
#include "parse_tree.h" #include "parse_tree.h"
@ -268,7 +269,6 @@ void release_job_id(job_id_t jobid);
A struct represeting a job. A job is basically a pipeline of one A struct represeting a job. A job is basically a pipeline of one
or more processes and a couple of flags. or more processes and a couple of flags.
*/ */
class parser_t;
class job_t class job_t
{ {
/** /**

View file

@ -24,39 +24,17 @@ commence.
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <termios.h> #include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/wait.h>
#include <sys/poll.h>
#include <unistd.h> #include <unistd.h>
#include <wctype.h> #include <wctype.h>
#include <stack> #include <stack>
#include <pthread.h> #include <pthread.h>
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h>
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#ifdef HAVE_SIGINFO_H #ifdef HAVE_SIGINFO_H
#include <siginfo.h> #include <siginfo.h>
#endif #endif
@ -67,9 +45,7 @@ commence.
#include <signal.h> #include <signal.h>
#include <fcntl.h> #include <fcntl.h>
#include <dirent.h>
#include <wchar.h> #include <wchar.h>
#include <assert.h> #include <assert.h>
@ -98,11 +74,11 @@ commence.
#include "screen.h" #include "screen.h"
#include "iothread.h" #include "iothread.h"
#include "intern.h" #include "intern.h"
#include "path.h"
#include "parse_util.h" #include "parse_util.h"
#include "parser_keywords.h"
#include "parse_tree.h" #include "parse_tree.h"
#include "pager.h" #include "pager.h"
#include "color.h"
#include "event.h"
/** /**
Maximum length of prefix string when printing completion Maximum length of prefix string when printing completion

View file

@ -10,17 +10,15 @@
#define FISH_READER_H #define FISH_READER_H
#include <vector> #include <vector>
#include <wchar.h> #include <string>
#include <stddef.h>
#include "util.h"
#include "io.h" #include "io.h"
#include "common.h" #include "common.h"
#include "complete.h" #include "complete.h"
#include "highlight.h" #include "highlight.h"
#include "parse_constants.h" #include "parse_constants.h"
class parser_t;
class completion_t;
class history_t; class history_t;
/* Helper class for storing a command line */ /* Helper class for storing a command line */

View file

@ -1,30 +1,17 @@
/** \file sanity.c /** \file sanity.c
Functions for performing sanity checks on the program state Functions for performing sanity checks on the program state
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <wchar.h>
#include <stdio.h>
#include <errno.h>
#include <termios.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include "fallback.h"
#include "util.h"
#include "fallback.h" // IWYU pragma: keep
#include "common.h" #include "common.h"
#include "sanity.h" #include "sanity.h"
#include "proc.h" #include "proc.h"
#include "history.h" #include "history.h"
#include "reader.h" #include "reader.h"
#include "kill.h" #include "kill.h"
#include "wutil.h"
/** /**

View file

@ -5,8 +5,6 @@
#ifndef FISH_SANITY_H #ifndef FISH_SANITY_H
#define FISH_SANITY_H #define FISH_SANITY_H
#include <wchar.h>
/** /**
Call this function to tell the program it is not in a sane state. Call this function to tell the program it is not in a sane state.
*/ */

View file

@ -11,12 +11,8 @@ efficient way for transforming that to the desired screen content.
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <termios.h>
#include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <wctype.h>
#if HAVE_NCURSES_H #if HAVE_NCURSES_H
#include <ncurses.h> #include <ncurses.h>
@ -36,13 +32,14 @@ efficient way for transforming that to the desired screen content.
#include <time.h> #include <time.h>
#include <assert.h> #include <assert.h>
#include <algorithm>
#include <string>
#include <vector> #include <vector>
#include "fallback.h" #include "fallback.h"
#include "common.h" #include "common.h"
#include "util.h" #include "util.h"
#include "wutil.h"
#include "output.h" #include "output.h"
#include "highlight.h" #include "highlight.h"
#include "screen.h" #include "screen.h"

View file

@ -12,8 +12,11 @@
#ifndef FISH_SCREEN_H #ifndef FISH_SCREEN_H
#define FISH_SCREEN_H #define FISH_SCREEN_H
#include <assert.h>
#include <stddef.h>
#include <vector> #include <vector>
#include <sys/stat.h> #include <sys/stat.h>
#include "common.h"
#include "highlight.h" #include "highlight.h"
class page_rendering_t; class page_rendering_t;

View file

@ -4,15 +4,11 @@ The library for various signal related issues
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h>
#include <signal.h> #include <signal.h>
#include <dirent.h>
#include <unistd.h>
#include <errno.h> #include <errno.h>
#ifdef HAVE_SIGINFO_H #ifdef HAVE_SIGINFO_H
@ -20,9 +16,7 @@ The library for various signal related issues
#endif #endif
#include "common.h" #include "common.h"
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wutil.h" #include "wutil.h"
#include "signal.h" #include "signal.h"
#include "event.h" #include "event.h"

View file

@ -6,22 +6,19 @@ tokenizing multiple strings and disposing of unused string
segments. segments.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <assert.h>
#include <string>
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wutil.h"
#include "tokenizer.h"
#include "common.h" #include "common.h"
#include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "tokenizer.h"
/* Wow what a hack */ /* Wow what a hack */
#define TOK_CALL_ERROR(t, e, x) do { tok_call_error((t), (e), (t)->squash_errors ? L"" : (x)); } while (0) #define TOK_CALL_ERROR(t, e, x) do { tok_call_error((t), (e), (t)->squash_errors ? L"" : (x)); } while (0)

View file

@ -9,7 +9,7 @@
#ifndef FISH_TOKENIZER_H #ifndef FISH_TOKENIZER_H
#define FISH_TOKENIZER_H #define FISH_TOKENIZER_H
#include <wchar.h> #include <stddef.h>
#include "common.h" #include "common.h"
/** /**

View file

@ -16,13 +16,12 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h> #include <stdint.h>
#include <wchar.h>
#include "utf8.h" #include "utf8.h"
#include <string> #include <string>
#include <vector>
#include <limits> #include <limits>
#include <algorithm>
#define _NXT 0x80 #define _NXT 0x80
#define _SEQ2 0xc0 #define _SEQ2 0xc0

3
utf8.h
View file

@ -20,10 +20,9 @@
#ifndef _UTF8_H_ #ifndef _UTF8_H_
#define _UTF8_H_ #define _UTF8_H_
#include <sys/types.h> #include <stddef.h>
#include <string> #include <string>
#include <wchar.h>
#define UTF8_IGNORE_ERROR 0x01 #define UTF8_IGNORE_ERROR 0x01
#define UTF8_SKIP_BOM 0x02 #define UTF8_SKIP_BOM 0x02

View file

@ -3,7 +3,7 @@
Helper functions for working with wcstring Helper functions for working with wcstring
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include "wcstringutil.h" #include "wcstringutil.h"

View file

@ -6,6 +6,7 @@ Helper functions for working with wcstring
#ifndef FISH_WCSTRINGUTIL_H #ifndef FISH_WCSTRINGUTIL_H
#define FISH_WCSTRINGUTIL_H #define FISH_WCSTRINGUTIL_H
#include <string>
#include <utility> #include <utility>
#include "common.h" #include "common.h"

View file

@ -61,12 +61,7 @@
#include <stdio.h> #include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include "common.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
/* This needs to come after some library #include /* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */ to get __GNU_LIBRARY__ defined. */
@ -92,7 +87,7 @@
#include "wgetopt.h" #include "wgetopt.h"
#include "wutil.h" #include "wutil.h"
#include "fallback.h" #include "fallback.h" // IWYU pragma: keep
@ -198,7 +193,7 @@ static char *posixly_correct;
because there are many ways it can cause trouble. because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work On some systems, it contains special magic macros that don't work
in GCC. */ in GCC. */
#include <string.h> #include <string.h> // IWYU pragma: keep
#define my_index wcschr #define my_index wcschr
#else #else

View file

@ -47,7 +47,7 @@ Cambridge, MA 02139, USA. */
#ifndef FISH_WGETOPT_H #ifndef FISH_WGETOPT_H
#define FISH_WGETOPT_H #define FISH_WGETOPT_H
#include <wchar.h> #include <features.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View file

@ -6,32 +6,28 @@ wildcards using **.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include <algorithm>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <wchar.h> #include <wchar.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <set> #include <set>
#include <assert.h>
#include <stddef.h>
#include <wctype.h>
#include <string>
#include <utility>
#include "fallback.h" #include "fallback.h"
#include "util.h"
#include "wutil.h" #include "wutil.h"
#include "complete.h"
#include "common.h" #include "common.h"
#include "wildcard.h" #include "wildcard.h"
#include "complete.h" #include "complete.h"
#include "reader.h" #include "reader.h"
#include "expand.h" #include "expand.h"
#include "exec.h"
#include <map> #include <map>
/** /**

View file

@ -12,10 +12,8 @@
*/ */
#define FISH_WILDCARD_H #define FISH_WILDCARD_H
#include <wchar.h>
#include <vector> #include <vector>
#include "util.h"
#include "common.h" #include "common.h"
#include "expand.h" #include "expand.h"
#include "complete.h" #include "complete.h"
@ -26,7 +24,6 @@
#define WILDCARD_RESERVED 0xf400 #define WILDCARD_RESERVED 0xf400
class completion_t;
/** /**
Enumeration of all wildcard types Enumeration of all wildcard types
*/ */

View file

@ -12,23 +12,17 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h>
#include <string.h> #include <string.h>
#include <dirent.h> #include <dirent.h>
#include <stdarg.h>
#include <limits.h> #include <limits.h>
#include <libgen.h> #include <libgen.h>
#include <pthread.h> #include <pthread.h>
#include <assert.h>
#include <features.h>
#include <string> #include <string>
#include <map> #include <map>
#if HAVE_LIBINTL_H
#include <libintl.h>
#endif
#include "fallback.h" #include "fallback.h"
#include "util.h"
#include "common.h" #include "common.h"
#include "wutil.h" #include "wutil.h"

View file

@ -6,16 +6,12 @@
#ifndef FISH_WUTIL_H #ifndef FISH_WUTIL_H
#define FISH_WUTIL_H #define FISH_WUTIL_H
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <wchar.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdarg.h> #include <stddef.h>
#include <time.h>
#include <string> #include <string>
#include <utility>
#include <stdint.h> #include <stdint.h>
#include "common.h" #include "common.h"