From df10b53c0caecd43a02b7f24515a9ff9edea7056 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Tue, 19 Apr 2016 19:49:15 -0700 Subject: restyle builtin modules to match project style Now that the IWYU cleanup has been merged compile all, not just a couple, of the builtin modules independent of builtin.cpp. That is, no longer `#include builtin_NAME.cpp` in builtin.cpp. This is more consistent, more in line with what developers expect, and is likely to reduce mistakes. Reduces lint errors from 384 to 336 (-13%). Line count from 6307 to 4988 (-21%). Another step in resolving issue #2902. --- src/builtin.cpp | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'src/builtin.cpp') diff --git a/src/builtin.cpp b/src/builtin.cpp index b7a84c69..b0356543 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -1,3 +1,4 @@ +// // Functions for executing builtin functions. // // How to add a new builtin function: @@ -19,6 +20,8 @@ #include #include #include +#include +#include #include #include #include @@ -29,24 +32,33 @@ #include #include #include +#include // IWYU pragma: keep #include #include -#include -#include // IWYU pragma: keep -#include -#include "fallback.h" // IWYU pragma: keep #include "builtin.h" +#include "builtin_commandline.h" +#include "builtin_complete.h" +#include "builtin_jobs.h" +#include "builtin_printf.h" +#include "builtin_set.h" +#include "builtin_set_color.h" +#include "builtin_string.h" +#include "builtin_test.h" +#include "builtin_ulimit.h" +#include "common.h" #include "complete.h" #include "env.h" #include "event.h" #include "exec.h" #include "expand.h" +#include "fallback.h" // IWYU pragma: keep #include "function.h" #include "highlight.h" #include "history.h" #include "input.h" #include "intern.h" +#include "io.h" #include "parse_constants.h" #include "parse_util.h" #include "parser.h" @@ -58,9 +70,7 @@ #include "tokenizer.h" #include "wcstringutil.h" #include "wgetopt.h" -#include "wutil.h" -#include "common.h" -#include "io.h" +#include "wutil.h" // IWYU pragma: keep // The default prompt for the read command. #define DEFAULT_READ_PROMPT L"set_color green; echo -n read; set_color normal; echo -n \"> \"" @@ -241,7 +251,7 @@ void builtin_missing_argument(parser_t &parser, io_streams_t &streams, const wch builtin_print_help(parser, streams, cmd, streams.err); } -// Here follows the definition of all builtin commands. The function names are all on the form +// Here follows the definition of all builtin commands. The function names are all of the form // builtin_NAME where NAME is the name of the builtin. so the function name for the builtin 'fg' is // 'builtin_fg'. // @@ -253,21 +263,7 @@ void builtin_missing_argument(parser_t &parser, io_streams_t &streams, const wch // implementation, namely 'builtin_break_continue. // // Several other builtins, including jobs, ulimit and set are so big that they have been given their -// own file. These files are all named 'builtin_NAME.c', where NAME is the name of the builtin. -// These files are included directly below. -#include "builtin_commandline.cpp" -#include "builtin_complete.cpp" -#include "builtin_jobs.cpp" -#include "builtin_printf.cpp" -#include "builtin_set.cpp" -#include "builtin_set_color.cpp" -#include "builtin_ulimit.cpp" - -// builtin_test lives in builtin_test.cpp -int builtin_test(parser_t &parser, io_streams_t &streams, wchar_t **argv); - -// builtin_string lives in builtin_string.cpp -int builtin_string(parser_t &parser, io_streams_t &streams, wchar_t **argv); +// own module. These files are all named 'builtin_NAME.cpp', where NAME is the name of the builtin. /// List a single key binding. /// Returns false if no binding with that sequence and mode exists. -- cgit v1.2.3