Print this page
12257 resync smatch to 0.6.1-rc1-il-4


1551 
1552                 va_start(ap, fmt);
1553                 vsnprintf(buf, sizeof(buf), fmt, ap);
1554                 va_end(ap);
1555 
1556                 value = __alloc_token(0);
1557                 if (isdigit(buf[0])) {
1558                         token_type(value) = TOKEN_NUMBER;
1559                         value->number = xstrdup(buf);
1560                 } else {
1561                         token_type(value) = TOKEN_IDENT;
1562                         value->ident = built_in_ident(buf);
1563                 }
1564                 value->pos.whitespace = 1;
1565                 value->next = &eof_token_entry;
1566         }
1567 
1568         do_define(value->pos, NULL, ident, NULL, value, attr);
1569 }
1570 








1571 static int do_handle_define(struct stream *stream, struct token **line, struct token *token, int attr)
1572 {
1573         struct token *arglist, *expansion;
1574         struct token *left = token->next;
1575         struct ident *name;
1576 
1577         if (token_type(left) != TOKEN_IDENT) {
1578                 sparse_error(token->pos, "expected identifier to 'define'");
1579                 return 1;
1580         }
1581 
1582         name = left->ident;
1583 
1584         arglist = NULL;
1585         expansion = left->next;
1586         if (!expansion->pos.whitespace) {
1587                 if (match_op(expansion, '(')) {
1588                         arglist = expansion;
1589                         expansion = parse_arguments(expansion);
1590                         if (!expansion)




1551 
1552                 va_start(ap, fmt);
1553                 vsnprintf(buf, sizeof(buf), fmt, ap);
1554                 va_end(ap);
1555 
1556                 value = __alloc_token(0);
1557                 if (isdigit(buf[0])) {
1558                         token_type(value) = TOKEN_NUMBER;
1559                         value->number = xstrdup(buf);
1560                 } else {
1561                         token_type(value) = TOKEN_IDENT;
1562                         value->ident = built_in_ident(buf);
1563                 }
1564                 value->pos.whitespace = 1;
1565                 value->next = &eof_token_entry;
1566         }
1567 
1568         do_define(value->pos, NULL, ident, NULL, value, attr);
1569 }
1570 
1571 ///
1572 // like predefine() but only if one of the non-standard dialect is chosen
1573 void predefine_nostd(const char *name)
1574 {
1575         if ((standard & STANDARD_GNU) || (standard == STANDARD_NONE))
1576                 predefine(name, 1, "1");
1577 }
1578 
1579 static int do_handle_define(struct stream *stream, struct token **line, struct token *token, int attr)
1580 {
1581         struct token *arglist, *expansion;
1582         struct token *left = token->next;
1583         struct ident *name;
1584 
1585         if (token_type(left) != TOKEN_IDENT) {
1586                 sparse_error(token->pos, "expected identifier to 'define'");
1587                 return 1;
1588         }
1589 
1590         name = left->ident;
1591 
1592         arglist = NULL;
1593         expansion = left->next;
1594         if (!expansion->pos.whitespace) {
1595                 if (match_op(expansion, '(')) {
1596                         arglist = expansion;
1597                         expansion = parse_arguments(expansion);
1598                         if (!expansion)