铛。如何克服“未知内置”错误信息

时间:2013-08-18 12:34:20

标签: c++ c gcc compiler-construction clang

我有一个程序设置clang编译器实例并使用HeaderSearchOptions类添加包含路径。当我在输入文件libavutil / samplefmt.c(来自ffmpeg包)上运行ParseAst时,我在屏幕上看到以下消息。基本上,它无法解析一些(gcc?)内置函数。我该如何摆脱这个错误?通常,如果设置包含通过HeaderSearchOptions的路径,我如何确保我不会错过我的gcc安装中的所有包含路径?

谢谢!

#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/include/freetype2
 /usr/include/fribidi
 /usr/local/include
 /usr/include/clang/Basic
 /opt/llvmrelease/bin/../lib/clang/3.4/include
 /usr/include/i386-linux-gnu
 /include
 /usr/include
End of search list.
In file included from libavutil/samplefmt.c:19:
libavutil/common.h:258:12: error: use of unknown builtin '__builtin_clz'
    return av_log2((x - 1) << 1); 
           ^
libavutil/intmath.h:89:23: note: expanded from macro 'av_log2'
#define av_log2       ff_log2
                      ^
libavutil/intmath.h:45:29: note: expanded from macro 'ff_log2'
#   define ff_log2(x) (31 - __builtin_clz((x)|1))
                            ^
libavutil/samplefmt.c:59:14: error: use of unknown builtin '__builtin_strlen'
        if (!strcmp(sample_fmt_info[i].name, name))
             ^
/usr/include/i386-linux-gnu/bits/string2.h:804:22: note: expanded from macro 'strcmp'
      && (__s1_len = __builtin_strlen (s1), __s2_len = __builtin_strlen (s2), \
                     ^
libavutil/samplefmt.c:59:14: note: did you mean '__builtin_strchr'?
/usr/include/i386-linux-gnu/bits/string2.h:804:22: note: expanded from macro 'strcmp'
      && (__s1_len = __builtin_strlen (s1), __s2_len = __builtin_strlen (s2), \
                     ^
libavutil/samplefmt.c:59:14: error: use of unknown builtin '__builtin_strcmp'
        if (!strcmp(sample_fmt_info[i].name, name))
             ^
/usr/include/i386-linux-gnu/bits/string2.h:807:9: note: expanded from macro 'strcmp'

1 个答案:

答案 0 :(得分:4)

当您完成项目配置时,某些事情一定很有趣。例如,ff_log2代码位于:

#if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4)

所以你需要确保没有定义HAVE_FAST_CLZ,你应该在这方面做得好。您可以执行类似操作来修复strcmp