add better support for IWYU and fix things

Remove the "make iwyu" build target. Move the functionality into the
recently introduced lint.fish script. Fix a lot, but not all, of the
include-what-you-use errors. Specifically, it fixes all of the IWYU errors
on my OS X server but only removes some of them on my Ubuntu 14.04 server.

Fixes #2957
This commit is contained in:
Kurtis Rader 2016-04-20 23:00:54 -07:00
parent daa217f533
commit 1f06e5f0b9
104 changed files with 685 additions and 533 deletions

View file

@ -1,9 +1,27 @@
# Guidelines For Developers
This document provides guidelines for making changes to the fish-shell project. This includes rules for how to format the code, naming conventions, etc. It also includes recommended best practices such as creating a Travis-CI account so you can verify your changes pass all the tests before making a pull-request.
See the bottom of this document for help on installing the linting and style reformatting tools discussed in the following sections.
Fish source should limit the C++ features it uses to those available in C++03. That allows fish to use a few components from [C++TR1](https://en.wikipedia.org/wiki/C%2B%2B_Technical_Report_1) such as `shared_ptr`. It also allows fish to be built and run on OS X Snow Leopard (released in 2009); the oldest OS X release we still support.
## Include What You Use
You should not depend on symbols being visible to a `*.cpp` module from `#include` statements inside another header file. In other words if your module does `#include "common.h"` and that header does `#include "signal.h"` your module should pretend that sub-include is not present. It should instead directly `#include "signal.h"` if it needs any symbol from that header. That makes the actual dependencies much clearer. It also makes it easy to modify the headers included by a specific header file without having to worry that will break any module (or header) that includes a particular header.
To help enforce this rule the `make lint` (and `make lint-all`) command will run the [include-what-you-use](http://include-what-you-use.org/) tool. The IWYU you project is on [github](https://github.com/include-what-you-use/include-what-you-use).
To install the tool on OS X you'll need to add a [formula](https://github.com/jasonmp85/homebrew-iwyu) then install it:
```
brew tap jasonmp85/iwyu
brew install iwyu
```
On Ubuntu you can install it via `sudo apt-get install iwyu`.
## Lint Free Code
Automated analysis tools like cppcheck and oclint can point out potential bugs. They also help ensure the code has a consistent style and that it avoids patterns that tend to confuse people.

View file

@ -859,19 +859,11 @@ depend:
cp config.h /tmp/fish_make_depend/
mv $(subst obj/,/tmp/fish_make_depend/src/,$(FISH_ALL_OBJS:.o=.cpp)) /tmp/fish_make_depend/
cd /tmp/fish_make_depend && \
makedepend -f$(CURDIR)/Makefile.in -pobj/ -Y -Isrc *.cpp
makedepend -f$(CURDIR)/Makefile.in -pobj/ -Y -Isrc *.cpp
rm -Rf /tmp/fish_make_depend
./config.status
.PHONY: depend
# Include What You Use
iwyu:
# Requires the --keep-going flag as it always returns 1
# Can't set MAKEFLAGS on a target-specific basic
$(MAKE) -k _iwyu CXX=include-what-you-use
_iwyu: clean $(PROGRAMS)
.PHONY: iwyu _iwyu
# Lint the code. This only deals with C++ files.
lint:
build_tools/lint.fish $(CXX) $(CXXFLAGS)
@ -894,7 +886,7 @@ style-all:
# Restore the source tree to the state right after extracting a tarball.
distclean: clean
$(MAKE) -C $(PCRE2_DIR) distclean || true
rm -f config.status config.log config.h Makefile
rm -f config.status config.log config.h Makefile osx/config.h
.PHONY: distclean

View file

@ -13,9 +13,9 @@ Detailed user documentation is available by running `help` within fish, and also
## Building
fish is written in a sane subset of C++98, with a few components from C++TR1. It builds successfully with g++ 4.2 or later, and with clang. It also will build as C++11.
Fish can be built using a C++11 environment but only requires C++03. It builds successfully with g++ 4.2 or later, and with clang. This allows fish to run on older systems such as OS X Snow Leopard (released in 2009).
fish can be built using autotools or Xcode. autoconf 2.60 or later is required to build from git versions, but is not required for releases.
Fish can be built using autotools or Xcode. autoconf 2.60 or later is required to build from git versions, but is not required for releases.
fish depends on a curses implementation, such as ncurses. The headers and libraries are required for building.

View file

@ -0,0 +1,17 @@
# Map file for the include-what-you-use tool on Linux.
[
{ include: ["<bits/fcntl-linux.h>", "private", "<fcntl.h>", "public"] },
{ include: ["<bits/mman-linux.h>", "private", "<sys/mman.h>", "public"] },
{ include: ["<bits/socket-linux.h>", "private", "<sys/socket.h>", "public"] },
{ include: ["<bits/socket_type.h>", "private", "<sys/socket.h>", "public"] },
{ include: ["<bits/local_lim.h>", "private", "<limits.h>", "public"] },
{ include: ["<tr1/memory>", "public", "<memory>", "public"] },
{ include: ["<features.h>", "public", "<stdio.h>", "public"] },
{ include: ["<features.h>", "public", "<stddef.h>", "public"] },
{ include: ["<features.h>", "public", "<unistd.h>", "public"] },
{ symbol: ["size_t", "private", "<unistd.h>", "public"] },
{ symbol: ["size_t", "private", "<stddef.h>", "public"] },
{ symbol: ["size_t", "private", "<stdlib.h>", "public"] },
{ symbol: ["uint64_t", "private", "<sys/types.h>", "public"] },
]

97
build_tools/iwyu.osx.imp Normal file
View file

@ -0,0 +1,97 @@
# Map file for the include-what-you-use tool on OS X. For some reason
# the version installed by HomeBrew doesn't have useful mappings for the
# system provided private headers.
[
{ include: ["<sys/_pthread/_pthread_once_t.h>", "private", "<pthread.h>", "public"] },
{ include: ["<sys/_pthread/_pthread_mutex_t.h>", "private", "<pthread.h>", "public"] },
{ include: ["<sys/_pthread/_pthread_rwlock_t.h>", "private", "<pthread.h>", "public"] },
{ include: ["<sys/_pthread/_pthread_mutexattr_t.h>", "private", "<pthread.h>", "public"] },
{ include: ["<sys/_pthread/_pthread_cond_t.h>", "private", "<pthread.h>", "public"] },
{ include: ["<sys/_pthread/_pthread_t.h>", "private", "<pthread.h>", "public"] },
{ include: ["<sys/_pthread/_pthread_key_t.h>", "private", "<pthread.h>", "public"] },
{ include: ["<sys/_types/_posix_vdisable.h>", "private", "<pthread.h>", "public"] },
{ include: ["<sys/_types/_time_t.h>", "private", "<time.h>", "public"] },
{ include: ["<sys/_types/_suseconds_t.h>", "private", "<time.h>", "public"] },
{ include: ["<sys/_types/_suseconds_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/errno.h>", "private", "<errno.h>", "public"] },
{ include: ["<sys/unistd.h>", "private", "<unistd.h>", "public"] },
{ include: ["<_wctype.h>", "private", "<wctype.h>", "public"] },
{ include: ["<sys/fcntl.h>", "private", "<fcntl.h>", "public"] },
{ include: ["<sys/_types/_seek_set.h>", "private", "<fcntl.h>", "public"] },
{ include: ["<sys/_types/_mbstate_t.h>", "private", "<wchar.h>", "public"] },
{ include: ["<iosfwd>", "private", "<string>", "public"] },
{ include: ["<sys/_types/_s_ifmt.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_size_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_size_t.h>", "private", "<stdlib.h>", "public"] },
{ include: ["<sys/_types/_mode_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_pid_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_fd_def.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_fd_isset.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_fd_set.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_fd_zero.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_timeval.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_uid_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<_types/_intmax_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<_types/_uintmax_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<_types/_uint8_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_int32_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<_types/_uint64_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_uintptr_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_dev_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_ino_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_va_list.h>", "private", "<stdio.h>", "public"] },
{ include: ["<__functional_base>", "private", "<memory>", "public"] },
{ include: ["<__functional_base>", "private", "<vector>", "public"] },
{ include: ["<__functional_base>", "private", "<string>", "public"] },
{ include: ["<__tree>", "private", "<map>", "public"] },
{ include: ["<__tree>", "private", "<set>", "public"] },
{ include: ["<_types/_uint32_t.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_va_list.h>", "private", "<sys/types.h>", "public"] },
{ include: ["<sys/_types/_sigset_t.h>", "private", "<signal.h>", "public"] },
{ include: ["<sys/signal.h>", "private", "<signal.h>", "public"] },
{ include: ["<strings.h>", "private", "<string.h>", "public"] },
{ include: ["<sys/termios.h>", "private", "<termios.h>", "public"] },
{ include: ["<sys/ttycom.h>", "private", "<termios.h>", "public"] },
{ include: ["<sys/syslimits.h>", "private", "<limits.h>", "public"] },
{ include: ["<i386/limits.h>", "private", "<limits.h>", "public"] },
{ include: ["<sys/_types/_wint_t.h>", "private", "<stddef.h>", "public"] },
{ include: ["<sys/_select.h>", "private", "<select.h>", "public"] },
{ include: ["<sys/cdefs.h>", "private", "<unistd.h>", "public"] },
{ include: ["<istream>", "private", "<iostream>", "public"] },
{ include: ["<sys/_endian.h>", "private", "<netinet/in.h>", "public"] },
{ include: ["<sys/_types/_timespec.h>", "private", "<time.h>", "public"] },
{ include: ["<sys/spawn.h>", "private", "<spawn.h>", "public"] },
{ include: ["<sys/dirent.h>", "private", "<dirent.h>", "public"] },
# { include: ["<>", "private", "<>", "public"] },
{ symbol: ["NULL", "private", "<stddef.h>", "public"] },
{ symbol: ["NULL", "private", "<stdlib.h>", "public"] },
{ symbol: ["NULL", "private", "<stdio.h>", "public"] },
{ symbol: ["NULL", "private", "<unistd.h>", "public"] },
{ symbol: ["off_t", "private", "<unistd.h>", "public"] },
{ symbol: ["size_t", "private", "<unistd.h>", "public"] },
{ symbol: ["size_t", "private", "<stddef.h>", "public"] },
{ symbol: ["size_t", "private", "<stdlib.h>", "public"] },
{ symbol: ["off_t", "private", "<sys/types.h>", "public"] },
{ symbol: ["size_t", "private", "<sys/types.h>", "public"] },
{ symbol: ["ssize_t", "private", "<sys/types.h>", "public"] },
{ symbol: ["intptr_t", "private", "<unistd.h>", "public"] },
{ symbol: ["ssize_t", "private", "<unistd.h>", "public"] },
{ symbol: ["gid_t", "private", "<unistd.h>", "public"] },
{ symbol: ["uid_t", "private", "<unistd.h>", "public"] },
{ symbol: ["pid_t", "private", "<unistd.h>", "public"] },
{ symbol: ["pid_t", "private", "<sys/types.h>", "public"] },
{ symbol: ["uid_t", "private", "<sys/types.h>", "public"] },
{ symbol: ["gid_t", "private", "<sys/types.h>", "public"] },
{ symbol: ["uint32_t", "private", "<sys/types.h>", "public"] },
{ symbol: ["uint32_t", "private", "<stdint.h>", "public"] },
{ symbol: ["intptr_t", "private", "<stdint.h>", "public"] },
{ symbol: ["size_t", "private", "<stdint.h>", "public"] },
{ symbol: ["tparm", "private", "<ncurses.h>", "public"] },
{ symbol: ["ERR", "private", "<ncurses.h>", "public"] },
{ symbol: ["select", "private", "<sys/select.h>", "public"] },
{ symbol: ["_LIBCPP_VERSION", "private", "<stddef.h>", "public"] },
{ symbol: ["_LIBCPP_VERSION", "private", "<unistd.h>", "public"] },
{ symbol: ["MB_CUR_MAX", "private", "<xlocale.h>", "public"] },
{ symbol: ["MB_CUR_MAX", "private", "<stdlib.h>", "public"] },
]

View file

@ -7,6 +7,8 @@ set cppchecks warning,performance,portability,information,missingInclude
set cppcheck_args
set c_files
set all no
set kernel_name (uname -s)
set machine_type (uname -m)
set -gx CXX $argv[1]
set -e argv[1]
@ -17,15 +19,27 @@ if test "$argv[1]" = "--all"
set -e argv[1]
end
if test $kernel_name = Linux
# This is an awful hack. However, the include-what-you-use program spews lots of errors like
# /usr/include/unistd.h:226:10: fatal error: 'stddef.h' file not found
# if we don't explicitly tell it where to find the system headers on Linux. See
# http://stackoverflow.com/questions/19642590/libtooling-cant-find-stddef-h-nor-other-headers/
set -l sys_includes (eval $CXX -v -c src/builtin.cpp 2>&1 | \
sed -n -e '/^#include <...> search/,/^End of search list/s/^ *//p')[2..-2]
set -x CPLUS_INCLUDE_PATH (string join ':' $sys_includes)
end
# We only want -D and -I options to be passed thru to cppcheck.
for arg in $argv
if string match -q -- '-D*' $arg
set cppcheck_args $cppcheck_args $arg
else if string match -q -- '-I*' $arg
set cppcheck_args $cppcheck_args $arg
else if string match -q -- '-iquote*' $arg
set cppcheck_args $cppcheck_args $arg
end
end
if test (uname -m) = "x86_64"
if test "$machine_type" = "x86_64"
set cppcheck_args -D__x86_64__ -D__LP64__ $cppcheck_args
end
@ -37,7 +51,7 @@ else
set files (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//')
if not set -q files[1]
# No pending changes so lint the files in the most recent commit.
set files (git show --word-diff=porcelain --name-only --pretty=oneline head)[2..-1]
set files (git show --word-diff=porcelain --name-only --pretty=oneline)[2..-1]
end
# Extract just the C/C++ files.
@ -46,6 +60,26 @@ end
# We now have a list of files to check so run the linters.
if set -q c_files[1]
if type -q iwyu
# The stderr to stdout redirection is because cppcheck, incorrectly IMHO, writes its
# diagnostic messages to stderr. Anyone running this who wants to capture its output will
# expect those messages to be written to stdout.
for c_file in $c_files
echo
echo ========================================
echo Running IWYU on $c_file
echo ========================================
switch $kernel_name
case Darwin
include-what-you-use -Xiwyu --no_default_mappings -Xiwyu --mapping_file=build_tools/iwyu.osx.imp $cppcheck_args $c_file 2>&1
case Linux
include-what-you-use -Xiwyu --mapping_file=build_tools/iwyu.linux.imp $cppcheck_args $c_file 2>&1
case '*' # hope for the best
include-what-you-use $cppcheck_args $c_file 2>&1
end
end
end
if type -q cppcheck
echo
echo ========================================
@ -54,7 +88,7 @@ if set -q c_files[1]
# The stderr to stdout redirection is because cppcheck, incorrectly IMHO, writes its
# diagnostic messages to stderr. Anyone running this who wants to capture its output will
# expect those messages to be written to stdout.
cppcheck -q --verbose --std=posix --std=c11 --language=c++ --template "[{file}:{line}]: {severity} ({id}): {message}" --suppress=missingIncludeSystem --inline-suppr --enable=$cppchecks $cppcheck_args $c_files 2>& 1
cppcheck -q --verbose --std=posix --std=c11 --language=c++ --template "[{file}:{line}]: {severity} ({id}): {message}" --suppress=missingIncludeSystem --inline-suppr --enable=$cppchecks $cppcheck_args $c_files 2>&1
end
if type -q oclint
@ -65,25 +99,25 @@ if set -q c_files[1]
# The stderr to stdout redirection is because oclint, incorrectly writes its final summary
# counts of the errors detected to stderr. Anyone running this who wants to capture its
# output will expect those messages to be written to stdout.
if test (uname -s) = "Darwin"
if test "$kernel_name" = "Darwin"
if not test -f compile_commands.json
xcodebuild > xcodebuild.log
oclint-xcodebuild xcodebuild.log > /dev/null
xcodebuild >xcodebuild.log
oclint-xcodebuild xcodebuild.log >/dev/null
end
if test $all = yes
oclint-json-compilation-database -e '/pcre2-10.21/' -- -enable-global-analysis 2>& 1
oclint-json-compilation-database -e '/pcre2-10.21/' -- -enable-global-analysis 2>&1
else
set i_files
for f in $c_files
set i_files $i_files -i $f
end
echo oclint-json-compilation-database -e '/pcre2-10.21/' $i_files
oclint-json-compilation-database -e '/pcre2-10.21/' $i_files 2>& 1
oclint-json-compilation-database -e '/pcre2-10.21/' $i_files 2>&1
end
else
# Presumably we're on Linux or other platform not requiring special
# handling for oclint to work.
oclint $c_files -- $argv 2>& 1
oclint $c_files -- $argv 2>&1
end
end
else

View file

@ -1,5 +1,4 @@
// The classes responsible for autoloading functions and completions.
#include "autoload.h"
#include <assert.h>
#include <errno.h>
#include <sys/stat.h>
@ -9,12 +8,17 @@
#include <string>
#include <utility>
#include <vector>
#include <pthread.h>
#include <stddef.h>
#include <set>
#include <time.h>
#include <stdbool.h>
#include "autoload.h"
#include "common.h"
#include "config.h" // IWYU pragma: keep
#include "env.h"
#include "exec.h"
#include "signal.h" // IWYU pragma: keep - needed for CHECK_BLOCK
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
// The time before we'll recheck an autoloaded file.
static const int kAutoloadStalenessInterval = 15;

View file

@ -6,6 +6,8 @@
#include <stddef.h>
#include <time.h>
#include <set>
#include <stdbool.h>
#include "common.h"
#include "lru.h"

View file

@ -15,12 +15,10 @@
// Check the other builtin manuals for proper syntax.
//
// 4). Use 'git add doc_src/NAME.txt' to start tracking changes to the documentation file.
#include "config.h" // IWYU pragma: keep
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -31,12 +29,13 @@
#include <wctype.h>
#include <algorithm>
#include <map>
#include <stack>
#include <string>
#include <utility>
#include <limits.h>
#include <memory> // IWYU pragma: keep
#include <stdbool.h>
#include "fallback.h" // IWYU pragma: keep
#include "builtin.h"
#include "complete.h"
#include "env.h"
@ -49,7 +48,6 @@
#include "input.h"
#include "intern.h"
#include "parse_constants.h"
#include "parse_tree.h"
#include "parse_util.h"
#include "parser.h"
#include "parser_keywords.h"
@ -61,6 +59,8 @@
#include "wcstringutil.h"
#include "wgetopt.h"
#include "wutil.h"
#include "common.h"
#include "io.h"
// The default prompt for the read command.
#define DEFAULT_READ_PROMPT L"set_color green; echo -n read; set_color normal; echo -n \"> \""
@ -103,7 +103,7 @@ int builtin_count_args(const wchar_t *const *argv) {
/// This function works like wperror, but it prints its result into the streams.err string instead
/// to stderr. Used by the builtin commands.
static void builtin_wperror(const wchar_t *s, io_streams_t &streams) {
void builtin_wperror(const wchar_t *s, io_streams_t &streams) {
char *err = strerror(errno);
if (s != NULL) {
streams.err.append(s);
@ -228,15 +228,15 @@ void builtin_print_help(parser_t &parser, io_streams_t &streams, const wchar_t *
}
/// Perform error reporting for encounter with unknown option.
static void builtin_unknown_option(parser_t &parser, io_streams_t &streams, const wchar_t *cmd,
const wchar_t *opt) {
void builtin_unknown_option(parser_t &parser, io_streams_t &streams, const wchar_t *cmd,
const wchar_t *opt) {
streams.err.append_format(BUILTIN_ERR_UNKNOWN, cmd, opt);
builtin_print_help(parser, streams, cmd, streams.err);
}
/// Perform error reporting for encounter with missing argument.
static void builtin_missing_argument(parser_t &parser, io_streams_t &streams, const wchar_t *cmd,
const wchar_t *opt) {
void builtin_missing_argument(parser_t &parser, io_streams_t &streams, const wchar_t *cmd,
const wchar_t *opt) {
streams.err.append_format(BUILTIN_ERR_MISSING, cmd, opt);
builtin_print_help(parser, streams, cmd, streams.err);
}

View file

@ -2,14 +2,15 @@
#ifndef FISH_BUILTIN_H
#define FISH_BUILTIN_H
#include <stddef.h> // for size_t
#include <vector> // for vector
#include <stddef.h>
#include <vector>
#include "common.h"
#include "io.h"
class completion_t;
class parser_t;
class output_stream_t;
struct io_streams_t;
enum { COMMAND_NOT_BUILTIN, BUILTIN_REGULAR, BUILTIN_FUNCTION };
@ -97,4 +98,22 @@ wcstring builtin_help_get(parser_t &parser, const wchar_t *cmd);
int define_function(parser_t &parser, io_streams_t &streams, const wcstring_list_t &c_args,
const wcstring &contents, int definition_line_offset, wcstring *out_err);
// Print help for the specified builtin. If \c b is sb_err, also print the line information.
void builtin_print_help(parser_t &parser, io_streams_t &streams, const wchar_t *cmd,
output_stream_t &b);
// Counts the number of non null pointers in the specified array.
int builtin_count_args(const wchar_t *const *argv);
// Perform error reporting for encounter with unknown option.
void builtin_unknown_option(parser_t &parser, io_streams_t &streams, const wchar_t *cmd,
const wchar_t *opt);
// Perform error reporting for encounter with missing argument.
void builtin_missing_argument(parser_t &parser, io_streams_t &streams, const wchar_t *cmd,
const wchar_t *opt);
// This function works like wperror, but it prints its result into the streams.err string instead
// to stderr. Used by the builtin commands.
void builtin_wperror(const wchar_t *s, io_streams_t &streams);
#endif

View file

@ -1,33 +1,29 @@
/** \file builtin_commandline.c Functions defining the commandline builtin
Functions used for implementing the commandline builtin.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <sys/types.h>
#include <termios.h>
#include <signal.h>
#include <assert.h>
#include <pthread.h>
#include <errno.h>
#include <cstring>
#include <stdbool.h>
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "common.h"
#include "wgetopt.h"
#include "reader.h"
#include "proc.h"
#include "parser.h"
#include "tokenizer.h"
#include "input_common.h"
#include "input.h"
#include "parse_util.h"
#include "io.h"
#include "wutil.h" // IWYU pragma: keep
class parser_t;
/**
Which part of the comandbuffer are we operating on

View file

@ -1,28 +1,27 @@
/** \file builtin_complete.c Functions defining the complete builtin
Functions used for implementing the complete builtin.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <sys/types.h>
#include <termios.h>
#include <signal.h>
#include <string>
#include <vector>
#include <memory> // IWYU pragma: keep
#include <stdbool.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "fallback.h" // IWYU pragma: keep
#include "builtin.h"
#include "common.h"
#include "complete.h"
#include "wgetopt.h"
#include "parser.h"
#include "reader.h"
#include "env.h"
#include "io.h"
#include "parse_constants.h"
#include "proc.h"
#include "parse_util.h"
#include "wutil.h" // IWYU pragma: keep
/*
builtin_complete_* are a set of rather silly looping functions that

View file

@ -1,29 +1,23 @@
/** \file builtin_jobs.c
Functions for executing the jobs builtin.
*/
#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 <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <wctype.h>
#include "fallback.h"
#include "util.h"
#include <stdbool.h>
#ifdef HAVE__PROC_SELF_STAT
#include <sys/time.h>
#endif
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h"
#include "builtin.h"
#include "proc.h"
#include "parser.h"
#include "common.h"
#include "wgetopt.h"
#include "io.h"
class parser_t;
/**
Print modes for the jobs builtin

View file

@ -49,11 +49,24 @@
/* This file has been imported from source code of printf command in GNU Coreutils version 6.9 */
#include <errno.h>
#include <limits.h>
#include <locale.h>
#include <wchar.h>
#include <wctype.h>
#include <stdio.h>
#include <sys/types.h>
#include <inttypes.h>
#include <stdarg.h>
#include <string.h>
#include <stdbool.h>
#include "common.h"
#include "io.h"
#include "wutil.h" // IWYU pragma: keep
#include "proc.h"
#include "builtin.h"
class parser_t;
struct builtin_printf_state_t
{

View file

@ -3,28 +3,30 @@
Functions used for implementing the set builtin.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <sys/types.h>
#include <termios.h>
#include <signal.h>
#include <vector>
#include <algorithm>
#include "fallback.h"
#include "util.h"
#include <sys/stat.h>
#include <string>
#include <memory>
#include <errno.h>
#include <set>
#include <iterator>
#include <stdbool.h>
#include "wutil.h"
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep
#include "builtin.h"
#include "env.h"
#include "expand.h"
#include "common.h"
#include "wgetopt.h"
#include "proc.h"
#include "parser.h"
#include "io.h"
class parser_t;
/**
Error message for invalid path operations

View file

@ -5,10 +5,6 @@ Functions used for implementing the set_color builtin.
*/
#include "config.h"
#include "builtin.h"
#include "color.h"
#include "output.h"
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
@ -16,13 +12,29 @@ Functions used for implementing the set_color builtin.
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include <unistd.h>
#include <assert.h>
#include <string>
#include <vector>
#include <memory>
#include <stdlib.h>
#include <stdbool.h>
#include "builtin.h"
#include "color.h"
#include "output.h"
#include "wgetopt.h"
#include "proc.h"
#include "io.h"
#include "common.h"
#include "wutil.h" // IWYU pragma: keep
class parser_t;
/**
Error message for invalid path operations

View file

@ -1,25 +1,37 @@
/** \file builtin_string.cpp
Implementation of the string builtin.
*/
#include "config.h" // IWYU pragma: keep
#include "config.h"
#define PCRE2_CODE_UNIT_WIDTH WCHAR_T_BITS
#ifdef _WIN32
#define PCRE2_STATIC
#endif
#include "pcre2.h"
#include <iterator>
#include <algorithm>
#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <errno.h>
#include <wchar.h>
#include <wctype.h>
#include <string>
#include <vector>
#include <sys/types.h>
#include <stdbool.h>
#include "pcre2.h"
#include "builtin.h"
#include "common.h"
#include "parser.h"
#include "parse_util.h"
#include "wgetopt.h"
#include "wildcard.h"
#include "wutil.h"
#include <iterator>
#include <algorithm>
#include <unistd.h>
#include "fallback.h" // IWYU pragma: keep
#include "io.h"
#include "wutil.h" // IWYU pragma: keep
class parser_t;
#define MAX_REPLACE_SIZE size_t(1048576) // pcre2_substitute maximum output size in wchar_t
#define STRING_ERR_MISSING _(L"%ls: Expected argument\n")

View file

@ -4,17 +4,22 @@ Functions used for implementing the test builtin.
Implemented from scratch (yes, really) by way of IEEE 1003.1 as reference.
*/
#include "config.h"
#include "common.h"
#include "builtin.h"
#include "wutil.h"
#include "proc.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <memory>
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
#include <string>
#include <stdbool.h>
#include "common.h"
#include "builtin.h"
#include "wutil.h" // IWYU pragma: keep
#include "proc.h"
#include "io.h"
enum
{

View file

@ -3,24 +3,19 @@
Functions used for implementing the ulimit builtin.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include <errno.h>
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "builtin.h"
#include "common.h"
#include "wgetopt.h"
#include "io.h"
#include "wutil.h" // IWYU pragma: keep
class parser_t;
/**
Struct describing a resource limit

View file

@ -1,11 +1,11 @@
// Color class implementation.
#include "color.h"
#include "fallback.h" // IWYU pragma: keep
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <wchar.h>
#include <cstddef>
#include "color.h"
#include "fallback.h" // IWYU pragma: keep
#include "common.h"
bool rgb_color_t::try_parse_special(const wcstring &special)
{

View file

@ -4,6 +4,8 @@
#include <string.h>
#include <string>
#include <stdbool.h>
#include "common.h"
/* 24 bit color */

View file

@ -3,16 +3,12 @@
Various functions, mostly string utilities, that are used by most
parts of fish.
*/
#include "config.h"
#include <unistd.h>
#ifdef HAVE_SIGINFO_H
#include <siginfo.h>
#endif
#include <stdlib.h>
#include <termios.h>
#include <wchar.h>
@ -22,28 +18,26 @@ parts of fish.
#include <assert.h>
#include <math.h>
#include <signal.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <sys/stat.h>
#include <wctype.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#include <locale.h>
#include <sys/time.h>
#include <algorithm>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include <stdint.h>
#include <stdbool.h>
#include "fallback.h"
#include "wutil.h"
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep
#include "common.h"
#include "expand.h"
#include "wildcard.h"

View file

@ -1,29 +1,26 @@
/** \file common.h
Prototypes for various functions, mostly string utilities, that are used by most parts of fish.
*/
#ifndef FISH_COMMON_H
/**
Header guard
*/
#define FISH_COMMON_H
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <termios.h>
#include <string>
#include <sstream>
#include <vector>
#include <pthread.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <sys/types.h>
#include <errno.h>
#include "config.h"
#include "fallback.h"
#include <termios.h>
#include <memory>
#include <stdbool.h>
#include "fallback.h" // IWYU pragma: keep
#include "signal.h" // IWYU pragma: keep
/**
Avoid writing the type name twice in a common "static_cast-initialization".

View file

@ -2,10 +2,7 @@
These functions are used for storing and retrieving tab-completion data, as well as for performing tab-completion.
*/
#include "config.h"
#include <assert.h>
#include <stdlib.h>
#include <stddef.h>
#include <wchar.h>
#include <wctype.h>
@ -17,10 +14,11 @@
#include <set>
#include <string>
#include <utility>
#include <memory>
#include <stdbool.h>
#include "fallback.h" // IWYU pragma: keep
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wildcard.h"
#include "proc.h"
#include "parser.h"
@ -32,7 +30,7 @@
#include "expand.h"
#include "common.h"
#include "parse_util.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "path.h"
#include "parse_tree.h"
#include "iothread.h"

View file

@ -6,16 +6,14 @@
*/
#ifndef FISH_COMPLETE_H
/**
Header guard
*/
#define FISH_COMPLETE_H
#include <vector>
#include <stdint.h>
#include <stdbool.h>
#include "common.h"
/**
* Use all completions
*/

View file

@ -1,8 +1,6 @@
/** \file env.c
Functions for setting and getting environment variables.
*/
#include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <wchar.h>
#include <locale.h>
@ -19,10 +17,11 @@
#include <wctype.h>
#include <utility>
#include <vector>
#include <sys/types.h>
#include <stdbool.h>
#include "fallback.h"
#include "wutil.h"
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep
#include "proc.h"
#include "common.h"
#include "env.h"
@ -34,8 +33,8 @@
#include "input.h"
#include "event.h"
#include "path.h"
#include "fish_version.h"
#include "input_common.h"
/** Value denoting a null string */
#define ENV_NULL L"\x1d"

View file

@ -1,14 +1,15 @@
/** \file env.h
Prototypes for functions for setting and getting environment variables.
*/
#ifndef FISH_ENV_H
#define FISH_ENV_H
#include <wchar.h>
#include <stdint.h>
#include <string>
#include <map>
#include <stddef.h>
#include <memory>
#include <stdbool.h>
#include "common.h"

View file

@ -3,46 +3,46 @@
The utility library for universal variables. Used both by the
client library and by the daemon.
*/
#include "config.h"
#include "env_universal_common.h"
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <arpa/inet.h> // IWYU pragma: keep - needed for htonl
#include <arpa/inet.h> // IWYU pragma: keep
#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>
#include <string>
#include <stdbool.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <map>
#include <utility>
#include <netinet/in.h>
// We need the ioctl.h header so we can check if SIOCGIFHWADDR is defined by it so we know if we're
// on a Linux system.
#include <sys/ioctl.h> // IWYU pragma: keep
// We need the sys/file.h for the flock() declaration on Linux but not OS X.
#include <sys/file.h> // IWYU pragma: keep
#include "env_universal_common.h"
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "utf8.h"
#include "env.h"
#if __APPLE__
#define FISH_NOTIFYD_AVAILABLE 1

View file

@ -1,11 +1,13 @@
#ifndef FISH_ENV_UNIVERSAL_COMMON_H
#define FISH_ENV_UNIVERSAL_COMMON_H
#include <string>
#include <set>
#include <pthread.h>
#include <stdio.h>
#include <stdbool.h>
#include <set>
#include <memory>
#include <vector>
#include "common.h"
#include "wutil.h"
#include "env.h"

View file

@ -1,18 +1,17 @@
/** \file event.c
Functions for handling event triggers
*/
#include "config.h" // IWYU pragma: keep
#include <signal.h>
#include <algorithm>
#include <assert.h>
#include <stddef.h>
#include <unistd.h>
#include <memory>
#include <algorithm>
#include <string>
#include <stdbool.h>
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep - needed for gettext
#include "wutil.h" // IWYU pragma: keep
#include "input_common.h"
#include "proc.h"
#include "parser.h"
@ -21,7 +20,6 @@
#include "signal.h"
#include "io.h"
/**
Number of signals that can be queued before an overflow occurs
*/

View file

@ -12,8 +12,9 @@
#ifndef FISH_EVENT_H
#define FISH_EVENT_H
#include <ctime>
#include <unistd.h>
#include <vector>
#include <stdbool.h>
#include "common.h"

View file

@ -4,8 +4,7 @@
Some of the code in this file is based on code from the Glibc
manual, though the changes performed have been massive.
*/
#include "config.h" // IWYU pragma: keep
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
@ -24,17 +23,16 @@
#include <wctype.h>
#include <map>
#include <string>
#include <memory> // IWYU pragma: keep - suggests <tr1/memory> instead
#include <utility>
#include <memory>
#ifdef HAVE_SIGINFO_H
#include <siginfo.h>
#endif
#include <stdbool.h>
#include "fallback.h" // IWYU pragma: keep
#include "fallback.h" // IWYU pragma: keep
#include "postfork.h"
#include "common.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "proc.h"
#include "exec.h"
#include "parser.h"
@ -42,7 +40,6 @@
#include "function.h"
#include "env.h"
#include "signal.h"
#include "parse_util.h"
#include "io.h"
#include "parse_tree.h"
#include "reader.h"

View file

@ -3,13 +3,11 @@
*/
#ifndef FISH_EXEC_H
/**
Header guard
*/
#define FISH_EXEC_H
#include <stddef.h>
#include <vector>
#include <stdbool.h>
#include "common.h"

View file

@ -4,11 +4,10 @@ String expansion functions. These functions perform several kinds of
parameter expansion.
*/
#include "config.h" // IWYU pragma: keep
// IWYU pragma: no_include <cstddef>
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <stddef.h>
#include <wchar.h>
@ -16,38 +15,43 @@ parameter expansion.
#include <wctype.h>
#include <errno.h>
#include <pwd.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#include <algorithm>
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h> // IWYU pragma: keep - needed for KERN_PROCARGS2
#include <sys/sysctl.h> // IWYU pragma: keep
#endif
#include <assert.h>
#include <vector>
#ifdef SunOS
#include <procfs.h>
#endif
#include <memory> // IWYU pragma: keep
#include <stdio.h>
#if __APPLE__
#include <sys/proc.h>
#else
#include <sys/stat.h>
#include <dirent.h>
#endif
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "env.h"
#include "proc.h"
#include "parser.h"
#include "path.h"
#include "expand.h"
#include "wildcard.h"
#include "exec.h"
#include "tokenizer.h"
#include "complete.h"
#include "iothread.h"
#include "parse_util.h"
#include "parse_constants.h"
#ifdef KERN_PROCARGS2
#else
#include "tokenizer.h"
#endif
/**
Description for child process

View file

@ -6,20 +6,16 @@
benefit from using a more clever memory allocation scheme, perhaps
an evil combination of talloc, string buffers and reference
counting.
*/
#ifndef FISH_EXPAND_H
/**
Header guard
*/
#define FISH_EXPAND_H
#include "config.h" // for __warn_unused
#include "config.h"
#include <wchar.h>
#include <string> // for string
#include <vector> // for vector
#include <string>
#include <vector>
#include <stddef.h>
#include <stdbool.h>
#include "common.h"
#include "parse_constants.h"

View file

@ -7,46 +7,44 @@
incomplete. lrand28_r internally uses the regular (bad) rand_r
function, the gettext function doesn't actually do anything, etc.
*/
#include "config.h"
// IWYU likes to recommend adding term.h when we want ncurses.h.
// IWYU pragma: no_include term.h
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h> // IWYU pragma: keep
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h> // IWYU pragma: keep
#include <sys/stat.h> // IWYU pragma: keep
#include <errno.h> // IWYU pragma: keep
#include <fcntl.h> // IWYU pragma: keep
#include <wchar.h>
#include <wctype.h>
#include <string.h>
#include <dirent.h>
#include <stdarg.h>
#include <limits.h>
#include <assert.h>
#include <dirent.h> // IWYU pragma: keep
#include <stdarg.h> // IWYU pragma: keep
#include <limits.h> // IWYU pragma: keep
#include <assert.h> // IWYU pragma: keep
#if HAVE_GETTEXT
#include <libintl.h>
#endif
#if HAVE_NCURSES_H
#include <ncurses.h>
#include <ncurses.h> // IWYU pragma: keep
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h>
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#include <term.h> // IWYU pragma: keep
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include <signal.h> // IWYU pragma: keep
#include <wchar.h> // IWYU pragma: keep
#include "fallback.h"
#include "util.h"
#include "fallback.h" // IWYU pragma: keep
#include "util.h" // IWYU pragma: keep
#ifndef HAVE___ENVIRON
@ -1339,8 +1337,6 @@ int fish_wcswidth(const wchar_t *str, size_t n)
* Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
*/
#include <wchar.h>
struct interval
{
int first;

View file

@ -1,16 +1,23 @@
#ifndef FISH_FALLBACK_H
#define FISH_FALLBACK_H
#include <stdio.h>
#include "config.h"
// IWYU likes to recommend adding <term.h> when we want <ncurses.h>. If we add <term.h> it breaks
// compiling several modules that include this header because they use symbols which are defined as
// macros in <term.h>.
// IWYU pragma: no_include <term.h>
#include <stdint.h>
#include <stdarg.h>
#include <wctype.h>
#include <wchar.h>
#include <limits.h>
#include <sys/time.h>
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
// The following include must be kept despite what IWYU says. That's because of the interaction
// between the weak linking of `wcsdup` and `wcscasecmp` via `#define`s below and the declarations
// in <wchar.h>. At least on OS X if we don't do this we get compilation errors do to the macro
// substitution if wchar.h is included after this header.
#include <wchar.h> // IWYU pragma: keep
#if HAVE_NCURSES_H
#include <ncurses.h> // IWYU pragma: keep
#endif
/** fish's internal versions of wcwidth and wcswidth, which can use an internal implementation if the system one is busted. */
int fish_wcwidth(wchar_t wc);

View file

@ -15,17 +15,14 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** \file fish.c
The main loop of <tt>fish</tt>.
*/
#include "config.h"
#include <assert.h>
#include <getopt.h>
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/stat.h>
#include <string>
@ -37,22 +34,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/socket.h> // IWYU pragma: keep - suggests internal header
#include <sys/socket.h> // IWYU pragma: keep
#include <sys/un.h>
#include <pwd.h>
#include <locale.h>
#include <memory>
#include <stdbool.h>
#include "fallback.h" // IWYU pragma: keep
#include "common.h"
#include "reader.h"
#include "builtin.h"
#include "function.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "env.h"
#include "proc.h"
#include "parser.h"
#include "expand.h"
#include "intern.h"
#include "event.h"
#include "history.h"
#include "path.h"

View file

@ -1,3 +1,4 @@
// The fish_indent program.
/*
Copyright (C) 2014 ridiculous_fish
@ -14,10 +15,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
// The fish_indent proegram.
#include "config.h"
#include <getopt.h>
#include <stdlib.h>
#include <stdio.h>
@ -27,11 +24,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <locale.h>
#include <stddef.h>
#include <string>
#include <memory>
#include <wctype.h>
#include <stdbool.h>
#include "color.h"
#include "highlight.h"
#include "parse_constants.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "common.h"
#include "output.h"
#include "env.h"

View file

@ -1,21 +1,14 @@
/** \file fish_tests.c
Various bug and feature tests. Compiled and run by make test.
*/
#include "config.h"
// IWYU pragma: no_include <cstring>
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <unistd.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <stdarg.h>
#include <libgen.h>
#include <iostream>
@ -25,31 +18,36 @@
#include <iterator>
#include <signal.h>
#include <locale.h>
#include <dirent.h>
#include <time.h>
#include <assert.h>
#include <limits.h>
#include <pthread.h>
#include <stddef.h>
#include <memory>
#include <set>
#include <vector>
#include <wctype.h>
#include <stdbool.h>
#include <sys/select.h>
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "common.h"
#include "proc.h"
#include "reader.h"
#include "builtin.h"
#include "function.h"
#include "autoload.h"
#include "complete.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "env.h"
#include "expand.h"
#include "parser.h"
#include "tokenizer.h"
#include "output.h"
#include "exec.h"
#include "event.h"
#include "path.h"
#include "history.h"
#include "highlight.h"
#include "iothread.h"
#include "postfork.h"
#include "signal.h"
#include "parse_tree.h"
#include "parse_util.h"
@ -59,6 +57,12 @@
#include "utf8.h"
#include "env_universal_common.h"
#include "wcstringutil.h"
#include "color.h"
#include "io.h"
#include "lru.h"
#include "parse_constants.h"
#include "screen.h"
#include "input_common.h"
static const char * const * s_arguments;
static int s_test_run_count = 0;

View file

@ -6,9 +6,7 @@
is taken care of by the parser and to some degree the builtin
handling library.
*/
#include "config.h" // IWYU pragma: keep
// IWYU pragma: no_include <type_traits>
#include <wchar.h>
#include <pthread.h>
#include <map>
@ -17,10 +15,10 @@
#include <stddef.h>
#include <string>
#include <utility>
#include <memory>
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "fallback.h" // IWYU pragma: keep
#include "autoload.h"
#include "function.h"
#include "common.h"

View file

@ -6,12 +6,12 @@
is taken care of by the parser and to some degree the builtin
handling library.
*/
#ifndef FISH_FUNCTION_H
#define FISH_FUNCTION_H
#include <vector>
#include <map>
#include <stdbool.h>
#include "common.h"
#include "event.h"

View file

@ -1,9 +1,7 @@
/** \file highlight.c
Functions for syntax highlighting
*/
#include "config.h" // IWYU pragma: keep
// IWYU pragma: no_include <cstddef>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
@ -13,10 +11,13 @@
#include <map>
#include <set>
#include <string>
#include <memory>
#include <utility>
#include <limits.h>
#include <wctype.h>
#include "fallback.h"
#include "wutil.h"
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep
#include "highlight.h"
#include "tokenizer.h"
#include "parse_util.h"
@ -26,12 +27,12 @@
#include "env.h"
#include "expand.h"
#include "common.h"
#include "complete.h"
#include "output.h"
#include "wildcard.h"
#include "path.h"
#include "history.h"
#include "parse_tree.h"
#include "color.h"
#define CURSOR_POSITION_INVALID ((size_t)(-1))

View file

@ -5,12 +5,12 @@
#ifndef FISH_HIGHLIGHT_H
#define FISH_HIGHLIGHT_H
#include <assert.h> // for assert
#include <stddef.h> // for size_t
#include <stdint.h> // for uint32_t
#include <vector> // for vector
#include <assert.h>
#include <stdint.h>
#include <vector>
#include <stdbool.h>
#include "common.h" // for wcstring, wcstring_list_t
#include "common.h"
#include "env.h"
#include "color.h"

View file

@ -1,5 +1,4 @@
// History functions, part of the user interface.
#include "history.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@ -16,10 +15,12 @@
#include <algorithm>
#include <iterator>
#include <map>
#include <pthread.h>
#include "common.h"
#include "config.h"
#include "env.h"
#include "fallback.h" // IWYU pragma: keep
#include "history.h"
#include "iothread.h"
#include "lru.h"
#include "parse_constants.h"
@ -28,7 +29,7 @@
#include "reader.h"
#include "sanity.h"
#include "signal.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
// Our history format is intended to be valid YAML. Here it is:
//

View file

@ -2,8 +2,8 @@
#ifndef FISH_HISTORY_H
#define FISH_HISTORY_H
// IWYU pragma: no_include <cstddef>
#include <pthread.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
@ -12,8 +12,11 @@
#include <string>
#include <utility>
#include <vector>
#include <memory>
#include <stdbool.h>
#include "common.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
// Fish supports multiple shells writing to history at once. Here is its strategy:
//

View file

@ -1,16 +1,13 @@
/** \file input.c
Functions for reading a character of input from stdin.
*/
#include "config.h"
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <wchar.h>
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
@ -18,17 +15,19 @@
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include <wctype.h>
#include <vector>
#include <algorithm>
#include <memory>
#include <string>
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "wutil.h" // IWYU pragma: keep
#include "reader.h"
#include "proc.h"
#include "common.h"
@ -37,11 +36,9 @@
#include "parser.h"
#include "env.h"
#include "event.h"
#include "signal.h" // IWYU pragma: keep - needed for CHECK_BLOCK
#include "signal.h" // IWYU pragma: keep
#include "io.h"
#include "output.h"
#include <vector>
#include <algorithm>
#define DEFAULT_TERM L"ansi"
#define MAX_INPUT_FUNCTION_ARGS 20

View file

@ -2,19 +2,16 @@
Functions for reading a character of input from stdin, using the
inputrc information for key bindings.
*/
#ifndef FISH_INPUT_H
#define FISH_INPUT_H
#include <stddef.h>
#include <string>
#include <vector>
#include <stdbool.h>
#include "common.h"
#include "env.h"
#include "input_common.h"
#define DEFAULT_BIND_MODE L"default"
#define FISH_BIND_MODE_VAR L"fish_bind_mode"

View file

@ -1,27 +1,30 @@
/** \file input_common.c
Implementation file for the low level input library
*/
#include "config.h"
#include <string.h>
#include <errno.h>
#include <sys/time.h>
#include <unistd.h>
#include <list>
#include <queue>
#include <cwchar> // for wint_t
#include <deque> // for deque
#include <utility> // for swap, pair
#include <deque>
#include <utility>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <stdbool.h>
#include <memory>
#include <cwctype>
#include <wchar.h>
#include <wctype.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "common.h"
#include "input_common.h"
#include "env_universal_common.h"

View file

@ -1,7 +1,6 @@
/** \file input_common.h
Header file for the low level input library
*/
#ifndef INPUT_COMMON_H
#define INPUT_COMMON_H

View file

@ -1,14 +1,14 @@
/** \file intern.c
Library for pooling common strings
*/
#include "config.h" // IWYU pragma: keep
#include <wchar.h>
#include <pthread.h>
#include <vector>
#include <algorithm>
#include <memory>
#include <stddef.h>
#include <stdbool.h>
#include "fallback.h" // IWYU pragma: keep
#include "common.h"

View file

@ -1,23 +1,19 @@
/** \file io.c
Utilities for io redirection.
*/
#include "config.h" // IWYU pragma: keep
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <stddef.h>
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "exec.h"
#include "common.h"
#include "io.h"
io_data_t::~io_data_t()
{
}

View file

@ -4,10 +4,10 @@
#include <vector>
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
// 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
#if defined(_LIBCPP_VERSION) || __cplusplus > 199711L
// C++11 or libc++ (which is a C++11-only library, but the memory header works OK in C++03)
#include <memory>
@ -17,6 +17,7 @@ using std::shared_ptr;
#include <tr1/memory>
using std::tr1::shared_ptr;
#endif
#include <stdbool.h>
#include "common.h"

View file

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

View file

@ -1,7 +1,6 @@
/** \file iothread.h
Handles IO that may hang.
*/
#ifndef FISH_IOTHREAD_H
#define FISH_IOTHREAD_H

View file

@ -5,19 +5,15 @@
Type ^C to exit the program.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <locale.h>
#include <termcap.h>
#include "common.h"
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "input_common.h"
int writestr(char *str)

View file

@ -5,13 +5,12 @@
and paste with a memory of previous cuts. It supports integration
with the X clipboard.
*/
#include "config.h" // IWYU pragma: keep
#include <stddef.h>
#include <algorithm>
#include <list>
#include <string>
#include <memory>
#include <stdbool.h>
#include "fallback.h" // IWYU pragma: keep
#include "kill.h"

View file

@ -3,7 +3,6 @@
Works like the killring in emacs and readline. The killring is cut and paste whith a memory of previous cuts.
*/
#ifndef FISH_KILL_H
#define FISH_KILL_H

View file

@ -2,7 +2,6 @@
Least-recently-used cache implementation
*/
#ifndef FISH_LRU_H
#define FISH_LRU_H
@ -11,6 +10,7 @@
#include <map>
#include <set>
#include <list>
#include "common.h"
/** A predicate to compare dereferenced pointers */

View file

@ -1,13 +1,11 @@
/** \file output.c
Generic output functions
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
@ -15,25 +13,25 @@
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include <wchar.h>
#include <limits.h>
#include <string>
#include <vector>
#include <memory>
#include "fallback.h"
#include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep
#include "common.h"
#include "output.h"
#include "color.h"
static int writeb_internal(char c);
/**
The function used for output
*/

View file

@ -4,14 +4,15 @@
/**
Constants for various character classifications. Each character of a command string can be classified as one of the following types.
*/
#ifndef FISH_OUTPUT_H
#define FISH_OUTPUT_H
#include <stddef.h>
#include <vector>
#include <stddef.h>
#include <stdbool.h>
#include "common.h"
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "color.h"
/**

View file

@ -1,14 +1,19 @@
#include "config.h" // IWYU pragma: keep
// IWYU pragma: no_include <cstddef>
#include <assert.h>
#include <wchar.h>
#include <wctype.h>
#include <vector>
#include <map>
#include <stddef.h>
#include "util.h"
#include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "wutil.h" // IWYU pragma: keep
#include "pager.h"
#include "highlight.h"
#include "common.h"
#include "screen.h"
#include "complete.h"
#include "reader.h"
typedef pager_t::comp_t comp_t;
typedef std::vector<completion_t> completion_list_t;

View file

@ -1,13 +1,15 @@
/** \file pager.h
Pager support
*/
#ifndef FISH_PAGER_H
#define FISH_PAGER_H
#include <stddef.h>
#include <string>
#include <vector>
#include <memory>
#include <stdbool.h>
#include "common.h"
#include "complete.h"
#include "screen.h"

View file

@ -2,9 +2,8 @@
Constants used in the programmatic representation of fish code.
*/
#ifndef fish_parse_constants_h
#define fish_parse_constants_h
#ifndef FISH_PARSE_CONSTANTS_H
#define FISH_PARSE_CONSTANTS_H
#include "config.h"

View file

@ -6,8 +6,6 @@
Non-fatal errors are printed as soon as they are encountered; otherwise you would have to wait for the execution to finish to see them.
*/
#include "parse_execution.h"
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
@ -18,8 +16,11 @@
#include <wchar.h>
#include <wctype.h>
#include <string>
#include <memory> // IWYU pragma: keep - suggests <tr1/memory> instead
#include <memory>
#include <vector>
#include <stdbool.h>
#include "parse_execution.h"
#include "env.h"
#include "event.h"
#include "tokenizer.h"
@ -35,6 +36,11 @@
#include "function.h"
#include "builtin.h"
#include "exec.h"
#include "common.h"
#include "io.h"
#include "parse_constants.h"
#include "parse_tree.h"
#include "proc.h"
/* These are the specific statement types that support redirections */
static bool specific_statement_type_is_redirectable_block(const parse_node_t &node)

View file

@ -2,16 +2,17 @@
Provides the "linkage" between a parse_node_tree_t and actual execution structures (job_t, etc.).
*/
#ifndef FISH_PARSE_EXECUTION_H
#define FISH_PARSE_EXECUTION_H
#include <stddef.h>
#include "common.h"
#include "io.h"
#include "parse_constants.h"
#include "parse_tree.h"
#include "proc.h"
#include <stdbool.h>
class parser_t;
struct block_t;

View file

@ -1,7 +1,9 @@
#include "parse_productions.h"
#include <assert.h>
#include <stdio.h>
#include "parse_tree.h"
#include "parse_productions.h"
#include "parse_constants.h"
#include "common.h"
using namespace parse_productions;

View file

@ -2,13 +2,13 @@
Programmatic representation of fish code.
*/
#ifndef FISH_PARSE_TREE_CONSTRUCTION_H
#define FISH_PARSE_TREE_CONSTRUCTION_H
#include <stdint.h> // for uint8_t, uint32_t
#include "common.h" // for wcstring
#include "parse_constants.h" // for parse_token_type_t, etc
#include <sys/types.h>
#include <stdbool.h>
#include "parse_constants.h"
struct parse_token_t;

View file

@ -1,20 +1,21 @@
#include <assert.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <wchar.h>
#include <string>
#include <vector>
#include <algorithm>
#include <cwchar>
#include "common.h"
#include "parse_constants.h"
#include "parse_productions.h"
#include "parse_tree.h"
#include "tokenizer.h"
#include "fallback.h"
#include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep
#include "proc.h"
#include <vector>
#include <algorithm>
// This array provides strings for each symbol in enum parse_token_type_t in parse_constants.h.
const wchar_t * const token_type_map[] = {

View file

@ -2,18 +2,19 @@
Programmatic representation of fish code.
*/
#ifndef FISH_PARSE_PRODUCTIONS_H
#define FISH_PARSE_PRODUCTIONS_H
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include <memory>
#include <sys/types.h>
#include <stdbool.h>
#include "common.h"
#include "tokenizer.h"
#include "parse_constants.h"
#include <vector>
class parse_node_tree_t;

View file

@ -7,26 +7,26 @@
used in many places in fish and that are somehow related to
parsing the code.
*/
#include "config.h" // IWYU pragma: keep
#include <stdlib.h>
#include <stdarg.h>
#include <wchar.h>
#include <string>
#include <assert.h>
#include <stdio.h>
#include <memory>
#include <stdbool.h>
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wutil.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep
#include "common.h"
#include "tokenizer.h"
#include "parse_util.h"
#include "expand.h"
#include "env.h"
#include "wildcard.h"
#include "parse_tree.h"
#include "builtin.h"
#include "parse_constants.h"
/** Error message for improper use of the exec builtin */
#define EXEC_ERR_MSG _(L"The '%ls' command can not be used in a pipeline")

View file

@ -3,14 +3,16 @@
Various mostly unrelated utility functions related to parsing,
loading and evaluating fish code.
*/
#ifndef FISH_PARSE_UTIL_H
#define FISH_PARSE_UTIL_H
#include <stddef.h>
#include <vector>
#include <stdbool.h>
#include "common.h"
#include "parse_constants.h"
#include "tokenizer.h"
/**
Find the beginning and end of the first subshell in the specified string.

View file

@ -1,20 +1,17 @@
/** \file parser.c
The fish parser. Contains functions for parsing and evaluating code.
*/
#include "config.h" // IWYU pragma: keep
#include <stdio.h>
#include <wchar.h>
#include <assert.h>
#include <string>
#include <algorithm>
#include <memory>
#include <stdbool.h>
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "common.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "proc.h"
#include "parser.h"
#include "function.h"
@ -24,10 +21,12 @@ The fish parser. Contains functions for parsing and evaluating code.
#include "sanity.h"
#include "event.h"
#include "intern.h"
#include "signal.h" // IWYU pragma: keep - needed for CHECK_BLOCK
#include "parse_util.h"
#include "parse_tree.h"
#include "parse_execution.h"
#include "parse_constants.h"
class io_chain_t;
/**
Error for evaluating in illegal scope

View file

@ -1,22 +1,22 @@
/** \file parser.h
The fish parser.
*/
#ifndef FISH_PARSER_H
#define FISH_PARSER_H
#include <stddef.h> // for size_t
#include <list> // for _List_const_iterator, list, etc
#include <stddef.h>
#include <list>
#include <vector>
#include <stdbool.h>
#include "common.h"
#include "proc.h"
#include "event.h"
#include "parse_tree.h"
#include "io.h"
#include "parse_constants.h"
#include "expand.h"
#include <vector>
class io_chain_t;
/**
event_blockage_t represents a block on events of the specified type

View file

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

View file

@ -2,10 +2,11 @@
Functions having to do with parser keywords, like testing if a function is a block command.
*/
#ifndef FISH_PARSER_KEYWORD_H
#define FISH_PARSER_KEYWORD_H
#include <stdbool.h>
#include "common.h"
/**

View file

@ -1,5 +1,3 @@
#include "config.h" // IWYU pragma: keep
#include <wchar.h>
#include <sys/stat.h>
#include <unistd.h>
@ -11,7 +9,7 @@
#include "fallback.h" // IWYU pragma: keep
#include "common.h"
#include "env.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "path.h"
#include "expand.h"

View file

@ -5,11 +5,12 @@
name can be found in the PATH, and various other path-related
issues.
*/
#ifndef FISH_PATH_H
#define FISH_PATH_H
#include <stddef.h>
#include <stdbool.h>
#include "common.h"
#include "env.h"

View file

@ -9,14 +9,19 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <memory> // IWYU pragma: keep - suggests <tr1/memory> instead
#include <memory>
#if FISH_USE_POSIX_SPAWN
#include <spawn.h>
#endif
#include "common.h"
#include "proc.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "signal.h"
#include "postfork.h"
#include "iothread.h"
#include "exec.h"
#include "io.h"
#ifndef JOIN_THREADS_BEFORE_FORK
#define JOIN_THREADS_BEFORE_FORK 0

View file

@ -2,24 +2,23 @@
Functions that we may safely call after fork(), of which there are very few. In particular we cannot allocate memory, since we're insane enough to call fork from a multithreaded process.
*/
#ifndef FISH_POSTFORK_H
#define FISH_POSTFORK_H
#include <stddef.h>
#include <unistd.h>
#include "config.h"
#include "io.h"
#include <unistd.h>
#if HAVE_SPAWN_H
#include <spawn.h>
#endif
#ifndef FISH_USE_POSIX_SPAWN
#define FISH_USE_POSIX_SPAWN HAVE_SPAWN_H
#endif
#include <stdbool.h>
class io_chain_t;
class job_t;
class process_t;
/**
This function should be called by both the parent process and the
@ -33,8 +32,6 @@
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);
/**

View file

@ -1,12 +1,9 @@
/** \file print_help.c
Print help message for the specified command
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <sys/types.h>
#include "print_help.h"

View file

@ -7,45 +7,40 @@ will call proc to create representations of the running jobs as
needed.
Some of the code in this file is based on code from the Glibc manual.
*/
// IWYU pragma: no_include <__bit_reference>
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/wait.h>
#include <wchar.h>
#include <string.h>
#include <errno.h>
#include <termios.h>
#include <pthread.h>
#include <wctype.h>
#include <algorithm>
#include <memory> // IWYU pragma: keep - suggests <tr1/memory> instead
#include <memory>
#include <vector>
#include <unistd.h>
#include <signal.h>
#include <sys/time.h>
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#ifdef HAVE_SIGINFO_H
#include <siginfo.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <sys/types.h>
#include <stdbool.h>
#include <sys/time.h> // IWYU pragma: keep
#include <algorithm> // IWYU pragma: keep
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "proc.h"
#include "common.h"
#include "reader.h"
@ -53,8 +48,9 @@ Some of the code in this file is based on code from the Glibc manual.
#include "parser.h"
#include "signal.h"
#include "event.h"
#include "output.h"
#include "io.h"
#include "parse_tree.h"
/**
Size of buffer for reading buffered output

View file

@ -7,18 +7,19 @@
needed.
*/
#ifndef FISH_PROC_H
#define FISH_PROC_H
#include "config.h" // IWYU pragma: keep
#include <signal.h>
#include <sys/time.h>
#include <list>
#include <assert.h> // for assert
#include <stddef.h> // for size_t
#include <termios.h> // for pid_t, termios
#include <assert.h>
#include <stddef.h>
#include <termios.h>
#include <unistd.h>
#include <stdbool.h>
#include <sys/time.h> // IWYU pragma: keep
#include "config.h" // for HAVE__PROC_SELF_STAT
#include "io.h"
#include "common.h"
#include "parse_tree.h"

View file

@ -18,13 +18,12 @@ the end of the list is reached, at which point regular searching will
commence.
*/
#include "config.h"
#include <algorithm>
// IWYU pragma: no_include <type_traits>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <termios.h>
@ -34,25 +33,22 @@ commence.
#include <wctype.h>
#include <stack>
#include <pthread.h>
#ifdef HAVE_SIGINFO_H
#include <siginfo.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <signal.h>
#include <fcntl.h>
#include <wchar.h>
#include <assert.h>
#include <sys/types.h>
#include <memory>
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "highlight.h"
#include "reader.h"
#include "proc.h"
@ -79,6 +75,8 @@ commence.
#include "pager.h"
#include "color.h"
#include "event.h"
#include "io.h"
#include "parse_constants.h"
/**
Maximum length of prefix string when printing completion

View file

@ -12,14 +12,16 @@
#include <vector>
#include <string>
#include <stddef.h>
#include <stdbool.h>
#include "io.h"
#include "common.h"
#include "complete.h"
#include "highlight.h"
#include "parse_constants.h"
class history_t;
class env_vars_snapshot_t;
class io_chain_t;
/* Helper class for storing a command line */
class editable_line_t
@ -229,7 +231,6 @@ void reader_set_complete_function(complete_function_t);
/**
The type of a highlight function.
*/
class env_vars_snapshot_t;
typedef void (*highlight_function_t)(const wcstring &, std::vector<highlight_spec_t> &, size_t, wcstring_list_t *, const env_vars_snapshot_t &vars);
/**

View file

@ -1,8 +1,6 @@
/** \file sanity.c
Functions for performing sanity checks on the program state
*/
#include "config.h" // IWYU pragma: keep
#include <unistd.h>
#include "fallback.h" // IWYU pragma: keep
@ -13,7 +11,6 @@
#include "reader.h"
#include "kill.h"
/**
Status from earlier sanity checks
*/

View file

@ -5,15 +5,13 @@ output to screen efficiently by keeping an internal representation
of the current screen contents and trying to find the most
efficient way for transforming that to the desired screen content.
*/
// IWYU pragma: no_include <cstddef>
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
@ -21,23 +19,19 @@ efficient way for transforming that to the desired screen content.
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include <wchar.h>
#include <time.h>
#include <assert.h>
#include <algorithm>
#include <string>
#include <vector>
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "common.h"
#include "util.h"
#include "output.h"

View file

@ -18,6 +18,8 @@
#include <sys/stat.h>
#include "common.h"
#include "highlight.h"
#include <stdbool.h>
#include <memory>
class page_rendering_t;

View file

@ -1,29 +1,24 @@
/** \file signal.c
The library for various signal related issues
*/
#include "config.h" // IWYU pragma: keep
#include <wchar.h>
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#ifdef HAVE_SIGINFO_H
#include <siginfo.h>
#endif
#include <pthread.h>
#include <stdbool.h>
#include "common.h"
#include "fallback.h" // IWYU pragma: keep
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "signal.h"
#include "event.h"
#include "reader.h"
#include "proc.h"
/**
Struct describing an entry for the lookup table used to convert
between signal names and signal ids, etc.

View file

@ -1,12 +1,12 @@
/** \file signal.h
The library for various signal related issues
*/
#ifndef FISH_SIGNALH
#define FISH_SIGNALH
#include <signal.h>
#include <stdbool.h>
/**
Get the integer signal value representing the specified signal, or

View file

@ -5,19 +5,17 @@ future, the tokenizer should be extended to support marks,
tokenizing multiple strings and disposing of unused string
segments.
*/
#include "config.h" // IWYU pragma: keep
#include <wchar.h>
#include <wctype.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#include <string>
#include <limits.h>
#include "fallback.h" // IWYU pragma: keep
#include "common.h"
#include "wutil.h" // IWYU pragma: keep - needed for wgettext
#include "wutil.h" // IWYU pragma: keep
#include "tokenizer.h"
/* Wow what a hack */

View file

@ -5,11 +5,12 @@
tokenizing multiple strings and disposing of unused string
segments.
*/
#ifndef FISH_TOKENIZER_H
#define FISH_TOKENIZER_H
#include <stddef.h>
#include <stdbool.h>
#include "common.h"
/**

View file

@ -13,15 +13,12 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <stdint.h>
#include "utf8.h"
#include <stdint.h> // IWYU pragma: keep
#include <string>
#include <limits>
#include <algorithm>
#include "utf8.h"
#define _NXT 0x80
#define _SEQ2 0xc0

View file

@ -21,7 +21,6 @@
#define _UTF8_H_
#include <stddef.h>
#include <string>
#define UTF8_IGNORE_ERROR 0x01

View file

@ -3,31 +3,17 @@
Contains datastructures such as automatically growing array lists, priority queues, etc.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <math.h>
#include <sys/time.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <wctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <assert.h>
#include <sys/time.h>
#include "fallback.h"
#include "fallback.h" // IWYU pragma: keep
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
int wcsfilecmp(const wchar_t *a, const wchar_t *b)
{

View file

@ -5,10 +5,6 @@
#ifndef FISH_UTIL_H
#define FISH_UTIL_H
#include <wchar.h>
#include <stdarg.h>
#include <unistd.h>
/**
Returns the larger of two ints
*/

View file

@ -2,9 +2,7 @@
Helper functions for working with wcstring
*/
#include "config.h" // IWYU pragma: keep
#include "common.h"
#include "wcstringutil.h"
typedef wcstring::size_type size_type;

View file

@ -2,12 +2,12 @@
Helper functions for working with wcstring
*/
#ifndef FISH_WCSTRINGUTIL_H
#define FISH_WCSTRINGUTIL_H
#include <string>
#include <utility>
#include "common.h"
/**

View file

@ -53,8 +53,6 @@
#include <stdio.h>
#include <wchar.h>
#include "common.h"
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
@ -74,11 +72,11 @@
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "common.h"
#include "wgetopt.h"
#include "wutil.h"
#include "wutil.h" // IWYU pragma: keep
#include "fallback.h" // IWYU pragma: keep
/**
Use translation functions if available
*/

View file

@ -47,7 +47,7 @@ Cambridge, MA 02139, USA. */
#ifndef FISH_WGETOPT_H
#define FISH_WGETOPT_H
#include <wchar.h>
#include <stddef.h>
class wgetopter_t
{

Some files were not shown because too many files have changed in this diff Show more