Skip to content

Commit

Permalink
Update C++ checks approach
Browse files Browse the repository at this point in the history
Signed-off-by: acuadros95 <acuadros1995@gmail.com>
  • Loading branch information
Acuadros95 committed Jul 10, 2023
1 parent 388befc commit ac34007
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions include/rosidl_dynamic_typesupport/uchar.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
extern "C" {
#endif


#if defined __has_include
# if __has_include(<uchar.h>)
# include <uchar.h>
# define INCLUDED_UCHAR 1
# endif
#endif
#if !defined(INCLUDED_UCHAR) && __cplusplus <= 199711L
#if defined(__cplusplus) && __cplusplus >= 201103L
// Nothing to do here, C++11 and beyond have char16_t as a keyword:
// https://en.cppreference.com/w/cpp/keyword/char16_t
#elif defined(__has_include) && __has_include(<uchar.h>)
// If the compiler has __has_include, and uchar.h exists, include that as it will have char16_t
// as a typedef.
# include <uchar.h>
#else
// Otherwise assume that char16_t isn't defined anywhere, and define it ourselves as uint_least16_t.
# include <stdint.h>
typedef uint_least16_t char16_t;
#endif
Expand Down

0 comments on commit ac34007

Please sign in to comment.