intel/executor: allow single line comments in macro lines
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

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:
Caio Oliveira 2025-06-23 13:22:56 -07:00 committed by Marge Bot
parent d14fa6683b
commit 30490de24a

View file

@ -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 *