]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c, c++: Fix two redundantAssignment warnings [PR94629]
authorJakub Jelinek <jakub@redhat.com>
Fri, 17 Apr 2020 14:59:57 +0000 (16:59 +0200)
committerJakub Jelinek <jakub@redhat.com>
Fri, 17 Apr 2020 14:59:57 +0000 (16:59 +0200)
This change fixes two obvious redundant assignments reported by cppcheck:
trunk.git/gcc/c/c-parser.c:16969:2: style: Variable 'data.clauses' is reassigned a value before the old one has been used. [redundantAssignment]
trunk.git/gcc/cp/call.c:5116:9: style: Variable 'arg2' is reassigned a value before the old one has been used. [redundantAssignment]

2020-04-17  Jakub Jelinek  <jakub@redhat.com>

PR other/94629
* c-parser.c (c_parser_oacc_routine): Remove redundant assignment
to data.clauses.

* call.c (build_conditional_expr_1): Remove redundant assignment to
arg2.

gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/cp/ChangeLog
gcc/cp/call.c

index a1831d46f12004b9dfa47c087d1174b760b07f78..b6af67617880da16ff9376662ee3698bbb1c5784 100644 (file)
@@ -1,3 +1,9 @@
+2020-04-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR other/94629
+       * c-parser.c (c_parser_oacc_routine): Remove redundant assignment
+       to data.clauses.
+
 2020-04-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/94593
index 679c14db29cda07cbd18590b304d1cd0813e338c..4e90d55f30f4a466e10f4ed852dde471ce67e885 100644 (file)
@@ -16939,7 +16939,6 @@ c_parser_oacc_routine (c_parser *parser, enum pragma_context context)
   oacc_routine_data data;
   data.error_seen = false;
   data.fndecl_seen = false;
-  data.clauses = NULL_TREE;
   data.loc = c_parser_peek_token (parser)->location;
 
   c_parser_consume_pragma (parser);
index b2acd8927193776c8846e774468c45cfdc8f08b7..8410ff1d1cbc7068db6ffb6efb08176e1df7780f 100644 (file)
@@ -1,3 +1,9 @@
+2020-04-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR other/94629
+       * call.c (build_conditional_expr_1): Remove redundant assignment to
+       arg2.
+
 2020-04-16  Patrick Palka  <ppalka@redhat.com>
 
        PR c++/94475
index 1f3d9d23b5b269028f9d43918d3d49c1fb5675cd..c58231601c98539f7349b7628cd90fa8639139a0 100644 (file)
@@ -5112,7 +5112,7 @@ build_conditional_expr_1 (const op_location_t &loc,
       /* Make sure that lvalues remain lvalues.  See g++.oliva/ext1.C.  */
       if (glvalue_p (arg1))
        {
-         arg2 = arg1 = cp_stabilize_reference (arg1);
+         arg1 = cp_stabilize_reference (arg1);
          arg2 = arg1 = prevent_lifetime_extension (arg1);
        }
       else