Hi!

This revision has proper commit messages with changelog entries.
I've also split the last commit into two: one that reduces the scope of
a local variable, and another that splits the function.  This makes it
easier to review.  (See range-diff below.)

The overall diff remains the same, so I don't need to test again for
regressions.  (See interdiff below.)


Have a lovely day!
Alex


Alejandro Colomar (4):
  gcc/: Rename warn_parm_array_mismatch() => warn_parms_array_mismatch()
  Fix typos in comment
  gcc/: Reduce scope of local variable (refactor)
  gcc/: Factor out helper function

 gcc/c-family/c-common.h |   2 +-
 gcc/c-family/c-warn.cc  | 584 ++++++++++++++++++++--------------------
 gcc/c/c-decl.cc         |   2 +-
 gcc/c/c-parser.cc       |   2 +-
 4 files changed, 298 insertions(+), 292 deletions(-)

Interdiff against v1:
diff --git a/gcc/c-family/c-warn.cc b/gcc/c-family/c-warn.cc
index 4536756c213..ada7fad8d54 100644
--- a/gcc/c-family/c-warn.cc
+++ b/gcc/c-family/c-warn.cc
@@ -3456,7 +3456,7 @@ warn_parm_array_mismatch (location_t origloc, rdwr_map 
*cur_idx,
   if (!newa)
     {
       /* Continue if both parameters are pointers with no size
-        associated with it.  */
+        associated with them.  */
       if (!cura)
        return;
 
Range-diff against v1:
1:  4cddc7e0e2c ! 1:  d2e0c979f2a Rename internal function
    @@ Metadata
     Author: Alejandro Colomar <[email protected]>
     
      ## Commit message ##
    -    Rename internal function
    -
    -    Rename warn_parm_array_mismatch() => warn_parms_array_mismatch().
    +    gcc/: Rename warn_parm_array_mismatch() => warn_parms_array_mismatch()
     
         This function acts on entire parameter declaration lists, and iterates
         over them.  Use plural in the name, to clarify that it acts on
         parameters, not just on a single parameter.
     
    +    gcc/c-family/ChangeLog:
    +
    +            * c-common.h (warn_parm_array_mismatch):
    +            Rename warn_parm_array_mismatch => warn_parms_array_mismatch.
    +            * c-warn.cc (warn_parm_array_mismatch):
    +            Rename warn_parm_array_mismatch => warn_parms_array_mismatch.
    +
    +    gcc/c/ChangeLog:
    +
    +            * c-decl.cc (start_function):
    +            Rename warn_parm_array_mismatch => warn_parms_array_mismatch.
    +            * c-parser.cc (c_parser_declaration_or_fndef):
    +            Rename warn_parm_array_mismatch => warn_parms_array_mismatch.
    +
         Signed-off-by: Alejandro Colomar <[email protected]>
     
      ## gcc/c-family/c-common.h ##
-:  ----------- > 2:  d3496c602ee Fix typos in comment
2:  046a4b7f89b ! 3:  e04fe1b4408 Fix typo in comment
    @@ Metadata
     Author: Alejandro Colomar <[email protected]>
     
      ## Commit message ##
    -    Fix typo in comment
    +    gcc/: Reduce scope of local variable (refactor)
    +
    +    No functional change intended.
    +
    +    gcc/c-family/ChangeLog:
    +
    +            * c-warn.cc (warn_parms_array_mismatch): Reduce scope of local
    +            variable.
     
         Signed-off-by: Alejandro Colomar <[email protected]>
     
      ## gcc/c-family/c-warn.cc ##
     @@ gcc/c-family/c-warn.cc: warn_parms_array_mismatch (location_t origloc, 
tree fndecl, tree newparms)
    +      such as between f(T*) and f(T[1]), where the former mapping would be
    +      empty.  */
      
    -       if (!newa)
    -   {
    --    /* Continue of both parameters are pointers with no size
    -+    /* Continue if both parameters are pointers with no size
    -        associated with it.  */
    -     if (!cura)
    -       continue;
    +-  /* Create an empty access specification and use it for pointers with
    +-     no spec of their own.  */
    +-  attr_access ptr_spec = { };
    +-
    +   /* Iterate over the two lists of function parameters, comparing their
    +      respective mappings and diagnosing mismatches.  */
    +   unsigned parmpos = 0;
    +@@ gcc/c-family/c-warn.cc: warn_parms_array_mismatch (location_t origloc, 
tree fndecl, tree newparms)
    +   /* Bail on invalid redeclarations with fewer arguments.  */
    +   return;
    + 
    ++      /* Create an empty access specification and use it for pointers with
    ++   no spec of their own.  */
    ++      attr_access ptr_spec = { };
    ++
    +       /* Only check pointers and C++ references.  */
    +       tree curptype = TREE_TYPE (curp);
    +       tree newptype = TREE_TYPE (newp);
3:  5941d89b28d ! 4:  7f69542c1d5 Factor out helper function
    @@ Metadata
     Author: Alejandro Colomar <[email protected]>
     
      ## Commit message ##
    -    Factor out helper function
    +    gcc/: Factor out helper function
     
         Not sure about moving the definition of ptr_spec.
     
    +    No functional change intended.
    +
    +    gcc/c-family/ChangeLog:
    +
    +            * c-warn.cc (warn_parms_array_mismatch): Split out body of
    +            per-pair in parameter lists iteration into...
    +            (warn_parm_array_mismatch): ...this new function.
    +
         Signed-off-by: Alejandro Colomar <[email protected]>
     
      ## gcc/c-family/c-warn.cc ##
    @@ gcc/c-family/c-warn.cc: expr_to_str (pretty_printer &pp, tree expr, 
const char *
     +  if (!newa)
     +    {
     +      /* Continue if both parameters are pointers with no size
    -+   associated with it.  */
    ++   associated with them.  */
     +      if (!cura)
     +  return;
     +
    @@ gcc/c-family/c-warn.cc: expr_to_str (pretty_printer &pp, tree expr, 
const char *
      /* Detect and diagnose a mismatch between an attribute access 
specification
         on the original declaration of FNDECL and that on the parameters 
NEWPARMS
         from its redeclaration.  ORIGLOC is the location of the first 
declaration
    -@@ gcc/c-family/c-warn.cc: warn_parms_array_mismatch (location_t origloc, 
tree fndecl, tree newparms)
    -      such as between f(T*) and f(T[1]), where the former mapping would be
    -      empty.  */
    - 
    --  /* Create an empty access specification and use it for pointers with
    --     no spec of their own.  */
    --  attr_access ptr_spec = { };
    --
    -   /* Iterate over the two lists of function parameters, comparing their
    -      respective mappings and diagnosing mismatches.  */
    -   unsigned parmpos = 0;
     @@ gcc/c-family/c-warn.cc: warn_parms_array_mismatch (location_t origloc, 
tree fndecl, tree newparms)
        /* Bail on invalid redeclarations with fewer arguments.  */
        return;
      
    +-      /* Create an empty access specification and use it for pointers with
    +-   no spec of their own.  */
    +-      attr_access ptr_spec = { };
    +-
     -      /* Only check pointers and C++ references.  */
     -      tree curptype = TREE_TYPE (curp);
     -      tree newptype = TREE_TYPE (newp);
    @@ gcc/c-family/c-warn.cc: warn_parms_array_mismatch (location_t origloc, 
tree fnde
     -      if (!newa)
     -  {
     -    /* Continue if both parameters are pointers with no size
    --       associated with it.  */
    +-       associated with them.  */
     -    if (!cura)
     -      continue;
     -
-- 
2.51.0

Reply via email to