]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/: Reduce scope of local variable (refactor)
authorAlejandro Colomar <alx@kernel.org>
Sun, 2 Nov 2025 18:45:36 +0000 (19:45 +0100)
committerJoseph Myers <josmyers@redhat.com>
Tue, 11 Nov 2025 18:06:18 +0000 (18:06 +0000)
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 <alx@kernel.org>
gcc/c-family/c-warn.cc

index cc127de24882717d894b5c5773b2c30b404d191f..d50129f0396e6a1f5165a1843fc7e1c7adbd256a 100644 (file)
@@ -3470,10 +3470,6 @@ 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;
@@ -3484,6 +3480,10 @@ 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);