瀏覽代碼

Fix bug (and test) for an invocation using macro name as a non-macro argument

This adds a second shift/reduce conflict to our grammar. It's basically the
same conflict we had previously, (deciding to shift a '(' after a FUNC_MACRO)
but this time in the "argument" context rather than the "content" context.

It would be nice to not have these, but I think they are unavoidable
(withotu a lot of pain at least) given the preprocessor specification.
tags/mesa-7.9-rc1
Carl Worth 15 年之前
父節點
當前提交
69f390d609
共有 2 個檔案被更改,包括 11 行新增1 行删除
  1. 9
    1
      glcpp-parse.y
  2. 2
    0
      tests/034-define-func-self-compose-non-func.c

+ 9
- 1
glcpp-parse.y 查看文件

@@ -103,8 +103,12 @@ _argument_list_member_at (argument_list_t *list, int index);
* 1. '(' after FUNC_MACRO name which is correctly resolved to shift
* to form macro invocation rather than reducing directly to
* content.
*
* 2. Similarly, '(' after FUNC_MACRO which is correctly resolved to
* shift to form macro invocation rather than reducing directly to
* argument.
*/
%expect 1
%expect 2

%%

@@ -168,6 +172,10 @@ argument:
| macro {
$$ = _string_list_create (parser);
}
| FUNC_MACRO {
$$ = _string_list_create (parser);
_string_list_append_item ($$, $1);
}
| argument word {
_string_list_append_item ($1, $2);
talloc_free ($2);

+ 2
- 0
tests/034-define-func-self-compose-non-func.c 查看文件

@@ -0,0 +1,2 @@
#define foo(bar) bar
foo(foo)

Loading…
取消
儲存