mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Fix PFLINK mechanism for uppercase float conversion specifiers (#796)
_PFLINK is supposed to automatically pull in required functions for specific conversion specifiers. However, it fails to do so for the F, G and E conversion specifiers. This means that, for example, the following program: #include <stdio.h> int main() { printf("%F %G %E\n", .0, .0, .0); } fails to run correctly, printing "? ? ?" instead of "0.000000 0 0.000000E+00". This patch fixes this.
This commit is contained in:
parent
669b4c5f19
commit
36f52ea687
4 changed files with 137 additions and 13 deletions
|
@ -12,19 +12,19 @@
|
|||
*/
|
||||
|
||||
#define PFLINK(...) _PFLINK(__VA_ARGS__)
|
||||
#define _PFLINK(FMT, ...) \
|
||||
({ \
|
||||
if (___PFLINK(FMT, strpbrk, "faAeg")) STATIC_YOINK("__fmt_dtoa"); \
|
||||
if (___PFLINK(FMT, strpbrk, "cmrqs")) { \
|
||||
if (___PFLINK(FMT, strstr, "%m")) STATIC_YOINK("strerror"); \
|
||||
if (___PFLINK(FMT, strstr, "%*") || \
|
||||
___PFLINK(FMT, strpbrk, "0123456789")) { \
|
||||
STATIC_YOINK("strnwidth"); \
|
||||
STATIC_YOINK("strnwidth16"); \
|
||||
STATIC_YOINK("wcsnwidth"); \
|
||||
} \
|
||||
} \
|
||||
FMT; \
|
||||
#define _PFLINK(FMT, ...) \
|
||||
({ \
|
||||
if (___PFLINK(FMT, strpbrk, "fFaAeEgG")) STATIC_YOINK("__fmt_dtoa"); \
|
||||
if (___PFLINK(FMT, strpbrk, "cmrqs")) { \
|
||||
if (___PFLINK(FMT, strstr, "%m")) STATIC_YOINK("strerror"); \
|
||||
if (___PFLINK(FMT, strstr, "%*") || \
|
||||
___PFLINK(FMT, strpbrk, "0123456789")) { \
|
||||
STATIC_YOINK("strnwidth"); \
|
||||
STATIC_YOINK("strnwidth16"); \
|
||||
STATIC_YOINK("wcsnwidth"); \
|
||||
} \
|
||||
} \
|
||||
FMT; \
|
||||
})
|
||||
|
||||
#define SFLINK(...) _SFLINK(__VA_ARGS__)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue