https://gcc.gnu.org/g:5d2205b80170c9416868a6c557b4b48b5a6c8e11

commit r17-1935-g5d2205b80170c9416868a6c557b4b48b5a6c8e11
Author: Filip Kastl <[email protected]>
Date:   Sat Jun 27 08:48:58 2026 +0200

    fixincl.c: Fix my previous patch for (const) char *
    
    In my previous patch I changed a parameter of extract_quoted_files
    from const char * to just char *.  I believe that's still the right call
    but I overlooked that a string literal gets assigned to that variable
    inside the function body.  That means we throw away constness of that
    string literal and produce a warning during compilation of fixincl.c.
    
    This patch fixes this by using a helper const char * variable.
    
    fixincludes/ChangeLog:
    
            * fixincl.c (extract_quoted_files): Add a const char * helper
            variable.
    
    Signed-off-by: Filip Kastl <[email protected]>

Diff:
---
 fixincludes/fixincl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c
index 2c36a9a30d18..e227665f3cff 100644
--- a/fixincludes/fixincl.c
+++ b/fixincludes/fixincl.c
@@ -741,18 +741,19 @@ quoted_file_exists (const char* pz_src_path,
 
 static void
 extract_quoted_files (char* pz_data,
-                      char* pz_fixed_file,
+                      char* pz_file,
                       regmatch_t* p_re_match)
 {
-  char *pz_dir_end = strrchr (pz_fixed_file, '/');
+  char *pz_dir_end = strrchr (pz_file, '/');
   char *pz_incl_quot = pz_data;
 
   if (VLEVEL( VERB_APPLIES ))
-    fprintf (stderr, "Quoted includes in %s\n", pz_fixed_file);
+    fprintf (stderr, "Quoted includes in %s\n", pz_file);
 
   /*  Set "pz_fixed_file" to point to the containing subdirectory of the source
       If there is none, then it is in our current directory, ".".   */
 
+  const char *pz_fixed_file = pz_file;
   if (pz_dir_end == (char *) NULL)
     pz_fixed_file = ".";
   else

Reply via email to