File tree Expand file tree Collapse file tree 8 files changed +67
-87
lines changed
en/migration-guides/release-6.x/6.0
zh_CN/migration-guides/release-6.x/6.0 Expand file tree Collapse file tree 8 files changed +67
-87
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1212#include <errno.h>
1313#include <sys/param.h>
1414#include <stdlib.h>
15- #ifdef __clang__ // TODO LLVM-330
16- #include <sys/dirent.h>
17- #else
1815#include <dirent.h>
19- #endif
2016#include "unity.h"
2117#include "esp_heap_caps.h"
2218#include "esp_vfs.h"
Original file line number Diff line number Diff line change 2121#include <sys/time.h>
2222#include <sys/termios.h>
2323#include <sys/poll.h>
24- #ifdef __clang__ // TODO LLVM-330
25- #include <sys/dirent.h>
26- #else
2724#include <dirent.h>
28- #endif
2925#include <string.h>
3026#include "sdkconfig.h"
3127
Original file line number Diff line number Diff line change 1919#include <sys/time.h>
2020#include <sys/termios.h>
2121#include <sys/poll.h>
22- #ifdef __clang__ // TODO LLVM-330
23- #include <sys/dirent.h>
24- #else
2522#include <dirent.h>
26- #endif
2723#include <string.h>
2824#include "sdkconfig.h"
2925
Original file line number Diff line number Diff line change 1010#include <string.h>
1111#include <errno.h>
1212#include <sys/fcntl.h>
13- #ifdef __clang__ // TODO LLVM-330
14- #include <sys/dirent.h>
15- #else
1613#include <dirent.h>
17- #endif
1814#include "esp_vfs.h"
1915#include "unity.h"
2016#include "esp_log.h"
Original file line number Diff line number Diff line change @@ -93,6 +93,39 @@ Warn when an explicitly defaulted function is deleted by the compiler. That can
9393 C(const C&&) = default; /* Implicitly deleted. */
9494 };
9595
96+ ``sys/dirent.h `` No Longer Includes Function Prototypes
97+ -------------------------------------------------------
98+
99+ Issue
100+ ^^^^^^
101+
102+ Compilation errors may occur in code that previously worked with the old toolchain. For example:
103+
104+ .. code-block :: c
105+
106+ #include <sys/dirent.h>
107+ /* .... */
108+ DIR* dir = opendir("test_dir");
109+ /* .... */
110+ /**
111+ * Compile error:
112+ * test.c: In function 'test_opendir':
113+ * test.c:100:16: error: implicit declaration of function 'opendir' [-Werror=implicit-function-declaration]
114+ * 100 | DIR* dir = opendir(path);
115+ * | ^~~~~~~
116+ */
117+
118+ Solution
119+ ^^^^^^^^^
120+
121+ To resolve this issue, the correct header must be included. Refactor the code like this:
122+
123+ .. code-block :: c
124+
125+ #include <dirent.h>
126+ /* .... */
127+ DIR* dir = opendir("test_dir");
128+
96129 Picolibc
97130--------
98131
Original file line number Diff line number Diff line change @@ -93,6 +93,39 @@ GCC 版本更新说明
9393 C(const C&&) = default; /* 被隐式删除 */
9494 };
9595
96+ ``sys/dirent.h `` 不再包含一些函数原型
97+ -------------------------------------------------------
98+
99+ 问题
100+ ^^^^^^
101+
102+ 使用旧工具链的代码可能会出现编译错误。例如:
103+
104+ .. code-block :: c
105+
106+ #include <sys/dirent.h>
107+ /* .... */
108+ DIR* dir = opendir("test_dir");
109+ /* .... */
110+ /**
111+ * Compile error:
112+ * test.c: In function 'test_opendir':
113+ * test.c:100:16: error: implicit declaration of function 'opendir' [-Werror=implicit-function-declaration]
114+ * 100 | DIR* dir = opendir(path);
115+ * | ^~~~~~~
116+ */
117+
118+ 解决方法
119+ ^^^^^^^^^
120+
121+ 包含正确的头文件即可解决此问题。请将代码重构如下:
122+
123+ .. code-block :: c
124+
125+ #include <dirent.h>
126+ /* .... */
127+ DIR* dir = opendir("test_dir");
128+
96129 Picolibc
97130--------
98131
Original file line number Diff line number Diff line change 433433 match_to_output : True
434434
435435-
436- re : " implicit declaration of function '(opendir|readdir|telldir|seekdir|rewinddir|closedir|readdir_r|scandir|alphasort)'"
436+ re : " implicit declaration of function '(opendir|readdir|telldir|seekdir|rewinddir|closedir|readdir_r|scandir|alphasort|dirfd|fdclosedir|fdopendir|scandirat|versionsort|posix_getdents )'"
437437 hint : " Please include <dirent.h> (not <sys/dirent.h>)"
438438
439439-
You can’t perform that action at this time.
0 commit comments