Skip to content

Commit

Permalink
Добавлены опции предупреждений (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
penachett committed Feb 22, 2021
1 parent afc88ce commit 8eae031
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/compiler/Checker.ref
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ PrepareMessage {
RepVarInSpecPattern s.Mode e.Index
= 'Repeated variable ' s.Mode '.' e.Index ' in specialization pattern';

RepeatedVariable s.Mode e.Index
= 'Repeated variable ' s.Mode '.' e.Index ' in assignment';

RepeatedVariableMaybe s.Mode e.Index
= 'Maybe repeated variable ' s.Mode '.' e.Index ' in last sentence';

UnnamedVariableInSpecPattern s.Mode e.Index
= 'Unnamed variable ' s.Mode '.' e.Index ' can\'t appear '
'in $SPEC pattern';
Expand Down
6 changes: 4 additions & 2 deletions src/compiler/Config.ref
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ $ENTRY Config-GetWarningIds {

e.WarningName ::= 'no-'? e.Error | 'no-'? e.WarningIdName | 'all'
e.Error ::= 'error' ('=' e.WarningName)?
e.WarningIdName :: = 'screening' | 'nul-in-compound'
e.WarningIdName :: = 'screening' | 'nul-in-compound' | 'repeated' | 'repeated-maybe'

*/
$ENTRY Config-SetWarning {
Expand Down Expand Up @@ -534,12 +534,14 @@ WarningForName {
'ignored-pseudocomments' = True ignored-pseudocomments;
'pseudofunctions' = True pseudofunctions;
'pseudofunction' = True pseudofunctions; /* синоним */
'repeated' = True repeated;
'repeated-maybe' = True repeated-maybe;

e.Other = False
}

$ENTRY Config-AllWarningIds {
/* пусто */ = (screening nul-in-compound)
/* пусто */ = (screening nul-in-compound repeated repeated-maybe)
}

WarningIds-Add {
Expand Down
2 changes: 2 additions & 0 deletions src/compiler/Error.ref
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ $EXTERN Config-AllWarningIds;
s.WarningId ::=
screening
| nul-in-compound
| repeated
| repeated-maybe
*/
$ENUM ErrorList;

Expand Down
5 changes: 5 additions & 0 deletions src/compiler/ParseCmdLine.ref
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ $ENTRY ParseCommandLine {
s.Pos
'option -W expects \'all\', \'[no-]error[=...]\', '
'\'[no-]screening\', \'[no-]pseudofunctions\' '
'\'[no-]repeated\', \'[no-]repeated-maybe\' '
'\'[no-]nul-in-compound\', but got \'' e.BadValue '\''
);

Expand Down Expand Up @@ -386,6 +387,10 @@ PrintHelp {
' (enabled by default)\n'
' -Wpseudofunctions, -Wno-... - check/don\'t pseudofunction\n'
' correctness (enabled by default)\n'
' -Wrepeated, -Wno-... - check/don\'t repeated variables\n'
' in assignments (disabled by default)\n'
' -Wrepeated-maybe, -Wno-... - check/don\'t repeated variables\n'
' in last sentences (disabled by default)\n'
' -Werror[=...], -Wno-error[=...] - treat/don\'t all or only provided\n'
' warning(s) as error(s)\n'
'-p, --prefix prefix-name\n'
Expand Down

0 comments on commit 8eae031

Please sign in to comment.