[PATCH] A couple minor changes to support sanitizers on FreeBSD 9.2

Viktor Kutuzov vkutuzov at accesssoftek.com
Mon Mar 17 04:39:46 PDT 2014


  > Where is size_t defined in sanitizer sources?

  I probably misworded the reference to sanitizers sources. The point is that clang has its own set of headers it use in place of the system ones (see /tools/clang/lib/Headers). One of the headers--<stddef.h>, namely--define 'size_t' as:

    typedef __SIZE_TYPE__ size_t;

  which is the correct definition on all platforms, but conflicts with the incorrect one:

    // <machine/_types.h>
    typedef __uint64_t __size_t;

    // <sys/types.h>
    #ifndef _SIZE_T_DECLARED
    typedef __size_t size_t;
    #define _SIZE_T_DECLARED
    #endif

  on FreeBSD 9.2 in 32-bit mode (-m32). Depending on which of the headers--the system or the clang's one--is included first 'size_t' is defined as 'unsigned int' or 'unsigned long'. Tracking potential [indirect] inclusions of <sys/types.h> doesn't seem to be trivial so I see two alternatives: either define _SIZE_T_DECLARED in all test sources before any #includes or put -D_SIZE_T_DECLARED to the CMakeLists.txt files.

http://llvm-reviews.chandlerc.com/D3031



More information about the llvm-commits mailing list