xiaoxiang781216 commented on a change in pull request #2222:
URL: https://github.com/apache/incubator-nuttx/pull/2222#discussion_r526558013



##########
File path: arch/sim/include/inttypes.h
##########
@@ -44,7 +44,7 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#if defined(CONFIG_HOST_MACOS)
+#if defined(CONFIG_HOST_MACOS) && defined(__APPLE_CC__) || !defined(_LP64)

Review comment:
       If I undersand correctly, macOS has two cases:
   
   1. Compile the image with clang(__INT64_TYPE__ == long long)
   2. Compile the module with gcc(__INT64_TYPE__ == long)
   
   In the first case, both CONFIG_HOST_MACOS and __APPLE_CC__ are defined
   In the second case, CONFIG_HOST_MACOS is defined, but __APPLE_CC__ isn't.
   So the following definition should be good:
   ```
   #if defined(__APPLE_CC__)
    typedef signed long long   _int64_t;
    typedef unsigned long long _uint64_t;
   #else
    typedef signed long        _int64_t;
    typedef unsigned long      _uint64_t;
   #endif
   ```
   If we consider Linux 32bit mode(__INT64_TYPE__ == long long), it become:
   ```
   #if defined(__APPLE_CC__) || !defined(_LP64)
    typedef signed long long   _int64_t;
    typedef unsigned long long _uint64_t;
   #else
    typedef signed long        _int64_t;
    typedef unsigned long      _uint64_t;
   #endif
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to