| #
b6d69a43 |
| 25-Mar-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutils: ctype.h: do not define functions as builtins
Our <ctype.h> defines a number of functions as macros that evaluate to the builtin function of the same name, for instance:
#define isalpha(_
libutils: ctype.h: do not define functions as builtins
Our <ctype.h> defines a number of functions as macros that evaluate to the builtin function of the same name, for instance:
#define isalpha(__c) __builtin_isalpha(__c)
There are two problems with this:
1. It gets in the way of the application developer and makes some compiler flags irrelevant (-fno-builtin*, [1]). 2. Different compilers do not support the same set of builtin functions so having the defines can result in build errors.
Therefore, user regular prototypes in <ctype.h>. Also build libutils without the -ffreestanding flag because it implies -fno-builtin and therefore may needlessly disable optimizations. The libutils environment cannot be considered "free standing" since it implements the standard header files with the expected semantics.
Our implementations of the <ctypes.h> functions (isalnum(), isalpha(), etc.) are defined with the __builtin_ prefix. This is not needed and is arguably wrong. Indeed, we want the functions in libutils to be present without the prefix, which GCC happens to be doing regardless. However, this __builtin_ prefix in the .c files makes things more complicated to support Clang. Therefore, remove it.
Link: [1] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html (-fno-builtin) Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
d815ab47 |
| 27-Apr-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutils: isoc: implement tolower(), isdigit() and isxdigit()
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim B
libutils: isoc: implement tolower(), isdigit() and isxdigit()
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|