You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue should be easy to reproduce by just creating a importer.c file with a single line:
#include<inttypes.h>
Compiling that file will produce the following errors:
In file included from /home/guberti/Desktop/demonstrate_inttypes_bug/importer.c:1:0:
/home/guberti/.arduino15/packages/SPRESENSE/tools/spresense-sdk/2.2.1/spresense/release/nuttx/include/inttypes.h:185:31: error: unknown type name 'wchar_t'
intmax_t wcstoimax(FAR const wchar_t *nptr, FAR wchar_t **endptr, int base);
^
/home/guberti/.arduino15/packages/SPRESENSE/tools/spresense-sdk/2.2.1/spresense/release/nuttx/include/inttypes.h:185:50: error: unknown type name 'wchar_t'
intmax_t wcstoimax(FAR const wchar_t *nptr, FAR wchar_t **endptr, int base);
^
/home/guberti/.arduino15/packages/SPRESENSE/tools/spresense-sdk/2.2.1/spresense/release/nuttx/include/inttypes.h:186:31: error: unknown type name 'wchar_t'
uintmax_t wcstoumax(FAR const wchar_t *nptr, FAR wchar_t **endptr, int base);
^
/home/guberti/.arduino15/packages/SPRESENSE/tools/spresense-sdk/2.2.1/spresense/release/nuttx/include/inttypes.h:186:50: error: unknown type name 'wchar_t'
uintmax_t wcstoumax(FAR const wchar_t *nptr, FAR wchar_t **endptr, int base);
^
/**************************************************************************** * Included Files ****************************************************************************/#include<stddef.h>/* for wchar_t */
However, for reasons unknown to me stddef.hdoes not define wchar_t. There's a comment saying that it should, so the logical solution seems to be moving the definition of wchar_t from sys/types.h to stddef.h.
Description of the issue:
Including
inttypes.h
in a.c
file fails.How to reproduce:
The issue should be easy to reproduce by just creating a
importer.c
file with a single line:Compiling that file will produce the following errors:
You can also use this Arduino script to reproduce the issue.
Solution
This issue arises because
inttypes.h
cannot find wherewchar_t
is defined. It tries to importstddef.h
for this purpose:https://github.com/sonydevworld/spresense-nuttx/blob/5c65b4d1e49add94270d8c515b85534559dd9fb8/include/inttypes.h#L39-L43
However, for reasons unknown to me
stddef.h
does not definewchar_t
. There's a comment saying that it should, so the logical solution seems to be moving the definition ofwchar_t
fromsys/types.h
tostddef.h
.https://github.com/sonydevworld/spresense-nuttx/blob/5c65b4d1e49add94270d8c515b85534559dd9fb8/include/stddef.h#L90-L93
The text was updated successfully, but these errors were encountered: