ea24699798
Transmuting from an immutable to a mutable reference is undefined behavior in Rust, with the exception of UnsafeCell which tells the optimizer to not draw too many conclusions. Sadly UnsafeCell::get cannot yet be used in statics (see https://github.com/rust-lang/rust/issues/51718), so this works around that by making the statics into functions and making C macros to call those.
18 lines
493 B
C
18 lines
493 B
C
#ifndef _BITS_STDIO_H
|
|
#define _BITS_STDIO_H
|
|
|
|
#define EOF (-1)
|
|
#define stdin __stdin()
|
|
#define stdout __stdout()
|
|
#define stderr __stderr()
|
|
|
|
int fprintf(FILE * stream, const char * fmt, ...);
|
|
int printf(const char * fmt, ...);
|
|
int snprintf(char *s, size_t n, const char * fmt, ...);
|
|
int sprintf(char *s, const char * fmt, ...);
|
|
int fscanf(FILE * stream, const char * fmt, ...);
|
|
int scanf(const char * fmt, ...);
|
|
int sscanf(const char * input, const char * fmt, ...);
|
|
|
|
#endif /* _BITS_STDIO_H */
|