mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
intel/executor: allow single line comments in macro lines
Assembler supports them, so allow them on @-macro lines. For now we don't bother with multiline comments, if becomes a thing we can add them later. Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35699>
This commit is contained in:
parent
d14fa6683b
commit
30490de24a
1 changed files with 11 additions and 4 deletions
|
|
@ -24,6 +24,13 @@ skip_prefix(char *prefix, char *start)
|
|||
return c;
|
||||
}
|
||||
|
||||
static bool
|
||||
is_comment(const char *c)
|
||||
{
|
||||
assert(c);
|
||||
return c[0] && c[0] == '/' && c[1] == '/';
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
char **args;
|
||||
int count;
|
||||
|
|
@ -38,12 +45,12 @@ parse_args(void *mem_ctx, char *c)
|
|||
/* Skip spaces. */
|
||||
while (*c && isspace(*c))
|
||||
c++;
|
||||
if (!*c)
|
||||
|
||||
if (!*c || is_comment(c))
|
||||
break;
|
||||
|
||||
/* Copy non-spaces. */
|
||||
char *start = c;
|
||||
while (*c && !isspace(*c))
|
||||
while (*c && !isspace(*c) && !is_comment(c))
|
||||
c++;
|
||||
r.args = reralloc_array_size(mem_ctx, r.args, sizeof(char *), r.count + 1);
|
||||
r.args[r.count++] = ralloc_strndup(mem_ctx, start, c - start);
|
||||
|
|
@ -360,7 +367,7 @@ match_macro_name(const char *name, const char *line)
|
|||
if (!startswith(name, line))
|
||||
return false;
|
||||
line += strlen(name);
|
||||
return !*line || isspace(*line);
|
||||
return !*line || isspace(*line) || is_comment(line);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue