Skip to content

Commit 3a2ca44

Browse files
committed
[SELF-INCOMPATIBLE] main: make NONE a reserved language name
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 747f410 commit 3a2ca44

File tree

6 files changed

+15
-0
lines changed

6 files changed

+15
-0
lines changed

Tmain/broken-langdef.d/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ run_ctags()
1313

1414
run_ctags ""
1515
run_ctags all
16+
run_ctags NONE
1617
for c in '!' '"' '$' '%' '&' "'" '(' ')' '*' ',' '-' '.' '/' ':' ';' '<' '=' '>' '?' '@' '[' '\' ']' '^' '`' '|' '~'; do
1718
run_ctags "C$c"
1819
done

Tmain/broken-langdef.d/stderr-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
ctags: No language specified for "langdef" option
33
# all
44
ctags: "all" is reserved; don't use it as the name for defining a new language
5+
# NONE
6+
ctags: "NONE" is reserved; don't use it as the name for defining a new language
57
# C!
68
ctags: don't use `!' in a language name (C!)
79
# C"

docs/man/ctags-optlib.7.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ OPTIONS
143143
``--kinds-(<LANG>|all)=[+|-](<kinds>|*)`` option in :ref:`ctags(1) <ctags(1)>` about how the
144144
reserved word is used.
145145

146+
``NONE`` is another exception. ``NONE`` as *<name>* is not acceptable.
147+
146148
The names of built-in parsers are capitalized. When
147149
ctags evaluates an option in a command line, and
148150
chooses a parser, ctags uses the names of

main/parse.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2263,6 +2263,12 @@ extern void processLanguageDefineOption (
22632263
eFree (name);
22642264
error (FATAL, "\"" RSV_LANG_ALL "\" is reserved; don't use it as the name for defining a new language");
22652265
}
2266+
else if (strcmp(name, RSV_NONE) == 0)
2267+
{
2268+
eFree (name);
2269+
error (FATAL, "\"" RSV_NONE "\" is reserved; don't use it as the name for defining a new language");
2270+
2271+
}
22662272
else if ((unacceptable = strpbrk (name, "!\"$%&'()*,-./:;<=>?@[\\]^`|~")))
22672273
{
22682274
char c = *unacceptable;

man/ctags-optlib.7.rst.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ OPTIONS
143143
``--kinds-(<LANG>|all)=[+|-](<kinds>|*)`` option in ctags(1) about how the
144144
reserved word is used.
145145

146+
``NONE`` is another exception. ``NONE`` as *<name>* is not acceptable.
147+
146148
The names of built-in parsers are capitalized. When
147149
@CTAGS_NAME_EXECUTABLE@ evaluates an option in a command line, and
148150
chooses a parser, @CTAGS_NAME_EXECUTABLE@ uses the names of

misc/optlib2c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ my $options =
5858
if (defined $_[0]->{'langdef'});
5959
die "Don't use \"all\" as a language name. It is reserved word."
6060
if ($1 eq "all");
61+
die "Don't use \"all\" as a language name. It is reserved word."
62+
if ($1 eq "NONE");
6163

6264
$_[0]->{'langdef'} = $1;
6365
$_[0]->{'base'} = $5 if defined $5;

0 commit comments

Comments
 (0)