diff mbox series

[pseudo,pseudo-1.9] PATCH 02/10] makewrappers: Don't generate unused _int paths with noignore_path

Message ID 1794413712-18072-3-git-send-email-mark.hatle@kernel.crashing.org
State New
Headers show
Series [pseudo,pseudo-1.9] PATCH 02/10] makewrappers: Don't generate unused _int paths with noignore_path | expand

Commit Message

Mark Hatle Nov. 11, 2026, 4:15 p.m. UTC
From: Mark Hatle <mark.hatle@amd.com>

With preserve_paths=1 the canonical path from pseudo_root_path() is
stored in <path>_int rather than overwriting the path argument. The
only reader of <path>_int is the ignore_paths() check, which is not
generated when noignore_path=1 is also set.

open_tree, open_tree_attr and openat2 set both options, so path_int was
assigned but never used, resulting in:

  warning: variable 'path_int' set but not used [-Wunused-but-set-variable]

It also meant an extra pseudo_root_path() call per invocation, as the
guts for these functions resolve the path themselves.

Skip the declaration and assignment of the _int paths when both options
are set. The generated code for all other wrappers is unchanged.

AI-Generated: Uses GitHub Copilot
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
(cherry picked from commit f86ca21137e8a846ba64e66243a54554be533c5e)
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
---
 makewrappers | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/makewrappers b/makewrappers
index 19508fa..4c99cf3 100755
--- a/makewrappers
+++ b/makewrappers
@@ -389,7 +389,8 @@  class Function:
         return self.args.call()
 
     def paths_decl(self):
-        if self.preserve_paths:
+        # path_int is only read by the ignore_paths() check
+        if self.preserve_paths and not self.noignore_path:
             return "\n\t".join("char *" + path + "_int;" for path in self.paths_to_munge)
         return ""
 
@@ -420,6 +421,9 @@  class Function:
                     "\t\t\t%s -1;\n"
                     "\t\t\tgoto quick_exit;\n"
                     "\t\t}\n" % (path, self.rc_assign()))
+            if self.preserve_paths and self.noignore_path:
+                # path_int is only read by the ignore_paths() check
+                continue
             fix_paths.append(
                 "%s = pseudo_root_path(__func__, __LINE__, %s%s, %s, %s);" %
                 (pathvar, prefix, self.dirfd, path, self.flags))