headers: Get glibc <libio.h> out of the default include path.

It's needed by GCC2 stdc++, but we shouldn't be including it
for all consumers of <stdio.h>, which we were. Drop it,
and adjust all the things that were relying on <stdio_pre.h>'s
definition of __PRINTFLIKE to use the _PRINTFLIKE defined
in BeBuild.h instead.

Hopefully should not cause any breakage; the libroot
implementation of __freading depended on this, but
I didn't see anything else which did.
This commit is contained in:
Augustin Cavalier
2025-03-13 15:57:25 -04:00
parent 80f7969714
commit 9769edfa33
9 changed files with 36 additions and 48 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ extern "C" {
char *fgetln(FILE *stream, size_t *_length);
int asprintf(char **ret, char const *format, ...) __PRINTFLIKE(2,3);
int asprintf(char **ret, char const *format, ...) _PRINTFLIKE(2,3);
int vasprintf(char **ret, char const *format, va_list ap);
+6 -6
View File
@@ -53,8 +53,8 @@
typedef off_t fpos_t;
typedef struct _IO_FILE FILE;
#include <stdio_pre.h>
extern FILE *stdin;
extern FILE *stdout;
@@ -169,13 +169,13 @@ extern ssize_t getdelim(char **_line, size_t *_length, int delimiter,
extern ssize_t getline(char **_line, size_t *_length, FILE *stream);
/* formatted I/O */
extern int printf(char const *format, ...) __PRINTFLIKE(1,2);
extern int printf(char const *format, ...) _PRINTFLIKE(1,2);
#if !defined(_KERNEL_MODE) && !defined(_BOOT_MODE) && !defined(_LOADER_MODE)
extern int dprintf(int fd, char const *format, ...) __PRINTFLIKE(2,3);
extern int dprintf(int fd, char const *format, ...) _PRINTFLIKE(2,3);
#endif
extern int fprintf(FILE *stream, char const *format, ...) __PRINTFLIKE(2,3);
extern int sprintf(char *string, char const *format, ...) __PRINTFLIKE(2,3);
extern int snprintf(char *string, size_t size, char const *format, ...) __PRINTFLIKE(3,4);
extern int fprintf(FILE *stream, char const *format, ...) _PRINTFLIKE(2,3);
extern int sprintf(char *string, char const *format, ...) _PRINTFLIKE(2,3);
extern int snprintf(char *string, size_t size, char const *format, ...) _PRINTFLIKE(3,4);
extern int vprintf(char const *format, va_list ap);
extern int vfprintf(FILE *stream, char const *format, va_list ap);
extern int vsprintf(char *string, char const *format, va_list ap);
-20
View File
@@ -1,20 +0,0 @@
/*
* Copyright 2003-2012 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _STDIO_PRE_H_
#define _STDIO_PRE_H_
#ifndef _STDIO_H_
# error "This file must be included from stdio.h!"
#endif
#include <libio.h>
typedef struct _IO_FILE FILE;
#define __PRINTFLIKE(format, varargs) __attribute__ ((__format__ (__printf__, format, varargs)))
#define __SCANFLIKE(format, varargs) __attribute__((__format__ (__scanf__, format, varargs)))
#endif /* _STDIO_PRE_H_ */
+2 -3
View File
@@ -10,7 +10,6 @@
#include <module.h>
#include <stdio.h>
struct kernel_args;
@@ -32,8 +31,8 @@ extern "C" {
#endif
int con_init(struct kernel_args *args);
void kprintf(const char *fmt, ...) __PRINTFLIKE(1,2);
void kprintf_xy(int x, int y, const char *fmt, ...) __PRINTFLIKE(3,4);
void kprintf(const char *fmt, ...) _PRINTFLIKE(1,2);
void kprintf_xy(int x, int y, const char *fmt, ...) _PRINTFLIKE(3,4);
#ifdef __cplusplus
}