xiaoxiang781216 commented on code in PR #6482: URL: https://github.com/apache/incubator-nuttx/pull/6482#discussion_r906643219
########## include/nuttx/compiler.h: ########## @@ -69,10 +77,30 @@ # undef CONFIG_HAVE_CXX14 #endif +#if defined(__cplusplus) && __cplusplus >= 201703L Review Comment: move to other patch ########## include/endian.h: ########## @@ -51,23 +51,41 @@ /* Common byte swapping macros */ -#define __SWAP_UINT16_ISMACRO 1 -#undef __SWAP_UINT32_ISMACRO - -#ifdef __SWAP_UINT16_ISMACRO +#ifdef CONFIG_HAVE_BUILTIN_BSWAP16 +# define __swap_uint16 __builtin_bswap16 +#else # define __swap_uint16(n) \ (uint16_t)(((((uint16_t)(n)) & 0x00ff) << 8) | \ ((((uint16_t)(n)) >> 8) & 0x00ff)) #endif -#ifdef __SWAP_UINT32_ISMACRO +#ifdef CONFIG_HAVE_BUILTIN_BSWAP32 +# define __swap_uint32 __builtin_bswap32 +#else # define __swap_uint32(n) \ (uint32_t)(((((uint32_t)(n)) & 0x000000ffUL) << 24) | \ ((((uint32_t)(n)) & 0x0000ff00UL) << 8) | \ ((((uint32_t)(n)) & 0x00ff0000UL) >> 8) | \ ((((uint32_t)(n)) & 0xff000000UL) >> 24)) #endif +#ifdef CONFIG_HAVE_LONG_LONG +#ifdef CONFIG_HAVE_BUILTIN_BSWAP64 Review Comment: let's indent the inner #ifdef/#else/#endif by two spaces ########## include/nuttx/compiler.h: ########## @@ -61,6 +61,14 @@ # define CONFIG_C99_BOOL 1 #endif +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define CONFIG_C11_BOOL 1 +#endif + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201710L +# define CONFIG_C17_BOOL 1 Review Comment: it's better to create a new patch and PR instead ########## libs/libc/string/lib_ffsl.c: ########## @@ -48,14 +48,15 @@ * 0, then ffsl() will return 0. * ****************************************************************************/ - Review Comment: revert ########## include/netinet/in.h: ########## @@ -217,26 +217,14 @@ /* This macro to convert a 16/32-bit constant values quantity from host byte * order to network byte order. The 16-bit version of this macro is required * for uIP: - * - * Author Adam Dunkels <a...@dunkels.com> - * Copyright (c) 2001-2003, Adam Dunkels. - * All rights reserved. */ #ifdef CONFIG_ENDIAN_BIG -# define HTONS(ns) (ns) -# define HTONL(nl) (nl) +# define HTONS(ns) (ns) +# define HTONL(nl) (nl) #else -# define HTONS(ns) \ - (unsigned short) \ - (((((unsigned short)(ns)) & 0x00ff) << 8) | \ - ((((unsigned short)(ns)) >> 8) & 0x00ff)) -# define HTONL(nl) \ - (unsigned long) \ - (((((unsigned long)(nl)) & 0x000000ffUL) << 24) | \ - ((((unsigned long)(nl)) & 0x0000ff00UL) << 8) | \ - ((((unsigned long)(nl)) & 0x00ff0000UL) >> 8) | \ - ((((unsigned long)(nl)) & 0xff000000UL) >> 24)) +# define HTONS __swap_uint16 Review Comment: need include endian.h at the beginning. ########## libs/libc/string/lib_ffs.c: ########## @@ -48,14 +48,15 @@ * 0, then ffs() will return 0. * ****************************************************************************/ - Review Comment: revert the change -- 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. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org