mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-02 17:28:30 +00:00
parent
2d64b9994b
commit
10fd8bdb70
1397 changed files with 1204 additions and 5031 deletions
|
@ -1,12 +1,6 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_FMT_PFLINK_H_
|
||||
#define COSMOPOLITAN_LIBC_FMT_PFLINK_H_
|
||||
#include "libc/dce.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/unicode/unicode.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
/**
|
||||
* @fileoverview builtin+preprocessor+linker tricks for printf/scanf.
|
||||
|
@ -23,8 +17,8 @@
|
|||
if (___PFLINK(FMT, strpbrk, "faAeg")) STATIC_YOINK("__fmt_dtoa"); \
|
||||
if (___PFLINK(FMT, strpbrk, "cmrqs")) { \
|
||||
if (___PFLINK(FMT, strstr, "%m")) STATIC_YOINK("strerror"); \
|
||||
if (!IsTiny() && (___PFLINK(FMT, strstr, "%*") || \
|
||||
___PFLINK(FMT, strpbrk, "0123456789"))) { \
|
||||
if (___PFLINK(FMT, strstr, "%*") || \
|
||||
___PFLINK(FMT, strpbrk, "0123456789")) { \
|
||||
STATIC_YOINK("strnwidth"); \
|
||||
STATIC_YOINK("strnwidth16"); \
|
||||
STATIC_YOINK("wcsnwidth"); \
|
||||
|
@ -64,35 +58,6 @@
|
|||
*/
|
||||
#pragma GCC diagnostic ignored "-Wformat-security"
|
||||
#endif /* __GNUC__ + 0 < 6 */
|
||||
#else
|
||||
#define PFLINK(FMT) FMT
|
||||
#define SFLINK(FMT) FMT
|
||||
#ifdef __GNUC__
|
||||
__asm__(".section .yoink\n\t"
|
||||
"nopl\t__fmt_dtoa(%rip)\n\t"
|
||||
"nopl\tkCp437(%rip)\n\t"
|
||||
"nopl\tstrerror(%rip)\n\t"
|
||||
"nopl\tstrnwidth(%rip)\n\t"
|
||||
"nopl\tstrnwidth16(%rip)\n\t"
|
||||
"nopl\twcsnwidth(%rip)\n\t"
|
||||
"nopl\tmalloc(%rip)\n\t"
|
||||
"nopl\tcalloc(%rip)\n\t"
|
||||
"nopl\t__grow(%rip)\n\t"
|
||||
".previous");
|
||||
#else
|
||||
static long __pflink(long x) {
|
||||
x |= kCp437[0];
|
||||
x |= __fmt_dtoa(0, 0, 0, 0, 0, 0);
|
||||
x |= strnwidth(0, 0, 0);
|
||||
x |= strnwidth16(0, 0, 0);
|
||||
x |= wcsnwidth(0, 0, 0);
|
||||
x |= malloc(0);
|
||||
x |= __grow(0, 0, 0, 0);
|
||||
x |= (intptr_t)strerror(0);
|
||||
x |= (intptr_t)calloc(0, 0);
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
#endif /* __STRICT_ANSI__ */
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_FMT_PFLINK_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue