Richard Sandiford <richard.sandif...@arm.com> writes:
>> +
>> +         /* Skip any newlines or whitespaces needed.  */
>> +         while (ISSPACE(*templ))
>> +           templ++;
>> +         continue;
>> +       }
>> +      else if (templ[0] == '/' && templ[1] == '*')
>> +       {
>> +         templ += 2;
>> +         /* Glob till newline or end of multiline comment.  */
>> +         while (templ[0] != 0 && templ[0] != '*' && templ[1] != '/')
>> +           templ++;
>> +         templ += 2;
>
> Same problem about moving past '\0' here.  But the break condition would
> stop on things like "*]" or "//", not just "*/".  I think it should be:
>
>    for (; templ[0] != 0; ++templ)
>      if (templ[0] == '*' && templ[1] == '/')
>        {
>          templ += 2;
>          break;
>        }

Actually, I guess it should be:

   while (templ[0] != '*' || templ[1] != '/')
     {
       if (templ[0] == 0)
         fatal_at (loc, "unterminated '/*'");
       templ++;
     }
   templ += 2;

so that we don't accept unterminated /*.

Thanks,
Richard

Reply via email to