lib: libc: arcmwdt: replace the fileno macro
The fileno macro defined in ARC MWDT headers conflicts with the fileno() function defined in lib/posix/options/device_io.c. We should undefine it and replace with a POSIX-compliant declaration and a weak definition. Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
This commit is contained in:
parent
eb4f2fb44a
commit
de18565e2a
26
lib/libc/arcmwdt/include/stdio.h
Normal file
26
lib/libc/arcmwdt/include/stdio.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Synopsys
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef LIB_LIBC_ARCMWDT_INCLUDE_STDIO_H_
|
||||
#define LIB_LIBC_ARCMWDT_INCLUDE_STDIO_H_
|
||||
|
||||
#include_next <stdio.h>
|
||||
|
||||
#ifdef fileno
|
||||
#undef fileno
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int fileno(FILE *file);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIB_LIBC_ARCMWDT_INCLUDE_STDIO_H_ */
|
||||
@ -71,6 +71,13 @@ int _write(int fd, const char *buf, unsigned int nbytes)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_POSIX_DEVICE_IO
|
||||
__weak int fileno(FILE *file)
|
||||
{
|
||||
return _fileno(file);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* It's require to implement _isatty to have STDIN/STDOUT/STDERR buffered
|
||||
* properly.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user