retarget: Added workaround for conflicting definitions of error_t

The errno.h header file defines the type error_t, unfortunately this
is a common type name that may be defined in user code. For at least GCC
we can work around this by telling errno that the error_t is already
defined.
pull/6336/head
Christopher Haster 2018-05-17 10:24:46 -05:00
parent 78992a4c26
commit effdc6571b
1 changed files with 11 additions and 0 deletions

View File

@ -26,7 +26,18 @@
#endif //__cplusplus
#include <stdint.h>
#include <stddef.h>
/* Include logic for errno so we can get errno defined but not bring in error_t,
* including errno here prevents an include later, which would redefine our
* error codes
*/
#ifndef __error_t_defined
#define __error_t_defined 1
#include <errno.h>
#undef __error_t_defined
#else
#include <errno.h>
#endif
/* We can get the following standard types from sys/types for gcc, but we
* need to define the types ourselves for the other compilers that normally