MAC OS X Weirdness

  1. Include the following at the top of your C file to get past CIL not properly handling some OS X extensions:

    #ifdef __APPLE__
    #include<Availability.h>
    #undef __OSX_AVAILABLE_STARTING
    #define __OSX_AVAILABLE_STARTING(_mac, _iphone)
    #undef __OSX_AVAILABLE_BUT_DEPRECATED
    #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
    #undef __OSX_AVAILABLE_BUT_DEPRECATED_MSG
    #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
    #undef __BLOCKS__
    #endif
    
    or, if you're running Sierra,
     #ifdef __APPLE__
    #include<Availability.h>
    #include<sys/cdefs.h>
    #undef __OSX_AVAILABLE_STARTING
    #define __OSX_AVAILABLE_STARTING(_mac, _iphone)
    #undef __OSX_AVAILABLE_BUT_DEPRECATED
    #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
    #undef __OSX_AVAILABLE_BUT_DEPRECATED_MSG
    #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
    #undef __OSX_DEPRECATED
    #define __OSX_DEPRECATED(_start, _dep, _msg)
    #undef __IOS_DEPRECATED
    #define __IOS_DEPRECATED(_start, _dep, _msg)
    #undef __TVOS_DEPRECATED
    #define __TVOS_DEPRECATED(_start, _dep, _msg)
    #undef __WATCHOS_DEPRECATED
    #define __WATCHOS_DEPRECATED(_start, _dep, _msg)
    #undef __OSX_AVAILABLE
    #define __OSX_AVAILABLE(_arg)
    #undef __IOS_AVAILABLE
    #define __IOS_AVAILABLE(_arg)
    #undef __TVOS_AVAILABLE
    #define __TVOS_AVAILABLE(_arg)
    #undef __WATCHOS_AVAILABLE
    #define __WATCHOS_AVAILABLE(_arg)
    #undef __OSX_PROHIBITED
    #define __OSX_PROHIBITED
    #undef __IOS_PROHIBITED
    #define __IOS_PROHIBITED
    #undef __TVOS_PROHIBITED
    #define __TVOS_PROHIBITED
    #undef __WATCHOS_PROHIBITED
    #define __WATCHOS_PROHIBITED
    #undef __OS_AVAILABILITY_MSG
    #define __OS_AVAILABILITY_MSG(a,b,c)
    #undef __BLOCKS__
    #undef _Nullable
    #define _Nullable
    #undef _Nonnull
    #define _Nonnull
    #undef __swift_unavailable
    #define __swift_unavailable(_msg)
    #endif
    
    or run Tigress with
    tigress -include $TIGRESS_HOME/apple.h --Transform=...
    
    If you know how to automatically strip out all Apple-specific #defines, please let me know...
  2. Compile with

    -fgnu89-inline  
    

    to get past a redeclaration bug in MAC OS 10.9. For an explanation, see, for example, http//sourceforge.net/p/resil/tickets/6.

  3. Compile with

    -Wno-builtin-requires-header 
    

    to avoid a spurious warning generated by clang.

 

32-vs-64-bit machine models

By default, we assume you're generating code for the machine on which you execute Tigress on. If this is not the case, in particular, if your target machine has a different wordsize, you must

  1. set this environment variable with the relevant C type sizes

    CIL_MACHINE="short=2,2 int=4,4 long=4,4 long_long=8,8 pointer=4,4 \
                 alignof_enum=4 float=4,4 double=8,8 long_double=12,12 \
                 void=1 bool=1,1 fun=1,1 alignof_string=1 max_alignment=16 \
                 size_t=unsigned_int wchar_t=int char_signed=true const_string_literals=true \
                 big_endian=false __thread_is_keyword=true __builtin_va_list=true \
                 underscore_name=true";export CIL_MACHINE;
    
  2. run Tigress with the --envmachine option.

For the current version of Tigress, this is really only relevant for the virtualize transformation. See the CIL documentation for more information.

 

CIL Weirdness

CIL (and hence Tigress), fails on the following: