Lines Matching defs:arg
311 struct arg {
312 struct token *arg;
320 static int collect_arguments(struct token *start, struct token *arglist, struct arg *args, struct token *what)
345 args[count].arg = start->next;
361 args[count].arg = NULL;
437 static struct token *stringify(struct token *arg)
439 const char *s = show_token_sequence(arg, 1);
446 token->pos = arg->pos;
453 static void expand_arguments(int count, struct arg *args)
457 struct token *arg = args[i].arg;
458 if (!arg)
459 arg = &eof_token_entry;
461 args[i].str = stringify(arg);
464 args[i].expanded = arg;
465 args[i].arg = NULL;
466 } else if (eof_token(arg)) {
467 args[i].expanded = arg;
469 args[i].expanded = dup_list(arg);
621 static int handle_kludge(struct token **p, struct arg *args)
625 struct arg *v = &args[t->argnum];
627 if (v->arg) {
636 if (v->arg && !eof_token(v->arg))
642 static struct token **substitute(struct token **list, struct token *body, struct arg *args)
649 struct token *added, *arg;
660 * an arbitrary number of ##<arg> in between; if all of
678 arg = args[body->argnum].str;
683 arg = args[body->argnum].arg;
685 if (!arg || eof_token(arg)) {
695 arg = args[body->argnum].expanded;
697 if (eof_token(arg)) {
702 tail = copy(&added, arg, count);
753 struct arg args[nargs];
1088 struct token *arg = list->next, *next = list;
1093 if (match_op(arg, ')')) {
1094 next = arg->next;
1099 while (token_type(arg) == TOKEN_IDENT) {
1100 if (arg->ident == &__VA_ARGS___ident)
1104 next = arg->next;
1108 arg = next->next;
1115 arg->next->next = &eof_token_entry;
1126 arg->next->next = &eof_token_entry;
1130 arg = next;
1137 arg = next;
1142 if (match_op(arg, SPECIAL_ELLIPSIS)) {
1143 next = arg->next;
1144 token_type(arg) = TOKEN_IDENT;
1145 arg->ident = &__VA_ARGS___ident;
1153 arg->next->next = &eof_token_entry;
1157 if (eof_token(arg)) {
1158 arg = next;
1161 if (match_op(arg, ','))
1168 sparse_error(arg->pos, "parameter name missing");
1171 sparse_error(arg->pos, "\"%s\" may not appear in macro parameter list",
1172 show_token(arg));
1175 sparse_error(arg->pos, "missing ')' in macro parameter list");
1178 sparse_error(arg->pos, "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro");
1181 sparse_error(arg->pos, "too many arguments in macro definition");
1570 int arg;
1572 arg = token_defined(next);
1577 arg = -1;
1579 return preprocessor_if(stream, token, arg);
1585 int arg;
1596 arg = !token_defined(next);
1601 arg = -1;
1604 return preprocessor_if(stream, token, arg);
1982 static bool expand_has_attribute(struct token *token, struct arg *args)
1984 struct token *arg = args[0].expanded;
1987 if (token_type(arg) != TOKEN_IDENT) {
1988 sparse_error(arg->pos, "identifier expected");
1992 sym = lookup_symbol(arg->ident, NS_KEYWORD);
1997 static bool expand_has_builtin(struct token *token, struct arg *args)
1999 struct token *arg = args[0].expanded;
2002 if (token_type(arg) != TOKEN_IDENT) {
2003 sparse_error(arg->pos, "identifier expected");
2007 sym = lookup_symbol(arg->ident, NS_SYMBOL);
2012 static bool expand_has_extension(struct token *token, struct arg *args)
2014 struct token *arg = args[0].expanded;
2018 if (token_type(arg) != TOKEN_IDENT) {
2019 sparse_error(arg->pos, "identifier expected");
2023 ident = arg->ident;
2037 static bool expand_has_feature(struct token *token, struct arg *args)
2039 struct token *arg = args[0].expanded;
2043 if (token_type(arg) != TOKEN_IDENT) {
2044 sparse_error(arg->pos, "identifier expected");
2048 ident = arg->ident;
2133 bool (*expand)(struct token *, struct arg *args);