maint: enable sc_prohibit_tab_based_indentation syntax check

* cfg.mk (local-checks-to-skip): Remove its exemption.
Exempt all files under testsuite/, for now, and a few others.
* .gitmodules: Change each leading TAB to 8 spaces spaces.
* BUGS: Likewise.
* NEWS: Likewise.
* configure.ac: Likewise.
* sed/compile.c: Likewise.
* sed/execute.c: Likewise.
* sed/fmt.c: Likewise.
* sed/regexp.c: Likewise.
* sed/sed.c: Likewise.
* sed/sed.h: Likewise.
* sed/utils.c: Likewise.
* sed/utils.h: Likewise.
* COPYING: Update from coreutils.
This commit is contained in:
Jim Meyering committed 2014-11-30 18:59:35 -08:00
1 parent 8d5fa64778
commit e48ca0d39c
14 files changed
+1230 -1228

No files matched your search

+2 -2
View File
@@ -1,3 +1,3 @@
[submodule "gnulib"]
path = gnulib
url = git://git.sv.gnu.org/gnulib.git
path = gnulib
url = git://git.sv.gnu.org/gnulib.git
+3 -3
View File
@@ -9,9 +9,9 @@ include in the Subject: header the first line of the output of
Please do not send a bug report like this:
[while building frobme-1.3.4]
$ configure
sed: file sedscr line 1: Unknown option to 's'
[while building frobme-1.3.4]
$ configure
sed: file sedscr line 1: Unknown option to 's'
If sed doesn't configure your favorite package, take a few extra
minutes to identify the specific problem and make a stand-alone test
+6 -8
View File
@@ -1,12 +1,11 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
@@ -69,7 +68,7 @@ patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
TERMS AND CONDITIONS
0. Definitions.
@@ -619,9 +618,9 @@ an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -673,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+9 -9
View File
@@ -442,15 +442,15 @@ NUL character. Had the glibc folk fix a bug in lib/regex.c where
* The s/// command now understands the following escapes
(in both halves):
\a an "alert" (BEL)
\f a form-feed
\n a newline
\r a carriage-return
\t a horizontal tab
\v a vertical tab
\oNNN a character with the octal value NNN
\dNNN a character with the decimal value NNN
\xNN a character with the hexadecimal value NN
\a an "alert" (BEL)
\f a form-feed
\n a newline
\r a carriage-return
\t a horizontal tab
\v a vertical tab
\oNNN a character with the octal value NNN
\dNNN a character with the decimal value NNN
\xNN a character with the hexadecimal value NN
This behavior is disabled if POSIXLY_CORRECT is set, at least for the
time being (until I can be convinced that this behavior does not violate
the POSIX standard). (Incidentally, \b (backspace) was omitted because
+6 -2
View File
@@ -33,7 +33,6 @@ local-checks-to-skip = \
sc_prohibit_magic_number_exit \
sc_prohibit_strcmp \
sc_prohibit_strncpy \
sc_prohibit_tab_based_indentation \
sc_texinfo_acronym \
sc_unmarked_diagnostics \
sc_useless_cpp_parens
@@ -63,7 +62,7 @@ export VERBOSE = yes
# 836832 6e
export XZ_OPT = -6e
old_NEWS_hash = b6210de3e57d22c04f064eb481282e11
old_NEWS_hash = 4c8b8c2fef372b60da66269683f768d7
# Many m4 macros names once began with 'jm_'.
# Make sure that none are inadvertently reintroduced.
@@ -137,3 +136,8 @@ exclude_file_name_regexp--sc_program_name = ^testsuite/.*\.c$$
exclude_file_name_regexp--sc_space_tab = ^testsuite/.*$$
exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
^configure\.ac$$
tbi_1 = (^testsuite/.*|^gl/lib/reg.*\.c\.diff|\.mk|/help2man)$$
tbi_2 = (GNU)?[Mm]akefile(\.am)?$$
exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
$(tbi_1)|$(tbi_2)
+2 -2
View File
@@ -70,7 +70,7 @@ if test "$sed_cv_libcp_needed" = yes; then
fi
AC_CHECK_HEADERS_ONCE(locale.h errno.h wchar.h wctype.h mcheck.h,
[], [], [AC_INCLUDES_DEFAULT])
[], [], [AC_INCLUDES_DEFAULT])
AC_C_CONST
AC_TYPE_SIZE_T
@@ -78,7 +78,7 @@ AM_GNU_GETTEXT_VERSION(0.17)
AM_GNU_GETTEXT([external])
AC_CHECK_FUNCS_ONCE(isatty isascii memcpy strchr strtoul lstat readlink
popen pathconf fchown fchmod setlocale)
popen pathconf fchown fchmod setlocale)
# Check whether we are able to follow symlinks
if test "$ac_cv_func_lstat:$ac_cv_func_readlink" = yes:yes; then
+553 -553
View File
File diff suppressed because it is too large. Load diff
+476 -476
View File
File diff suppressed because it is too large. Load diff
+44 -44
View File
@@ -235,10 +235,10 @@ get_paragraph ()
{
c = copy_rest (c);
if (c == EOF)
{
next_char = EOF;
return false;
}
{
next_char = EOF;
return false;
}
putc ('\n', outfile);
c = GETC();
}
@@ -308,7 +308,7 @@ get_line (register int c)
word_limit->text = parabuf - 1;
do
c = GETC();
c = GETC();
while (c != EOF && !ISSPACE (c));
word_limit->length = parabuf - word_limit->text - (c != EOF);
in_column += word_limit->length;
@@ -321,18 +321,18 @@ get_line (register int c)
c = get_space (c);
word_limit->space = in_column - start;
word_limit->final = (c == EOF
|| (word_limit->period
&& (c == '\n' || word_limit->space > 1)));
|| (word_limit->period
&& (c == '\n' || word_limit->space > 1)));
if (c == '\n' || c == EOF)
word_limit->space = word_limit->final ? 2 : 1;
word_limit->space = word_limit->final ? 2 : 1;
if (word_limit == end_of_word)
flush_paragraph ();
flush_paragraph ();
word_limit++;
if (c == EOF)
{
in_column = first_indent;
return EOF;
}
{
in_column = first_indent;
return EOF;
}
}
while (c != '\n');
@@ -350,11 +350,11 @@ get_space (register int c)
for (;;)
{
if (c == ' ')
in_column++;
in_column++;
else if (c == '\t')
in_column = (in_column / TABWIDTH + 1) * TABWIDTH;
in_column = (in_column / TABWIDTH + 1) * TABWIDTH;
else
return c;
return c;
c = GETC();
}
}
@@ -399,12 +399,12 @@ flush_paragraph (void)
for (w = words->next_break; w != word_limit; w = w->next_break)
{
if (w->best_cost - w->next_break->best_cost < best_break)
{
split_point = w;
best_break = w->best_cost - w->next_break->best_cost;
}
{
split_point = w;
best_break = w->best_cost - w->next_break->best_cost;
}
if (best_break <= MAXCOST - LINE_CREDIT)
best_break += LINE_CREDIT;
best_break += LINE_CREDIT;
}
put_paragraph (split_point);
@@ -412,7 +412,7 @@ flush_paragraph (void)
the source and target may overlap. */
memmove ((char *) words, (char *) split_point,
(word_limit - split_point + 1) * sizeof (WORD));
(word_limit - split_point + 1) * sizeof (WORD));
word_limit -= split_point - words;
}
@@ -442,22 +442,22 @@ fmt_paragraph (void)
w = start;
len += w->length;
do
{
w++;
{
w++;
/* Consider breaking before w. */
/* Consider breaking before w. */
wcost = line_cost (w, len) + w->best_cost;
if (start == words && last_line_length > 0)
wcost += RAGGED_COST (len - last_line_length);
if (wcost < best)
{
best = wcost;
start->next_break = w;
start->line_length = len;
}
len += (w - 1)->space + w->length; /* w > start >= words */
}
wcost = line_cost (w, len) + w->best_cost;
if (start == words && last_line_length > 0)
wcost += RAGGED_COST (len - last_line_length);
if (wcost < best)
{
best = wcost;
start->next_break = w;
start->line_length = len;
}
len += (w - 1)->space + w->length; /* w > start >= words */
}
while (len < max_width);
start->best_cost = best + base_cost (start);
}
@@ -478,16 +478,16 @@ base_cost (register WORD *this)
if (this > words)
{
if ((this - 1)->period)
{
if ((this - 1)->final)
cost -= SENTENCE_BONUS;
else
cost += NOBREAK_COST;
}
{
if ((this - 1)->final)
cost -= SENTENCE_BONUS;
else
cost += NOBREAK_COST;
}
else if ((this - 1)->punct)
cost -= PUNCT_BONUS;
cost -= PUNCT_BONUS;
else if (this > words + 1 && (this - 2)->final)
cost += WIDOW_COST ((this - 1)->length);
cost += WIDOW_COST ((this - 1)->length);
}
if (this->paren)
+11 -11
View File
@@ -49,9 +49,9 @@ compile_regex_1 (new_regex, needed_sub)
#ifdef REG_PERL
int errcode;
errcode = regncomp(&new_regex->pattern, new_regex->re, new_regex->sz,
(needed_sub ? 0 : REG_NOSUB)
| new_regex->flags
| extended_regexp_flags);
(needed_sub ? 0 : REG_NOSUB)
| new_regex->flags
| extended_regexp_flags);
if (errcode)
{
@@ -62,7 +62,7 @@ compile_regex_1 (new_regex, needed_sub)
#else
const char *error;
int syntax = ((extended_regexp_flags & REG_EXTENDED)
? RE_SYNTAX_POSIX_EXTENDED
? RE_SYNTAX_POSIX_EXTENDED
: RE_SYNTAX_POSIX_BASIC);
syntax &= ~RE_DOT_NOT_NULL;
@@ -100,7 +100,7 @@ compile_regex_1 (new_regex, needed_sub)
re_set_syntax (syntax);
error = re_compile_pattern (new_regex->re, new_regex->sz,
&new_regex->pattern);
&new_regex->pattern);
new_regex->pattern.newline_anchor = (new_regex->flags & REG_NEWLINE) != 0;
new_regex->pattern.translate = NULL;
@@ -110,7 +110,7 @@ compile_regex_1 (new_regex, needed_sub)
static char translate[1 << (sizeof(char) * 8)];
int i;
for (i = 0; i < sizeof(translate) / sizeof(char); i++)
translate[i] = tolower (i);
translate[i] = tolower (i);
new_regex->pattern.translate = translate;
}
@@ -127,7 +127,7 @@ compile_regex_1 (new_regex, needed_sub)
{
char buf[200];
sprintf(buf, _("invalid reference \\%d on `s' command's RHS"),
needed_sub - 1);
needed_sub - 1);
bad_prog(buf);
}
}
@@ -145,7 +145,7 @@ compile_regex(b, flags, needed_sub)
if (size_buffer(b) == 0)
{
if (flags > 0)
bad_prog(_(BAD_MODIF));
bad_prog(_(BAD_MODIF));
return NULL;
}
@@ -227,7 +227,7 @@ match_regex(regex, buf, buflen, buf_start_offset, regarray, regsize)
{
regex = regex_last;
if (!regex_last)
bad_prog(_(NO_REGEX));
bad_prog(_(NO_REGEX));
}
else
regex_last = regex;
@@ -248,8 +248,8 @@ match_regex(regex, buf, buflen, buf_start_offset, regarray, regsize)
regex->pattern.regs_allocated = REGS_REALLOCATE;
ret = re_search (&regex->pattern, buf, buflen, buf_start_offset,
buflen - buf_start_offset,
regsize ? regarray : NULL);
buflen - buf_start_offset,
regsize ? regarray : NULL);
return (ret > -1);
#endif
+72 -72
View File
@@ -85,7 +85,7 @@ General help using GNU software: <http://www.gnu.org/gethelp/>.\n"));
if (!errmsg)
fprintf(out, _("E-mail bug reports to: <%s>.\n\
Be sure to include the word ``%s'' somewhere in the ``Subject:'' field.\n"),
PACKAGE_BUGREPORT, PACKAGE);
PACKAGE_BUGREPORT, PACKAGE);
}
static void usage (int);
@@ -222,108 +222,108 @@ main(argc, argv)
{
countT t = atoi(cols);
if (t > 1)
lcmd_out_line_len = t-1;
lcmd_out_line_len = t-1;
}
myname = *argv;
while ((opt = getopt_long(argc, argv, SHORTOPTS, longopts, NULL)) != EOF)
{
switch (opt)
{
case 'n':
no_default_output = true;
break;
case 'e':
the_program = compile_string(the_program, optarg, strlen(optarg));
break;
case 'f':
the_program = compile_file(the_program, optarg);
break;
{
case 'n':
no_default_output = true;
break;
case 'e':
the_program = compile_string(the_program, optarg, strlen(optarg));
break;
case 'f':
the_program = compile_file(the_program, optarg);
break;
case 'z':
buffer_delimiter = 0;
break;
case 'z':
buffer_delimiter = 0;
break;
case 'F':
follow_symlinks = true;
break;
case 'F':
follow_symlinks = true;
break;
case 'i':
separate_files = true;
if (optarg == NULL)
/* use no backups */
in_place_extension = ck_strdup ("*");
case 'i':
separate_files = true;
if (optarg == NULL)
/* use no backups */
in_place_extension = ck_strdup ("*");
else if (strchr(optarg, '*') != NULL)
in_place_extension = ck_strdup(optarg);
else if (strchr(optarg, '*') != NULL)
in_place_extension = ck_strdup(optarg);
else
{
in_place_extension = MALLOC (strlen(optarg) + 2, char);
in_place_extension[0] = '*';
strcpy (in_place_extension + 1, optarg);
}
else
{
in_place_extension = MALLOC (strlen(optarg) + 2, char);
in_place_extension[0] = '*';
strcpy (in_place_extension + 1, optarg);
}
break;
break;
case 'l':
lcmd_out_line_len = atoi(optarg);
break;
case 'l':
lcmd_out_line_len = atoi(optarg);
break;
case 'p':
posixicity = POSIXLY_BASIC;
break;
case 'p':
posixicity = POSIXLY_BASIC;
break;
case 'b':
read_mode = "rb";
write_mode = "wb";
break;
read_mode = "rb";
write_mode = "wb";
break;
case 'E':
case 'r':
if (extended_regexp_flags)
usage(4);
extended_regexp_flags = REG_EXTENDED;
break;
case 'E':
case 'r':
if (extended_regexp_flags)
usage(4);
extended_regexp_flags = REG_EXTENDED;
break;
#ifdef REG_PERL
case 'R':
if (extended_regexp_flags)
usage(4);
extended_regexp_flags = REG_PERL;
break;
case 'R':
if (extended_regexp_flags)
usage(4);
extended_regexp_flags = REG_PERL;
break;
#endif
case 's':
separate_files = true;
break;
case 's':
separate_files = true;
break;
case 'u':
unbuffered = true;
break;
case 'u':
unbuffered = true;
break;
case 'v':
case 'v':
version_etc(stdout, program_name, PACKAGE_NAME, VERSION,
AUTHORS, (char *) NULL);
contact(false);
ck_fclose (NULL);
exit (0);
case 'h':
usage(0);
default:
usage(4);
}
contact(false);
ck_fclose (NULL);
exit (0);
case 'h':
usage(0);
default:
usage(4);
}
}
if (!the_program)
{
if (optind < argc)
{
char *arg = argv[optind++];
the_program = compile_string(the_program, arg, strlen(arg));
}
{
char *arg = argv[optind++];
the_program = compile_string(the_program, arg, strlen(arg));
}
else
usage(4);
usage(4);
}
check_final_program(the_program);
+2 -2
View File
@@ -191,8 +191,8 @@ void finish_program (struct vector *);
struct regex *compile_regex (struct buffer *b, int flags, int needed_sub);
int match_regex (struct regex *regex,
char *buf, size_t buflen, size_t buf_start_offset,
struct re_registers *regarray, int regsize);
char *buf, size_t buflen, size_t buf_start_offset,
struct re_registers *regarray, int regsize);
#ifdef DEBUG_LEAKS
void release_regex (struct regex *);
#endif
+43 -43
View File
@@ -65,13 +65,13 @@ panic(const char *str, ...)
while (open_files)
{
if (open_files->temp)
{
fclose (open_files->fp);
errno = 0;
unlink (open_files->name);
{
fclose (open_files->fp);
errno = 0;
unlink (open_files->name);
if (errno != 0)
fprintf (stderr, _("cannot remove %s: %s"), open_files->name, strerror (errno));
}
}
open_files = open_files->link;
}
@@ -111,10 +111,10 @@ register_open_file (fp, name, temp)
for (p=open_files; p; p=p->link)
{
if (fp == p->fp)
{
free(p->name);
break;
}
{
free(p->name);
break;
}
}
if (!p)
{
@@ -190,9 +190,9 @@ ck_mkstemp (p_filename, tmpdir, base, mode)
tmpdir = getenv("TMP");
if (tmpdir == NULL)
#ifdef P_tmpdir
tmpdir = P_tmpdir;
tmpdir = P_tmpdir;
#else
tmpdir = "/tmp";
tmpdir = "/tmp";
#endif
}
@@ -226,8 +226,8 @@ ck_fwrite(ptr, size, nmemb, stream)
clearerr(stream);
if (size && fwrite(ptr, size, nmemb, stream) != nmemb)
panic(ngettext("couldn't write %d item to %s: %s",
"couldn't write %d items to %s: %s", nmemb),
nmemb, utils_fp_name(stream), strerror(errno));
"couldn't write %d items to %s: %s", nmemb),
nmemb, utils_fp_name(stream), strerror(errno));
}
/* Panic on failing fread */
@@ -296,14 +296,14 @@ ck_fclose(stream)
while ( (cur = prev->link) )
{
if (!stream || stream == cur->fp)
{
do_ck_fclose (cur->fp);
prev->link = cur->link;
free(cur->name);
free(cur);
}
{
do_ck_fclose (cur->fp);
prev->link = cur->link;
free(cur->name);
free(cur);
}
else
prev = cur;
prev = cur;
}
open_files = r.link;
@@ -368,37 +368,37 @@ follow_symlink(const char *fname)
buf2 = ck_realloc (buf2, buf_size);
}
if (rc < 0)
panic (_("couldn't follow symlink %s: %s"), buf, strerror(errno));
panic (_("couldn't follow symlink %s: %s"), buf, strerror(errno));
else
buf2 [rc] = '\0';
buf2 [rc] = '\0';
if (buf2[0] != '/' && (c = strrchr (buf, '/')) != NULL)
{
/* Need to handle relative paths with care. Reallocate buf1 and
buf2 to be big enough. */
int len = c - buf + 1;
if (len + rc + 1 > buf_size)
{
buf_size = len + rc + 1;
buf1 = ck_realloc (buf1, buf_size);
buf2 = ck_realloc (buf2, buf_size);
}
{
/* Need to handle relative paths with care. Reallocate buf1 and
buf2 to be big enough. */
int len = c - buf + 1;
if (len + rc + 1 > buf_size)
{
buf_size = len + rc + 1;
buf1 = ck_realloc (buf1, buf_size);
buf2 = ck_realloc (buf2, buf_size);
}
/* Always store the new path in buf1. */
if (buf != buf1)
/* Always store the new path in buf1. */
if (buf != buf1)
memcpy (buf1, buf, len);
/* Tack the relative symlink at the end of buf1. */
memcpy (buf1 + len, buf2, rc + 1);
buf = buf1;
}
buf = buf1;
}
else
{
/* Use buf2 as the buffer, it saves a strcpy if it is not pointing to
another link. It works for absolute symlinks, and as long as
symlinks do not leave the current directory. */
buf = buf2;
}
{
/* Use buf2 as the buffer, it saves a strcpy if it is not pointing to
another link. It works for absolute symlinks, and as long as
symlinks do not leave the current directory. */
buf = buf2;
}
}
if (rc < 0)
@@ -579,7 +579,7 @@ add1_buffer(b, c)
{
char *result;
if (b->allocated - b->length < 1)
resize_buffer(b, b->length+1);
resize_buffer(b, b->length+1);
result = b->b + b->length++;
*result = c;
return result;
+1 -1
View File
@@ -31,7 +31,7 @@ void ck_fclose (FILE *stream);
const char *follow_symlink (const char *path);
size_t ck_getdelim (char **text, size_t *buflen, char buffer_delimiter, FILE *stream);
FILE * ck_mkstemp (char **p_filename, const char *tmpdir, const char *base,
const char *mode);
const char *mode);
void ck_rename (const char *from, const char *to, const char *unlink_if_fail);
void *ck_malloc (size_t size);