-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WCharacter.h - isascii not declared in this scope on arm-none-eabi #158
Comments
Can you please elaborate in which use case you experience which problem, preferable with a pull request to show mitigation of the issue? |
I develop arduino core for Cortex M4 microcontroller and use standard toolchain
|
I was facing similar issues using |
@DhruvaG2000 could you test if the information in this page also applies to embedded toolchains? The alternative implementation provided by @kenny5660 looks correct but I found this example that seems to contadict everything I know about ascii 🤯 |
Note that this will not work, since the user might have included libc headers before However, I'm not entirely sure what further implications defining As for the proposed implementation, that seems to be identical to the glibc version:
And effectively the same (but written differently) as the newlib version (which is wat the arm gcc build uses):
It also is what POSIX specifies: https://pubs.opengroup.org/onlinepubs/9699919799/functions/isascii.html So I guess the IBM link that @facchinm posted is just weird, since it treats 0x81 and above as valid ASCII, which does not look standards-compliant to me. So let's ignore that.
You mean that if those are defined, use |
yes, something like that, but if we take the "trivial" implementation we can just replace it for all the platforms |
To be specific, there are the set of errors I get when trying to build with my zephyr project: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/cores/arduino/./api/WCharacter.h: In function 'bool arduino::isAscii(int)':
/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/cores/arduino/./api/WCharacter.h:66:12: error: 'isascii' was not declared in this scope; did you mean 'isAscii'?
66 | return ( isascii (c) == 0 ? false : true);
| ^~~~~~~
| isAscii
/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/cores/arduino/./api/WCharacter.h: In function 'int arduino::toAscii(int)':
/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/cores/arduino/./api/WCharacter.h:148:10: error: 'toascii' was not declared in this scope; did you mean 'toAscii'?
148 | return toascii (c);
| ^~~~~~~
| toAscii Compiler being used is: Without newlibc there are many more errors. |
I've also encountered this issue during the creation of a custom Arduino Core. Setting the |
Checking in to see if this being tracked as an issue by the team - is this something we can plan to be fixed in an upcoming release? 🙏 |
The "many more errors" I said above are the following: (building without newlibc)
|
WCharacter.h use isascii, but isascii not defined by the ANSI C standard.
Note: To fix for arm-none-eabi platform you can add definition:
#define _GNU_SOURCE
The text was updated successfully, but these errors were encountered: