diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-11-30 07:17:53 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-11-30 19:29:21 +0100 |
commit | b15f79a8f8de27c9d186ae1fbd0c86f194aed0ac (patch) | |
tree | 3c4dc647e8ccf78c41f66e4993f3a0490c15a137 /compilerplugins/clang/test | |
parent | 32efde5cef2b8516a9decd0bf7091d7def1da971 (diff) |
loplugin:unnecessaryparen: signed numeric literals
Change-Id: I75c8224452ca9c3711a2ccaca9ecf549fa59cb64
Reviewed-on: https://gerrit.libreoffice.org/45549
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/test')
-rw-r--r-- | compilerplugins/clang/test/unnecessaryparen.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/unnecessaryparen.cxx b/compilerplugins/clang/test/unnecessaryparen.cxx index 78e2096abf9e..b7117a126edb 100644 --- a/compilerplugins/clang/test/unnecessaryparen.cxx +++ b/compilerplugins/clang/test/unnecessaryparen.cxx @@ -82,6 +82,15 @@ int main() // Expecting just one error, not reported twice during TraverseInitListExpr: int a[] = {(x)}; // expected-error {{unnecessary parentheses around identifier [loplugin:unnecessaryparen]}} (void) a; + + (void) (+1); // expected-error {{unnecessary parentheses around signed numeric literal [loplugin:unnecessaryparen]}} + (void) (-1); // expected-error {{unnecessary parentheses around signed numeric literal [loplugin:unnecessaryparen]}} + + // For simplicity's sake, even warn about pathological cases that would require adding + // whitespace when removing the parentheses (as is also necessary in other cases anyway, like + // "throw(x);"); it is unlikely that there are any actual occurrences of code like "-(-1)" that + // would benefit from the parentheses readability-wise, compared to "- -1": + (void) -(-1); // expected-error {{unnecessary parentheses around signed numeric literal [loplugin:unnecessaryparen]}} }; struct S2 { |