mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-29 13:03:38 +01:00
use __restrict__ in headers for g++ compatibility
This commit is contained in:
parent
6be2a3d52e
commit
518a866750
9 changed files with 86 additions and 79 deletions
|
@ -50,7 +50,7 @@ extern void __printf_enable_fixed(void);
|
||||||
*/
|
*/
|
||||||
struct __printf_output {
|
struct __printf_output {
|
||||||
/* Final output, after buffering */
|
/* Final output, after buffering */
|
||||||
char * restrict str;
|
char * __restrict__ str;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int fd;
|
int fd;
|
||||||
/* Size of the final output */
|
/* Size of the final output */
|
||||||
|
@ -66,8 +66,8 @@ struct __printf_output {
|
||||||
|
|
||||||
/* Generic formatted printing. */
|
/* Generic formatted printing. */
|
||||||
extern int __printf(
|
extern int __printf(
|
||||||
struct __printf_output * restrict __out,
|
struct __printf_output * __restrict__ __out,
|
||||||
char const * restrict __format,
|
char const * __restrict__ __format,
|
||||||
va_list *__args);
|
va_list *__args);
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,9 +116,9 @@ struct __printf_format {
|
||||||
** -> __args is a pointer to the variable list of arguments to read from
|
** -> __args is a pointer to the variable list of arguments to read from
|
||||||
*/
|
*/
|
||||||
typedef void __printf_formatter_t(
|
typedef void __printf_formatter_t(
|
||||||
struct __printf_output * restrict __out,
|
struct __printf_output *__out,
|
||||||
struct __printf_format * restrict __opts,
|
struct __printf_format *__opts,
|
||||||
va_list * restrict __args
|
va_list *__args
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -245,14 +245,14 @@ extern imaxdiv_t imaxdiv(intmax_t __num, intmax_t __denom);
|
||||||
|
|
||||||
/* Parse an intmax_t from string. */
|
/* Parse an intmax_t from string. */
|
||||||
extern intmax_t strtoimax(
|
extern intmax_t strtoimax(
|
||||||
char const * restrict __ptr,
|
char const * __restrict__ __ptr,
|
||||||
char ** restrict __endptr,
|
char ** __restrict__ __endptr,
|
||||||
int __base);
|
int __base);
|
||||||
|
|
||||||
/* Parse an uintmax_t from string. */
|
/* Parse an uintmax_t from string. */
|
||||||
extern uintmax_t strtoumax(
|
extern uintmax_t strtoumax(
|
||||||
char const * restrict __ptr,
|
char const * __restrict__ __ptr,
|
||||||
char ** restrict __endptr,
|
char ** __restrict__ __endptr,
|
||||||
int __base);
|
int __base);
|
||||||
|
|
||||||
#endif /*__INTTYPES_H__*/
|
#endif /*__INTTYPES_H__*/
|
||||||
|
|
|
@ -36,8 +36,8 @@ typedef uint32_t kernel_sigset_t;
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
/* Get and/or change the set of blocked signals. */
|
/* Get and/or change the set of blocked signals. */
|
||||||
extern int sigprocmask (int __how, const sigset_t *restrict __set,
|
extern int sigprocmask (int __how, const sigset_t * __restrict__ __set,
|
||||||
sigset_t *restrict __oldset);
|
sigset_t * __restrict__ __oldset);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Send signal SIG to process number PID. If PID is zero, send SIG to all
|
** Send signal SIG to process number PID. If PID is zero, send SIG to all
|
||||||
|
|
|
@ -42,32 +42,36 @@ extern FILE *stderr;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Formatted print to file. */
|
/* Formatted print to file. */
|
||||||
extern int fprintf(FILE * restrict __fp, char const * restrict __format, ...);
|
extern int fprintf(FILE * __restrict__ __fp,
|
||||||
|
char const * __restrict__ __format, ...);
|
||||||
|
|
||||||
/* Formatted print to stdout. */
|
/* Formatted print to stdout. */
|
||||||
extern int printf(char const * restrict __format, ...);
|
extern int printf(
|
||||||
|
char const * __restrict__ __format, ...);
|
||||||
|
|
||||||
/* Formatted print to string (with limited size). */
|
/* Formatted print to string (with limited size). */
|
||||||
extern int snprintf(char * restrict __str, size_t __size,
|
extern int snprintf(char * __restrict__ __str, size_t __size,
|
||||||
char const * restrict __format, ...);
|
char const * __restrict__ __format, ...);
|
||||||
|
|
||||||
/* Formatted print to string (with unlimited size!). */
|
/* Formatted print to string (with unlimited size!). */
|
||||||
extern int sprintf(char * restrict __str, char const * restrict __format, ...);
|
extern int sprintf(char * __restrict__ __str,
|
||||||
|
char const * __restrict__ __format, ...);
|
||||||
|
|
||||||
/* Formatted print to file (variable argument list). */
|
/* Formatted print to file (variable argument list). */
|
||||||
extern int vfprintf(FILE * restrict __fp, char const * restrict __format,
|
extern int vfprintf(FILE * __restrict__ __fp,
|
||||||
va_list __args);
|
char const * __restrict__ __format, va_list __args);
|
||||||
|
|
||||||
/* Formatted print to stdout (variable argument list). */
|
/* Formatted print to stdout (variable argument list). */
|
||||||
extern int vprintf(char const * restrict __format, va_list __args);
|
extern int vprintf(
|
||||||
|
char const * __restrict__ __format, va_list __args);
|
||||||
|
|
||||||
/* Formatted print to string (limited size, variable argument list). */
|
/* Formatted print to string (limited size, variable argument list). */
|
||||||
extern int vsnprintf(char * restrict __str, size_t __size,
|
extern int vsnprintf(char * __restrict__ __str, size_t __size,
|
||||||
char const * restrict __format, va_list __args);
|
char const * __restrict__ __format, va_list __args);
|
||||||
|
|
||||||
/* Formatted print to string (unlimited size!, variable argument list). */
|
/* Formatted print to string (unlimited size!, variable argument list). */
|
||||||
extern int vsprintf(char * restrict __str, char const * restrict __format,
|
extern int vsprintf(char * __restrict__ __str,
|
||||||
va_list __args);
|
char const * __restrict__ __format, va_list __args);
|
||||||
|
|
||||||
/* putx() - display char / string */
|
/* putx() - display char / string */
|
||||||
extern int putchar(int c);
|
extern int putchar(int c);
|
||||||
|
@ -76,16 +80,19 @@ extern int puts(const char *s);
|
||||||
/* Extensions. */
|
/* Extensions. */
|
||||||
|
|
||||||
/* Formatted print to file descriptor. */
|
/* Formatted print to file descriptor. */
|
||||||
extern int dprintf(int __fd, char const * restrict __format, ...);
|
extern int dprintf(int __fd,
|
||||||
|
char const * __restrict__ __format, ...);
|
||||||
|
|
||||||
/* Formatted print to file descriptor (variable argument list). */
|
/* Formatted print to file descriptor (variable argument list). */
|
||||||
extern int vdprintf(int __fd, char const * restrict __format, va_list __args);
|
extern int vdprintf(int __fd,
|
||||||
|
char const * __restrict__ __format, va_list __args);
|
||||||
|
|
||||||
/* Allocating sprintf(). */
|
/* Allocating sprintf(). */
|
||||||
extern int asprintf(char ** restrict __str,char const * restrict __format,...);
|
extern int asprintf(char ** __restrict__ __str,
|
||||||
|
char const * __restrict__ __format, ...);
|
||||||
|
|
||||||
/* Allocating vsprintf(). */
|
/* Allocating vsprintf(). */
|
||||||
extern int vasprintf(char ** restrict __str, char const * restrict __format,
|
extern int vasprintf(char ** __restrict__ __str,
|
||||||
va_list __args);
|
char const * __restrict__ __format, va_list __args);
|
||||||
|
|
||||||
#endif /*__STDIO_H__*/
|
#endif /*__STDIO_H__*/
|
||||||
|
|
|
@ -96,42 +96,42 @@ extern double atof(char const *__ptr);
|
||||||
|
|
||||||
/* Parse a long int from a string. */
|
/* Parse a long int from a string. */
|
||||||
extern long int strtol(
|
extern long int strtol(
|
||||||
char const * restrict __ptr,
|
char const * __restrict__ __ptr,
|
||||||
char ** restrict __endptr,
|
char ** __restrict__ __endptr,
|
||||||
int __base);
|
int __base);
|
||||||
|
|
||||||
/* Parse a long unsigned int from a string. */
|
/* Parse a long unsigned int from a string. */
|
||||||
extern unsigned long int strtoul(
|
extern unsigned long int strtoul(
|
||||||
char const * restrict __ptr,
|
char const * __restrict__ __ptr,
|
||||||
char ** restrict __endptr,
|
char ** __restrict__ __endptr,
|
||||||
int __base);
|
int __base);
|
||||||
|
|
||||||
/* Parse a long long int from a string. */
|
/* Parse a long long int from a string. */
|
||||||
extern long long int strtoll(
|
extern long long int strtoll(
|
||||||
char const * restrict __ptr,
|
char const * __restrict__ __ptr,
|
||||||
char ** restrict __endptr,
|
char ** __restrict__ __endptr,
|
||||||
int __base);
|
int __base);
|
||||||
|
|
||||||
/* Parse a long long unsigned int from a string. */
|
/* Parse a long long unsigned int from a string. */
|
||||||
extern unsigned long long int strtoull(
|
extern unsigned long long int strtoull(
|
||||||
char const * restrict __ptr,
|
char const * __restrict__ __ptr,
|
||||||
char ** restrict __endptr,
|
char ** __restrict__ __endptr,
|
||||||
int __base);
|
int __base);
|
||||||
|
|
||||||
/* Parse a double from a string. */
|
/* Parse a double from a string. */
|
||||||
extern double strtod(
|
extern double strtod(
|
||||||
char const * restrict __ptr,
|
char const * __restrict__ __ptr,
|
||||||
char ** restrict __endptr);
|
char ** __restrict__ __endptr);
|
||||||
|
|
||||||
/* Parse a float from a string. */
|
/* Parse a float from a string. */
|
||||||
extern float strtof(
|
extern float strtof(
|
||||||
char const * restrict __ptr,
|
char const * __restrict__ __ptr,
|
||||||
char ** restrict __endptr);
|
char ** __restrict__ __endptr);
|
||||||
|
|
||||||
/* Parse a long double from a string. */
|
/* Parse a long double from a string. */
|
||||||
extern long double strtold(
|
extern long double strtold(
|
||||||
char const * restrict __ptr,
|
char const * __restrict__ __ptr,
|
||||||
char ** restrict __endptr);
|
char ** __restrict__ __endptr);
|
||||||
|
|
||||||
/* Pseudo-random sequence generation functions. */
|
/* Pseudo-random sequence generation functions. */
|
||||||
|
|
||||||
|
|
|
@ -12,20 +12,20 @@ extern void *memcpy(void *__dest, void const *__src, size_t __n);
|
||||||
extern void *memmove(void *__dest, void const *__src, size_t __n);
|
extern void *memmove(void *__dest, void const *__src, size_t __n);
|
||||||
|
|
||||||
/* Copy string __src into __dest. */
|
/* Copy string __src into __dest. */
|
||||||
extern char *strcpy(char * restrict __dest, char const * restrict __src);
|
extern char *strcpy(char *__restrict__ __dest, char const *__restrict__ __src);
|
||||||
|
|
||||||
/* Copy at most __n characters of __src into __dest. */
|
/* Copy at most __n characters of __src into __dest. */
|
||||||
extern char *strncpy(char * restrict __dest, char const * restrict __src,
|
extern char *strncpy(char * __restrict__ __dest,
|
||||||
size_t __n);
|
char const * __restrict__ __src, size_t __n);
|
||||||
|
|
||||||
/* Concatenation functions. */
|
/* Concatenation functions. */
|
||||||
|
|
||||||
/* Copy __src at the end of __dest. */
|
/* Copy __src at the end of __dest. */
|
||||||
extern char *strcat(char * restrict __dest, char const * restrict __src);
|
extern char *strcat(char *__restrict__ __dest, char const *__restrict__ __src);
|
||||||
|
|
||||||
/* Copy at most __n characters of __src into __dest. */
|
/* Copy at most __n characters of __src into __dest. */
|
||||||
extern char *strncat(char * restrict __dest, char const * restrict __src,
|
extern char *strncat(char * __restrict__ __dest,
|
||||||
size_t __n);
|
char const * __restrict__ __src, size_t __n);
|
||||||
|
|
||||||
/* Comparison functions. */
|
/* Comparison functions. */
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ extern int strcoll(char const *__s1, char const *__s2);
|
||||||
extern int strncmp(char const *__s1, char const *__s2, size_t __n);
|
extern int strncmp(char const *__s1, char const *__s2, size_t __n);
|
||||||
|
|
||||||
/* Transform __src into __dest in a way that morphs strcoll into strcmp. */
|
/* Transform __src into __dest in a way that morphs strcoll into strcmp. */
|
||||||
extern size_t strxfrm(char * restrict __dest, char const * restrict __src,
|
extern size_t strxfrm(char * __restrict__ __dest,
|
||||||
size_t __n);
|
char const * __restrict__ __src, size_t __n);
|
||||||
|
|
||||||
/* Search functions. */
|
/* Search functions. */
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ extern size_t strspn(char const *__s, char const *__include);
|
||||||
extern char *strstr(char const *__s1, char const *__s2);
|
extern char *strstr(char const *__s1, char const *__s2);
|
||||||
|
|
||||||
/* Break __s into tokens delimited by characters from __separators. */
|
/* Break __s into tokens delimited by characters from __separators. */
|
||||||
extern char *strtok(char * restrict __s, char const * restrict __separators);
|
extern char *strtok(char * __restrict__ __s, char const * __restrict__ __seps);
|
||||||
|
|
||||||
/* Miscellaneous functions. */
|
/* Miscellaneous functions. */
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
{len} Minimal number of characters to print
|
{len} Minimal number of characters to print
|
||||||
{pre} Number of digits after the decimal dot */
|
{pre} Number of digits after the decimal dot */
|
||||||
void __printf_format_D(
|
void __printf_format_D(
|
||||||
struct __printf_output * restrict out,
|
struct __printf_output *out,
|
||||||
struct __printf_format * restrict opt,
|
struct __printf_format *opt,
|
||||||
va_list * restrict args)
|
va_list *args)
|
||||||
{
|
{
|
||||||
int64_t n = __printf_load_i(opt->size, args);
|
int64_t n = __printf_load_i(opt->size, args);
|
||||||
|
|
||||||
|
|
|
@ -198,9 +198,9 @@ static void exponent_notation(
|
||||||
//---
|
//---
|
||||||
|
|
||||||
static void __printf_format_eEfFgG(
|
static void __printf_format_eEfFgG(
|
||||||
struct __printf_output * restrict out,
|
struct __printf_output *out,
|
||||||
struct __printf_format * restrict opt,
|
struct __printf_format *opt,
|
||||||
va_list * restrict args)
|
va_list *args)
|
||||||
{
|
{
|
||||||
double v = va_arg(*args, double);
|
double v = va_arg(*args, double);
|
||||||
digit_buffer[0] = '0';
|
digit_buffer[0] = '0';
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
(-) Move spaces to the right
|
(-) Move spaces to the right
|
||||||
{len} Specifies numbers of (whitespace-padded) characters to print */
|
{len} Specifies numbers of (whitespace-padded) characters to print */
|
||||||
void __printf_format_c(
|
void __printf_format_c(
|
||||||
struct __printf_output * restrict out,
|
struct __printf_output *out,
|
||||||
struct __printf_format * restrict opt,
|
struct __printf_format *opt,
|
||||||
va_list * restrict args)
|
va_list *args)
|
||||||
{
|
{
|
||||||
int c = va_arg(*args, int);
|
int c = va_arg(*args, int);
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ void __printf_format_c(
|
||||||
{len} Minimal numbers of characters to output
|
{len} Minimal numbers of characters to output
|
||||||
{pre} Maximal numbers of bytes to read from argument */
|
{pre} Maximal numbers of bytes to read from argument */
|
||||||
void __printf_format_s(
|
void __printf_format_s(
|
||||||
struct __printf_output * restrict out,
|
struct __printf_output *out,
|
||||||
struct __printf_format * restrict opt,
|
struct __printf_format *opt,
|
||||||
va_list * restrict args)
|
va_list *args)
|
||||||
{
|
{
|
||||||
char const *s = va_arg(*args, char const *);
|
char const *s = va_arg(*args, char const *);
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ void __printf_format_s(
|
||||||
{len} Minimal number of characters to print
|
{len} Minimal number of characters to print
|
||||||
{pre} Forces a minimal number of digits, creating 0s (overrides '0') */
|
{pre} Forces a minimal number of digits, creating 0s (overrides '0') */
|
||||||
void __printf_format_di(
|
void __printf_format_di(
|
||||||
struct __printf_output * restrict out,
|
struct __printf_output *out,
|
||||||
struct __printf_format * restrict opt,
|
struct __printf_format *opt,
|
||||||
va_list * restrict args)
|
va_list *args)
|
||||||
{
|
{
|
||||||
int64_t n = __printf_load_i(opt->size, args);
|
int64_t n = __printf_load_i(opt->size, args);
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ void __printf_format_di(
|
||||||
{len} Minimal number of characters to print
|
{len} Minimal number of characters to print
|
||||||
{pre} Forces a minimal number of digits, creating 0s (overrides '0') */
|
{pre} Forces a minimal number of digits, creating 0s (overrides '0') */
|
||||||
void __printf_format_ouxX(
|
void __printf_format_ouxX(
|
||||||
struct __printf_output * restrict out,
|
struct __printf_output *out,
|
||||||
struct __printf_format * restrict opt,
|
struct __printf_format *opt,
|
||||||
va_list * restrict args)
|
va_list *args)
|
||||||
{
|
{
|
||||||
uint64_t n = __printf_load_u(opt->size, args);
|
uint64_t n = __printf_load_u(opt->size, args);
|
||||||
|
|
||||||
|
@ -144,9 +144,9 @@ void __printf_format_ouxX(
|
||||||
|
|
||||||
/* Pointer formatter (%p) */
|
/* Pointer formatter (%p) */
|
||||||
void __printf_format_p(
|
void __printf_format_p(
|
||||||
struct __printf_output * restrict out,
|
struct __printf_output *out,
|
||||||
struct __printf_format * restrict opt,
|
struct __printf_format *opt,
|
||||||
va_list * restrict args)
|
va_list *args)
|
||||||
{
|
{
|
||||||
(void)opt;
|
(void)opt;
|
||||||
void *p = va_arg(*args, void *);
|
void *p = va_arg(*args, void *);
|
||||||
|
@ -161,9 +161,9 @@ void __printf_format_p(
|
||||||
|
|
||||||
/* errno message formatter (%m) */
|
/* errno message formatter (%m) */
|
||||||
void __printf_format_m(
|
void __printf_format_m(
|
||||||
struct __printf_output * restrict out,
|
struct __printf_output *out,
|
||||||
struct __printf_format * restrict opt,
|
struct __printf_format *opt,
|
||||||
va_list * restrict args)
|
va_list *args)
|
||||||
{
|
{
|
||||||
(void)opt;
|
(void)opt;
|
||||||
(void)args;
|
(void)args;
|
||||||
|
@ -174,9 +174,9 @@ void __printf_format_m(
|
||||||
|
|
||||||
/* Number of characters written so far (%n) */
|
/* Number of characters written so far (%n) */
|
||||||
void __printf_format_n(
|
void __printf_format_n(
|
||||||
struct __printf_output * restrict out,
|
struct __printf_output *out,
|
||||||
struct __printf_format * restrict opt,
|
struct __printf_format *opt,
|
||||||
va_list * restrict args)
|
va_list *args)
|
||||||
{
|
{
|
||||||
void *p = va_arg(*args, void *);
|
void *p = va_arg(*args, void *);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue