VirtualBox

Changeset 103001 in vbox


Ignore:
Timestamp:
Jan 23, 2024 4:00:43 PM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161233
Message:

iprt/assertcompile.h,iprt/stdint.h: Made these header usable with the assemlber on darwin/arm64. bugref:10376

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/assertcompile.h

    r99791 r103001  
    5656 */
    5757
     58
    5859/**
    5960 * RTASSERTTYPE is the type the AssertCompile() macro redefines.
     
    6162 * Visual C++ uses this.
    6263 */
     64#ifndef __ASSEMBLER__
    6365typedef int RTASSERTTYPE[1];
     66#endif
    6467
    6568/**
     
    7679 * for 4.x+ to prevent linkage confusion.
    7780 */
    78 #if !defined(__cplusplus) || !defined(__GNUC__)
     81#ifndef __ASSEMBLER__
     82# if !defined(__cplusplus) || !defined(__GNUC__)
    7983extern int RTASSERTVAR[1];
    80 #elif RT_GNUC_PREREQ(4, 0) || defined(__clang_major__) /* Not sure when they fixed the global scoping __unused__/whatever problem. */
     84# elif RT_GNUC_PREREQ(4, 0) || defined(__clang_major__) /* Not sure when they fixed the global scoping __unused__/whatever problem. */
    8185RT_C_DECLS_BEGIN
    8286extern int RTASSERTVAR[1];
    8387RT_C_DECLS_END
     88# endif
    8489#endif
    8590
     
    8792 * Indicates that the compiler implements static_assert(expr, msg).
    8893 */
    89 #ifdef _MSC_VER
    90 # if _MSC_VER >= 1600 && defined(__cplusplus) && !defined(VBOX_WITH_PARFAIT)
     94#ifndef __ASSEMBLER__
     95# ifdef _MSC_VER
     96#  if _MSC_VER >= 1600 && defined(__cplusplus) && !defined(VBOX_WITH_PARFAIT)
    9197#  define RTASSERT_HAVE_STATIC_ASSERT
    92 # endif
    93 #endif
    94 #if defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
    95 # define RTASSERT_HAVE_STATIC_ASSERT
    96 #endif
    97 #if RT_CLANG_PREREQ(6, 0)
    98 # if __has_feature(cxx_static_assert) || __has_feature(c_static_assert)
     98#  endif
     99# endif
     100# if defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
    99101#  define RTASSERT_HAVE_STATIC_ASSERT
     102# endif
     103# if RT_CLANG_PREREQ(6, 0)
     104#  if __has_feature(cxx_static_assert) || __has_feature(c_static_assert)
     105#   define RTASSERT_HAVE_STATIC_ASSERT
     106#  endif
    100107# endif
    101108#endif
     
    112119 * @param   expr    Expression which should be true.
    113120 */
    114 #ifdef __GNUC__
     121#ifdef __ASSEMBLER__
     122# define AssertCompileNS(expr)
     123#elif defined(__GNUC__)
    115124# define AssertCompileNS(expr)  AssertCompileNS2(expr,RTASSERTVAR)
    116125# define AssertCompileNS2(expr,a_VarName)   extern int a_VarName[         1    ] __attribute__((__unused__)), \
  • trunk/include/iprt/stdint.h

    r98103 r103001  
    5454  && !defined(IPRT_NO_CRT) \
    5555  && !defined(IPRT_DONT_USE_SYSTEM_STDINT_H) \
    56   && !defined(DOXYGEN_RUNNING)
     56  && !defined(DOXYGEN_RUNNING) \
     57  && !defined(__ASSEMBLER__)
    5758
    5859# ifndef __STDC_CONSTANT_MACROS
     
    8485# endif /* 64-bit darwin kludge. */
    8586
    86 #elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
     87#elif defined(RT_OS_FREEBSD) && defined(_KERNEL) && !defined(__ASSEMBLER__)
    8788
    8889# ifndef __STDC_CONSTANT_MACROS
     
    9495# include <sys/stdint.h>
    9596
    96 #elif defined(RT_OS_NETBSD) && defined(_KERNEL)
     97#elif defined(RT_OS_NETBSD) && defined(_KERNEL) && !defined(__ASSEMBLER__)
    9798
    9899# ifndef __STDC_CONSTANT_MACROS
     
    132133   || defined(RT_ARCH_ARM32) || defined(RT_ARCH_ARM64) \
    133134   || defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
    134 #   if !defined(_INT8_T_DECLARED)   && !defined(_INT8_T)
     135#   ifndef __ASSEMBLER__
     136#    if !defined(_INT8_T_DECLARED)   && !defined(_INT8_T)
    135137typedef signed char         int8_t;
    136 #   endif
    137 #   if !defined(_UINT8_T_DECLARED)  && !defined(_UINT8_T)
     138#    endif
     139#    if !defined(_UINT8_T_DECLARED)  && !defined(_UINT8_T)
    138140typedef unsigned char       uint8_t;
    139 #   endif
    140 #   if !defined(_INT16_T_DECLARED)  && !defined(_INT16_T)
     141#    endif
     142#    if !defined(_INT16_T_DECLARED)  && !defined(_INT16_T)
    141143typedef signed short        int16_t;
    142 #   endif
    143 #   if !defined(_UINT16_T_DECLARED) && !defined(_UINT16_T)
     144#    endif
     145#    if !defined(_UINT16_T_DECLARED) && !defined(_UINT16_T)
    144146typedef unsigned short      uint16_t;
    145 #   endif
    146 #   if !defined(_INT32_T_DECLARED)  && !defined(_INT32_T)
    147 #    if ARCH_BITS != 16
     147#    endif
     148#    if !defined(_INT32_T_DECLARED)  && !defined(_INT32_T)
     149#     if ARCH_BITS != 16
    148150typedef signed int          int32_t;
    149 #    else
     151#     else
    150152typedef signed long         int32_t;
    151 #    endif
    152 #   endif
    153 #   if !defined(_UINT32_T_DECLARED) && !defined(_UINT32_T)
    154 #    if ARCH_BITS != 16
     153#     endif
     154#    endif
     155#    if !defined(_UINT32_T_DECLARED) && !defined(_UINT32_T)
     156#     if ARCH_BITS != 16
    155157typedef unsigned int        uint32_t;
    156 #    else
     158#     else
    157159typedef unsigned long       uint32_t;
    158 #    endif
    159 #   endif
    160 #   if defined(_MSC_VER)
    161 #    if !defined(_INT64_T_DECLARED)  && !defined(_INT64_T)
     160#     endif
     161#    endif
     162#    if defined(_MSC_VER)
     163#     if !defined(_INT64_T_DECLARED)  && !defined(_INT64_T)
    162164typedef signed _int64       int64_t;
    163 #    endif
    164 #    if !defined(_UINT64_T_DECLARED) && !defined(_UINT64_T)
     165#     endif
     166#     if !defined(_UINT64_T_DECLARED) && !defined(_UINT64_T)
    165167typedef unsigned _int64     uint64_t;
    166 #    endif
    167 #   elif defined(__WATCOMC__)
    168 #    if !defined(_INT64_T_DECLARED)  && !defined(_INT64_T)
     168#     endif
     169#    elif defined(__WATCOMC__)
     170#     if !defined(_INT64_T_DECLARED)  && !defined(_INT64_T)
    169171typedef signed __int64      int64_t;
    170 #    endif
    171 #    if !defined(_UINT64_T_DECLARED) && !defined(_UINT64_T)
     172#     endif
     173#     if !defined(_UINT64_T_DECLARED) && !defined(_UINT64_T)
    172174typedef unsigned __int64    uint64_t;
    173 #    endif
    174 #   elif defined(IPRT_STDINT_USE_STRUCT_FOR_64_BIT_TYPES)
    175 #    if !defined(_INT64_T_DECLARED)  && !defined(_INT64_T)
     175#     endif
     176#    elif defined(IPRT_STDINT_USE_STRUCT_FOR_64_BIT_TYPES)
     177#     if !defined(_INT64_T_DECLARED)  && !defined(_INT64_T)
    176178typedef struct { uint32_t lo; int32_t hi; }     int64_t;
    177 #    endif
    178 #    if !defined(_UINT64_T_DECLARED) && !defined(_UINT64_T)
     179#     endif
     180#     if !defined(_UINT64_T_DECLARED) && !defined(_UINT64_T)
    179181typedef struct { uint32_t lo; uint32_t hi; }    uint64_t;
    180 #    endif
    181 #   else /* Use long long for 64-bit types */
    182 #    if !defined(_INT64_T_DECLARED)  && !defined(_INT64_T)
     182#     endif
     183#    else /* Use long long for 64-bit types */
     184#     if !defined(_INT64_T_DECLARED)  && !defined(_INT64_T)
    183185typedef signed long long    int64_t;
    184 #    endif
    185 #    if !defined(_UINT64_T_DECLARED) && !defined(_UINT64_T)
     186#     endif
     187#     if !defined(_UINT64_T_DECLARED) && !defined(_UINT64_T)
    186188typedef unsigned long long  uint64_t;
    187 #    endif
    188 #   endif
     189#     endif
     190#    endif
    189191
    190192    /* max integer types */
    191 #   if !defined(_INTMAX_T_DECLARED)  && !defined(_INTMAX_T)
     193#    if !defined(_INTMAX_T_DECLARED)  && !defined(_INTMAX_T)
    192194typedef int64_t             intmax_t;
    193 #   endif
    194 #   if !defined(_UINTMAX_T_DECLARED) && !defined(_UINTMAX_T)
     195#    endif
     196#    if !defined(_UINTMAX_T_DECLARED) && !defined(_UINTMAX_T)
    195197typedef uint64_t            uintmax_t;
    196 #   endif
     198#    endif
     199#   endif  /* !__ASSEMBLER__ */
    197200
    198201    /* smallest minimum-width integer types - assumes to be the same as above! */
     202#   ifndef __ASSEMBLER__
    199203typedef int8_t              int_least8_t;
    200204typedef uint8_t             uint_least8_t;
     205#   endif
    201206#   define INT_LEAST8_MIN   INT8_MIN
    202207#   define INT_LEAST8_MAX   INT8_MAX
    203208#   define UINT_LEAST8_MAX  UINT8_MAX
     209#   ifndef __ASSEMBLER__
    204210typedef int16_t             int_least16_t;
    205211typedef uint16_t            uint_least16_t;
     212#   endif
    206213#   define INT_LEAST16_MIN  INT16_MIN
    207214#   define INT_LEAST16_MAX  INT16_MAX
    208215#   define UINT_LEAST16_MAX UINT16_MAX
     216#   ifndef __ASSEMBLER__
    209217typedef int32_t             int_least32_t;
    210218typedef uint32_t            uint_least32_t;
     219#   endif
    211220#   define INT_LEAST32_MIN  INT32_MIN
    212221#   define INT_LEAST32_MAX  INT32_MAX
    213222#   define UINT_LEAST32_MAX UINT32_MAX
     223#   ifndef __ASSEMBLER__
    214224typedef int64_t             int_least64_t;
    215225typedef uint64_t            uint_least64_t;
     226#   endif
    216227#   define INT_LEAST64_MIN  INT64_MIN
    217228#   define INT_LEAST64_MAX  INT64_MAX
     
    219230
    220231    /* fastest minimum-width integer types */
     232#   ifndef __ASSEMBLER__
    221233typedef signed char         int_fast8_t;
    222234typedef unsigned char       uint_fast8_t;
     235#   endif
    223236#   define INT_FAST8_MIN    INT8_MIN
    224237#   define INT_FAST8_MAX    INT8_MAX
    225238#   define UINT_FAST8_MAX   UINT8_MAX
     239#   ifndef __ASSEMBLER__
    226240typedef signed int          int_fast16_t;
    227241typedef unsigned int        uint_fast16_t;
     242#   endif
    228243#   if ARCH_BITS == 16
    229244#    define INT_FAST16_MIN  INT16_MIN
     
    235250#    define UINT_FAST16_MAX UINT32_MAX
    236251#   endif
     252#   ifndef __ASSEMBLER__
    237253typedef int32_t             int_fast32_t;
    238254typedef uint32_t            uint_fast32_t;
     255#   endif
    239256#   define INT_FAST32_MIN   INT32_MIN
    240257#   define INT_FAST32_MAX   INT32_MAX
    241258#   define UINT_FAST32_MAX  UINT32_MAX
     259#   ifndef __ASSEMBLER__
    242260typedef int64_t             int_fast64_t;
    243261typedef uint64_t            uint_fast64_t;
     262#   endif
    244263#   define INT_FAST64_MIN   INT64_MIN
    245264#   define INT_FAST64_MAX   INT64_MAX
     
    253272
    254273    /* pointer <-> integer types */
    255 # if (!defined(_MSC_VER) && !defined(__WATCOMC__)) || defined(DOXYGEN_RUNNING)
     274# if (!defined(_MSC_VER) && !defined(__WATCOMC__) && !defined(__ASSEMBLER__)) || defined(DOXYGEN_RUNNING)
    256275#  if ARCH_BITS == 32 \
    257276   || defined(RT_OS_LINUX) \
     
    271290#   endif
    272291#  endif
    273 # endif /* !_MSC_VER */
     292# endif /* !_MSC_VER && !__WATCOMC__ && !__ASSEMLBER__ */
    274293
    275294#endif /* no system stdint.h */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette