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. (cherry picked from commit 5ef0b7d2048a7142174ee3e8e021fc1a9c3e3334) Signed-off-by: Christoph Müllner <christoph.muell...@vrull.eu> --- 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 19eb7b06d54..0bbe7df25d1 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)); -- 2.45.2