diff options
author | Neil Booth <neilb@earthling.net> | 2000-05-18 11:09:27 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2000-05-18 11:09:27 +0000 |
commit | 6ab3e7dde0bb5e0ebae56b7182b049c6a3626955 (patch) | |
tree | 183a804a4d784ff0a4492f7cc32f7ac45a78527e /gcc/cppinit.c | |
parent | fc5b21380eee9b33e07a59dbdb91c05cfe18a3cf (diff) | |
download | gcc-6ab3e7dde0bb5e0ebae56b7182b049c6a3626955.zip gcc-6ab3e7dde0bb5e0ebae56b7182b049c6a3626955.tar.gz gcc-6ab3e7dde0bb5e0ebae56b7182b049c6a3626955.tar.bz2 |
cppinit.c (cpp_reader_init): Initialise col_adjust and default tab stop size.
* cppinit.c (cpp_reader_init): Initialise col_adjust and
default tab stop size.
(no_num, OPT_ftabstop): New.
(handle_option): Handle "ftabstop=" command-line option.
(print_help): Document it.
* cpplex.c (COLUMN): Remove.
(handle_newline): Reset col_adjust.
(skip_whitespace): Update col_adjust as tabs encountered.
(_cpp_lex_line): Update to use col_adjust. Call
skip_whitespace for all whitespace.
* cpplib.h (struct cpp_options): New member tabstop.
(struct cpp_reader): New member col_adjust.
(CPP_BUF_COL): Update.
(CPP_BUF_COLUMN): New.
* cpp.texi: Document "-ftabstop=" command line option.
From-SVN: r33982
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r-- | gcc/cppinit.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 3f47736..120f386 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -545,6 +545,7 @@ cpp_reader_init (pfile) CPP_OPTION (pfile, warn_import) = 1; CPP_OPTION (pfile, discard_comments) = 1; CPP_OPTION (pfile, show_column) = 1; + CPP_OPTION (pfile, tabstop) = 8; CPP_OPTION (pfile, pending) = (struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending)); @@ -1079,6 +1080,7 @@ new_pending_directive (pend, text, handler) #define no_fil N_("File name missing after %s") #define no_mac N_("Macro name missing after %s") #define no_pth N_("Path name missing after %s") +#define no_num N_("Number missing after %s") /* This is the list of all command line options, with the leading "-" removed. It must be sorted in ASCII collating order. */ @@ -1108,6 +1110,7 @@ new_pending_directive (pend, text, handler) DEF_OPT("fno-show-column", 0, OPT_fno_show_column) \ DEF_OPT("fpreprocessed", 0, OPT_fpreprocessed) \ DEF_OPT("fshow-column", 0, OPT_fshow_column) \ + DEF_OPT("ftabstop=", no_num, OPT_ftabstop) \ DEF_OPT("g", no_arg, OPT_g) /* arg optional */ \ DEF_OPT("h", 0, OPT_h) \ DEF_OPT("idirafter", no_dir, OPT_idirafter) \ @@ -1312,6 +1315,16 @@ handle_option (pfile, argc, argv) case OPT_fno_show_column: CPP_OPTION (pfile, show_column) = 0; break; + case OPT_ftabstop: + /* Silently ignore empty string, non-longs and silly values. */ + if (arg[0] != '\0') + { + char *endptr; + long tabstop = strtol (arg, &endptr, 10); + if (*endptr == '\0' && tabstop >= 1 && tabstop <= 100) + CPP_OPTION (pfile, tabstop) = tabstop; + } + break; case OPT_w: CPP_OPTION (pfile, inhibit_warnings) = 1; break; @@ -1833,6 +1846,7 @@ Switches:\n\ -dD Preserve macro definitions in output\n\ -dN As -dD except that only the names are preserved\n\ -dI Include #include directives in the output\n\ + -ftabstop=<number> Distance between tab stops for column reporting\n\ -P Do not generate #line directives\n\ -$ Do not allow '$' in identifiers\n\ -remap Remap file names when including files.\n\ |