如何修复解析器生成器返回的变量的 GCC 类型警告?

How to fix GCC type warning on variable returned by the parser generator?

我希望 Packcc 解析器生成器“$0s”或“$0e”变量在解析器操作中抛出一个 int,因为这些变量代表输入中的一个位置。

我做了一个最小的解析器,它打印单词最后一个字符的位置。

word <- [a-z]+[\n]    {printf("Position %i\n", [=10=]e);}

%%

int main()
{
    pcc_context_t *ctx = pcc_create(NULL);
    while(pcc_parse(ctx, NULL));
    pcc_destroy(ctx);
    return 0;
}

在使用“packcc”命令生成解析器后,我编译了 C 生成的文件,然后 Gcc 发送了这个警告。

warning: type defaults to 'int' in type name [-Wimplicit-int]

提前致谢。

这看起来像是那个版本的 packcc 解析器生成器中的错误。现在是 fixed master,所以请尝试升级。

或者您可以简单地忽略警告,因为类型确实应该是 int