[libc] 删除compiler_private.c文件

This commit is contained in:
Meco Man 2021-12-29 07:48:36 -05:00 committed by Bernard Xiong
parent c8dcf7cc68
commit 85276f4535
11 changed files with 36 additions and 49 deletions

View File

@ -70,7 +70,7 @@ FILEHANDLE _sys_open(const char *name, int openmode)
return (STDERR);
#ifndef DFS_USING_POSIX
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
return 0; /* error */
#else
/* Correct openmode from fopen to open */
@ -115,7 +115,7 @@ int _sys_close(FILEHANDLE fh)
return close(fh);
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
return 0;
#endif /* DFS_USING_POSIX */
}
@ -161,7 +161,7 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode)
size = read(STDIN_FILENO, buf, len);
return len - size; /* success */
#else
LOG_W("%s: %s", __func__, warning_without_devio);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_DEVIO);
return 0; /* error */
#endif /* RT_USING_POSIX_DEVIO */
}
@ -182,7 +182,7 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode)
}
}
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
return 0; /* error */
#endif /* DFS_USING_POSIX */
}
@ -233,7 +233,7 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode)
return 0; /* error */
}
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
return 0; /* error */
#endif /* DFS_USING_POSIX */
}
@ -252,7 +252,7 @@ int _sys_seek(FILEHANDLE fh, long pos)
/* position is relative to the start of file fh */
return lseek(fh, pos, 0);
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
return 0; /* error */
#endif /* DFS_USING_POSIX */
}
@ -308,7 +308,7 @@ long _sys_flen(FILEHANDLE fh)
fstat(fh, &stat);
return stat.st_size;
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
return 0;
#endif /* DFS_USING_POSIX */
}
@ -326,7 +326,7 @@ int remove(const char *filename)
#ifdef DFS_USING_POSIX
return unlink(filename);
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
return 0; /* error */
#endif /* DFS_USING_POSIX */
}
@ -361,7 +361,7 @@ int fgetc(FILE *f)
if(read(STDIN_FILENO, &ch, 1) == 1)
return ch;
#endif /* RT_USING_POSIX_DEVIO */
LOG_W("%s: %s", __func__, warning_without_devio);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_DEVIO);
return 0; /* error */
}

View File

@ -1,13 +0,0 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-26 Meco Man First Version
*/
#include "compiler_private.h"
const char *warning_without_fs = "Please enable RT_USING_POSIX_FS";
const char *warning_without_devio = "Please enable RT_USING_POSIX_FS and RT_USING_POSIX_DEVIO";

View File

@ -12,7 +12,7 @@
#include <rtconfig.h>
extern const char *warning_without_fs;
extern const char *warning_without_devio;
#define _WARNING_WITHOUT_FS "Please enable RT_USING_POSIX_FS"
#define _WARNING_WITHOUT_DEVIO "Please enable RT_USING_POSIX_FS and RT_USING_POSIX_DEVIO"
#endif /* __COMPILER_PRIVATE_H__ */

View File

@ -33,7 +33,7 @@
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#define WARNING_NO_RTC "Cannot find a RTC device!"
#define _WARNING_NO_RTC "Cannot find a RTC device!"
/* seconds per day */
#define SPD 24*60*60
@ -110,7 +110,7 @@ static rt_err_t get_timeval(struct timeval *tv)
else
{
/* LOG_W will cause a recursive printing if ulog timestamp function is enabled */
rt_kprintf(WARNING_NO_RTC);
rt_kprintf(_WARNING_NO_RTC);
return -RT_ENOSYS;
}
@ -118,7 +118,7 @@ static rt_err_t get_timeval(struct timeval *tv)
#else
/* LOG_W will cause a recursive printing if ulog timestamp function is enabled */
rt_kprintf(WARNING_NO_RTC);
rt_kprintf(_WARNING_NO_RTC);
return -RT_ENOSYS;
#endif /* RT_USING_RTC */
}
@ -155,14 +155,14 @@ static int set_timeval(struct timeval *tv)
}
else
{
LOG_W(WARNING_NO_RTC);
LOG_W(_WARNING_NO_RTC);
return -RT_ENOSYS;
}
return rst;
#else
LOG_W(WARNING_NO_RTC);
LOG_W(_WARNING_NO_RTC);
return -RT_ENOSYS;
#endif /* RT_USING_RTC */
}
@ -527,7 +527,7 @@ INIT_COMPONENT_EXPORT(_rt_clock_time_system_init);
int clock_getres(clockid_t clockid, struct timespec *res)
{
#ifndef RT_USING_RTC
LOG_W(WARNING_NO_RTC);
LOG_W(_WARNING_NO_RTC);
return -1;
#else
int ret = 0;
@ -566,7 +566,7 @@ RTM_EXPORT(clock_getres);
int clock_gettime(clockid_t clockid, struct timespec *tp)
{
#ifndef RT_USING_RTC
LOG_W(WARNING_NO_RTC);
LOG_W(_WARNING_NO_RTC);
return -1;
#else
int ret = 0;
@ -630,7 +630,7 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
int clock_settime(clockid_t clockid, const struct timespec *tp)
{
#ifndef RT_USING_RTC
LOG_W(WARNING_NO_RTC);
LOG_W(_WARNING_NO_RTC);
return -1;
#else
register rt_base_t level;

View File

@ -31,7 +31,7 @@ int __close(int handle)
#ifdef DFS_USING_POSIX
return close(handle);
#else
LOG_W(warning_without_fs);
LOG_W(_WARNING_WITHOUT_FS);
return _LLIO_ERROR;
#endif /* DFS_USING_POSIX */
}

View File

@ -40,7 +40,7 @@ long __lseek(int handle, long offset, int whence)
#ifdef DFS_USING_POSIX
return lseek(handle, offset, whence);
#else
LOG_W(warning_without_fs);
LOG_W(_WARNING_WITHOUT_FS);
return _LLIO_ERROR;
#endif /* DFS_USING_POSIX */
}

View File

@ -77,7 +77,7 @@ int __open(const char *filename, int mode)
}
return handle;
#else
LOG_W(warning_without_fs);
LOG_W(_WARNING_WITHOUT_FS);
return _LLIO_ERROR;
#endif /* DFS_USING_POSIX */
}

View File

@ -47,7 +47,7 @@ size_t __read(int handle, unsigned char *buf, size_t len)
}
return read(STDIN_FILENO, buf, len); /* return the length of the data read */
#else
LOG_W(warning_without_devio);
LOG_W(_WARNING_WITHOUT_DEVIO);
return _LLIO_ERROR;
#endif /* RT_USING_POSIX_DEVIO */
}
@ -59,7 +59,7 @@ size_t __read(int handle, unsigned char *buf, size_t len)
size = read(handle, buf, len);
return size; /* return the length of the data read */
#else
LOG_W(warning_without_fs);
LOG_W(_WARNING_WITHOUT_FS);
return _LLIO_ERROR;
#endif /* DFS_USING_POSIX */
}

View File

@ -27,7 +27,7 @@ int remove(const char *filename)
#ifdef DFS_USING_POSIX
return unlink(filename);
#else
LOG_W(warning_without_fs);
LOG_W(_WARNING_WITHOUT_FS);
return _LLIO_ERROR;
#endif /* DFS_USING_POSIX */
}

View File

@ -64,7 +64,7 @@ size_t __write(int handle, const unsigned char *buf, size_t len)
size = write(handle, buf, len);
return size; /* return the length of the data written */
#else
LOG_W(warning_without_fs);
LOG_W(_WARNING_WITHOUT_FS);
return _LLIO_ERROR;
#endif /* DFS_USING_POSIX */
}

View File

@ -110,7 +110,7 @@ int _close_r(struct _reent *ptr, int fd)
#ifdef DFS_USING_POSIX
return close(fd);
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
ptr->_errno = ENOTSUP;
return -1;
#endif /* DFS_USING_POSIX */
@ -187,7 +187,7 @@ _off_t _lseek_r(struct _reent *ptr, int fd, _off_t pos, int whence)
rc = lseek(fd, pos, whence);
return rc;
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
ptr->_errno = ENOTSUP;
return -1;
#endif /* DFS_USING_POSIX */
@ -200,7 +200,7 @@ int _mkdir_r(struct _reent *ptr, const char *name, int mode)
rc = mkdir(name, mode);
return rc;
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
ptr->_errno = ENOTSUP;
return -1;
#endif /* DFS_USING_POSIX */
@ -213,7 +213,7 @@ int _open_r(struct _reent *ptr, const char *file, int flags, int mode)
rc = open(file, flags, mode);
return rc;
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
ptr->_errno = ENOTSUP;
return -1;
#endif /* DFS_USING_POSIX */
@ -232,7 +232,7 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes)
return 0;
}
#else
LOG_W("%s: %s", __func__, warning_without_devio);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_DEVIO);
ptr->_errno = ENOTSUP;
return -1;
#endif /* RT_USING_POSIX_DEVIO */
@ -246,7 +246,7 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes)
rc = read(fd, buf, nbytes);
return rc;
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
ptr->_errno = ENOTSUP;
return -1;
#endif /* DFS_USING_POSIX */
@ -259,7 +259,7 @@ int _rename_r(struct _reent *ptr, const char *old, const char *new)
rc = rename(old, new);
return rc;
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
ptr->_errno = ENOTSUP;
return -1;
#endif /* DFS_USING_POSIX */
@ -272,7 +272,7 @@ int _stat_r(struct _reent *ptr, const char *file, struct stat *pstat)
rc = stat(file, pstat);
return rc;
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
ptr->_errno = ENOTSUP;
return -1;
#endif /* DFS_USING_POSIX */
@ -283,7 +283,7 @@ int _unlink_r(struct _reent *ptr, const char *file)
#ifdef DFS_USING_POSIX
return unlink(file);
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
ptr->_errno = ENOTSUP;
return -1;
#endif /* DFS_USING_POSIX */
@ -318,7 +318,7 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
rc = write(fd, buf, nbytes);
return rc;
#else
LOG_W("%s: %s", __func__, warning_without_fs);
LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS);
ptr->_errno = ENOTSUP;
return -1;
#endif /* DFS_USING_POSIX */