"Fossies" - the Fresh Open Source Software Archive

Member "julia-1.1.1/include/julia/platform.h" (16 May 2019, 3379 Bytes) of package /linux/misc/julia-1.1.1-linux-i686.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // This file is a part of Julia. License is MIT: https://julialang.org/license
    2 
    3 #ifndef JL_PLATFORM_H
    4 #define JL_PLATFORM_H
    5 
    6 /*
    7  * This file provides convenient macros to be used to identify the platform
    8  * based of compiler-specific pre-defined macros. It is based on the
    9  * information that can be found at the following address:
   10  *
   11  *     http://sourceforge.net/p/predef/wiki/Home/
   12  *
   13  * Possible values include:
   14  *      Compiler:
   15  *          _COMPILER_CLANG_
   16  *          _COMPILER_GCC_
   17  *          _COMPILER_INTEL_
   18  *          _COMPILER_MICROSOFT_
   19  *          _COMPILER_MINGW_
   20  *      OS:
   21  *          _OS_FREEBSD_
   22  *          _OS_LINUX_
   23  *          _OS_WINDOWS_
   24  *          _OS_DARWIN_
   25  *
   26  *      CPU/Architecture:
   27  *          _CPU_X86_
   28  *          _CPU_X86_64_
   29  *          _CPU_ARM_
   30  */
   31 
   32 /*******************************************************************************
   33 *                               Compiler                                       *
   34 *******************************************************************************/
   35 
   36 /*
   37  * Notes:
   38  *
   39  *  1. Checking for Intel's compiler should be done before checking for
   40  * Microsoft's. On Windows Intel's compiler also defines _MSC_VER as the
   41  * acknoledgement of the fact that it is integrated with Visual Studio.
   42  *
   43  *  2. Checking for MinGW should be done before checking for GCC as MinGW
   44  * pretends to be GCC.
   45  */
   46 #if defined(__clang__)
   47 #define _COMPILER_CLANG_
   48 // Clang can also be used as a MinGW compiler
   49 #if defined(__MINGW32__)
   50 #define _COMPILER_MINGW_
   51 #endif
   52 #elif defined(__INTEL_COMPILER) || defined(__ICC)
   53 #define _COMPILER_INTEL_
   54 #elif defined(__MINGW32__)
   55 #define _COMPILER_MINGW_
   56 #elif defined(_MSC_VER)
   57 #define _COMPILER_MICROSOFT_
   58 #elif defined(__GNUC__)
   59 #define _COMPILER_GCC_
   60 #endif
   61 
   62 /*******************************************************************************
   63 *                               OS                                             *
   64 *******************************************************************************/
   65 
   66 #if defined(__FreeBSD__)
   67 #define _OS_FREEBSD_
   68 #elif defined(__linux__)
   69 #define _OS_LINUX_
   70 #elif defined(_WIN32) || defined(_WIN64)
   71 #define _OS_WINDOWS_
   72 #elif defined(__APPLE__) && defined(__MACH__)
   73 #define _OS_DARWIN_
   74 #endif
   75 
   76 /*******************************************************************************
   77 *                               Architecture                                   *
   78 *******************************************************************************/
   79 
   80 #if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
   81 #define _CPU_X86_64_
   82 #elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(_X86_)
   83 #define _CPU_X86_
   84 #elif defined(__aarch64__)
   85 #define _CPU_AARCH64_
   86 #elif defined(__arm__) || defined(_M_ARM)
   87 #define _CPU_ARM_
   88 #elif defined(__PPC64__)
   89 #define _CPU_PPC64_
   90 #elif defined(_ARCH_PPC)
   91 #define _CPU_PPC_
   92 #endif
   93 
   94 #if defined(_CPU_X86_64_)
   95 #  define _P64
   96 #elif defined(_CPU_X86_)
   97 #  define _P32
   98 #elif defined(_OS_WINDOWS_)
   99 /* Not sure how to determine pointer size on Windows running ARM. */
  100 #  if _WIN64
  101 #    define _P64
  102 #  else
  103 #    define _P32
  104 #  endif
  105 #elif __SIZEOF_POINTER__ == 8
  106 #    define _P64
  107 #elif __SIZEOF_POINTER__ == 4
  108 #    define _P32
  109 #else
  110 #  error pointer size not known for your platform / compiler
  111 #endif
  112 
  113 #endif /* !PLATFORM_H */