https://gcc.gnu.org/g:16d1d5b7db194fa7e0373bf78fccabdf8ef0d009

commit 16d1d5b7db194fa7e0373bf78fccabdf8ef0d009
Author: Christoph Müllner <christoph.muell...@vrull.eu>
Date:   Fri Jul 5 04:58:07 2024 +0200

    RISC-V: Fix comment/naming in attribute parsing code
    
    Function target attributes have to be separated by semi-colons.
    Let's fix the comment and variable naming to better explain what
    the code does.
    
    gcc/ChangeLog:
    
            * config/riscv/riscv-target-attr.cc (riscv_process_target_attr):
            Fix comments and variable names.
    
    Signed-off-by: Christoph Müllner <christoph.muell...@vrull.eu>
    (cherry picked from commit 5ef0b7d2048a7142174ee3e8e021fc1a9c3e3334)

Diff:
---
 gcc/config/riscv/riscv-target-attr.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/config/riscv/riscv-target-attr.cc 
b/gcc/config/riscv/riscv-target-attr.cc
index 19eb7b06d548..0bbe7df25d19 100644
--- a/gcc/config/riscv/riscv-target-attr.cc
+++ b/gcc/config/riscv/riscv-target-attr.cc
@@ -338,11 +338,11 @@ riscv_process_target_attr (tree fndecl, tree args, 
location_t loc,
   char *str_to_check = buf.get ();
   strcpy (str_to_check, TREE_STRING_POINTER (args));
 
-  /* Used to catch empty spaces between commas i.e.
+  /* Used to catch empty spaces between semi-colons i.e.
      attribute ((target ("attr1;;attr2"))).  */
-  unsigned int num_commas = num_occurences_in_str (';', str_to_check);
+  unsigned int num_semicolons = num_occurences_in_str (';', str_to_check);
 
-  /* Handle multiple target attributes separated by ','.  */
+  /* Handle multiple target attributes separated by ';'.  */
   char *token = strtok_r (str_to_check, ";", &str_to_check);
 
   riscv_target_attr_parser attr_parser (loc);
@@ -354,7 +354,7 @@ riscv_process_target_attr (tree fndecl, tree args, 
location_t loc,
       token = strtok_r (NULL, ";", &str_to_check);
     }
 
-  if (num_attrs != num_commas + 1)
+  if (num_attrs != num_semicolons + 1)
     {
       error_at (loc, "malformed %<target(\"%s\")%> attribute",
                TREE_STRING_POINTER (args));

Reply via email to