From 8eae0318a8c3159590082ecd0df3b7585db3c00b Mon Sep 17 00:00:00 2001 From: Baklanov Lev Date: Mon, 22 Feb 2021 04:26:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BE=D0=BF=D1=86=D0=B8=D0=B8=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B5=D0=B4=D1=83=D0=BF=D1=80=D0=B5=D0=B6=D0=B4=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9=20(#290)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker.ref | 6 ++++++ src/compiler/Config.ref | 6 ++++-- src/compiler/Error.ref | 2 ++ src/compiler/ParseCmdLine.ref | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/compiler/Checker.ref b/src/compiler/Checker.ref index d4db891c..f8697991 100644 --- a/src/compiler/Checker.ref +++ b/src/compiler/Checker.ref @@ -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'; diff --git a/src/compiler/Config.ref b/src/compiler/Config.ref index 2ebee277..83e8ad4d 100644 --- a/src/compiler/Config.ref +++ b/src/compiler/Config.ref @@ -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 { @@ -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 { diff --git a/src/compiler/Error.ref b/src/compiler/Error.ref index 2252b30b..99a76245 100644 --- a/src/compiler/Error.ref +++ b/src/compiler/Error.ref @@ -16,6 +16,8 @@ $EXTERN Config-AllWarningIds; s.WarningId ::= screening | nul-in-compound + | repeated + | repeated-maybe */ $ENUM ErrorList; diff --git a/src/compiler/ParseCmdLine.ref b/src/compiler/ParseCmdLine.ref index 507ba82c..28c59400 100644 --- a/src/compiler/ParseCmdLine.ref +++ b/src/compiler/ParseCmdLine.ref @@ -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 '\'' ); @@ -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'