This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
The C99 functions strtoll and strtoull are not declared in stdlib.h when using gcc -std=c99, as they are under !__STRICT_ANSI__. The C99 functions strtof and strtold are declared in stdlib.h even when __STRICT_ANSI__ is defined. Attached is a patch to put these declarations under !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L). $ cat c99-stdlib-test.c #include <stdlib.h> int main() { strtoll("1234", NULL , 0); strtoull("1234", NULL, 0); strtof("1234", NULL); /* only available on platforms where long double equals double... */ /* strtold("1234", NULL); */ return 0; } before patch: $ gcc c99-stdlib-test.c -std=c99 -Werror=implicit-function-declaration c99-stdlib-test.c: In function ‘main’: c99-stdlib-test.c:7:3: error: implicit declaration of function ‘strtoll’ c99-stdlib-test.c:8:3: error: implicit declaration of function ‘strtoull’ after patch: $ gcc c99-stdlib-test.c -std=c99 -Werror=implicit-function-declaration $ gcc c99-stdlib-test.c -std=c89 -Werror=implicit-function-declaration c99-stdlib-test.c: In function ‘main’: c99-stdlib-test.c:7:3: error: implicit declaration of function ‘strtoll’ c99-stdlib-test.c:8:3: error: implicit declaration of function ‘strtoull’ c99-stdlib-test.c:9:3: error: implicit declaration of function ‘strtof’ newlib/ChangeLog: 2012-10-19 Jon TURNEY <jon.turney@dronecode.org.uk> * libc/include/stdlib.h (strtof, strtoll, strtoull, strtold):Prototype if not __STRICT_ANSI__ or stdc version C99 or greater.
Attachment:
stdlib.h.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |