|
| 1 | +From 710665bdd48b055d763c30b88d690fadd46a03af Mon Sep 17 00:00:00 2001 |
| 2 | +From: Cheng Shao < [email protected]> |
| 3 | +Date: Mon, 6 May 2024 19:25:32 +0000 |
| 4 | +Subject: [PATCH] rts: fix I/O manager compilation errors for win32 target |
| 5 | + |
| 6 | +This patch fixes I/O manager compilation errors for win32 target |
| 7 | +discovered when cross-compiling to win32 using recent clang: |
| 8 | + |
| 9 | +``` |
| 10 | +rts/win32/ThrIOManager.c:117:7: error: |
| 11 | + error: call to undeclared function 'is_io_mng_native_p'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] |
| 12 | + 117 | if (is_io_mng_native_p ()) { |
| 13 | + | ^ |
| 14 | + | |
| 15 | +117 | if (is_io_mng_native_p ()) { |
| 16 | + | ^ |
| 17 | + |
| 18 | +1 error generated. |
| 19 | +`x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1) |
| 20 | + |
| 21 | +rts/fs.c:143:28: error: |
| 22 | + error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] |
| 23 | + 143 | int setErrNoFromWin32Error () { |
| 24 | + | ^ |
| 25 | + | void |
| 26 | + | |
| 27 | +143 | int setErrNoFromWin32Error () { |
| 28 | + | ^ |
| 29 | + |
| 30 | +1 error generated. |
| 31 | +`x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1) |
| 32 | + |
| 33 | +rts/win32/ConsoleHandler.c:227:9: error: |
| 34 | + error: call to undeclared function 'interruptIOManagerEvent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] |
| 35 | + 227 | interruptIOManagerEvent (); |
| 36 | + | ^ |
| 37 | + | |
| 38 | +227 | interruptIOManagerEvent (); |
| 39 | + | ^ |
| 40 | + |
| 41 | +rts/win32/ConsoleHandler.c:227:9: error: |
| 42 | + note: did you mean 'getIOManagerEvent'? |
| 43 | + | |
| 44 | +227 | interruptIOManagerEvent (); |
| 45 | + | ^ |
| 46 | + |
| 47 | +rts/include/rts/IOInterface.h:27:10: error: |
| 48 | + note: 'getIOManagerEvent' declared here |
| 49 | + 27 | void * getIOManagerEvent (void); |
| 50 | + | ^ |
| 51 | + | |
| 52 | +27 | void * getIOManagerEvent (void); |
| 53 | + | ^ |
| 54 | + |
| 55 | +1 error generated. |
| 56 | +`x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1) |
| 57 | + |
| 58 | +rts/win32/ConsoleHandler.c:196:9: error: |
| 59 | + error: call to undeclared function 'setThreadLabel'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] |
| 60 | + 196 | setThreadLabel(cap, t, "signal handler thread"); |
| 61 | + | ^ |
| 62 | + | |
| 63 | +196 | setThreadLabel(cap, t, "signal handler thread"); |
| 64 | + | ^ |
| 65 | + |
| 66 | +rts/win32/ConsoleHandler.c:196:9: error: |
| 67 | + note: did you mean 'postThreadLabel'? |
| 68 | + | |
| 69 | +196 | setThreadLabel(cap, t, "signal handler thread"); |
| 70 | + | ^ |
| 71 | + |
| 72 | +rts/eventlog/EventLog.h:118:6: error: |
| 73 | + note: 'postThreadLabel' declared here |
| 74 | + 118 | void postThreadLabel(Capability *cap, |
| 75 | + | ^ |
| 76 | + | |
| 77 | +118 | void postThreadLabel(Capability *cap, |
| 78 | + | ^ |
| 79 | + |
| 80 | +1 error generated. |
| 81 | +`x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1) |
| 82 | +``` |
| 83 | +--- |
| 84 | + rts/win32/ConsoleHandler.c | 2 ++ |
| 85 | + rts/win32/ThrIOManager.c | 1 + |
| 86 | + utils/fs/fs.c | 2 +- |
| 87 | + 3 files changed, 4 insertions(+), 1 deletion(-) |
| 88 | + |
| 89 | +diff --git a/rts/win32/ConsoleHandler.c b/rts/win32/ConsoleHandler.c |
| 90 | +index 848d29288d8a..f6018f34a8cd 100644 |
| 91 | +--- a/rts/win32/ConsoleHandler.c |
| 92 | ++++ b/rts/win32/ConsoleHandler.c |
| 93 | +@@ -5,6 +5,8 @@ |
| 94 | + * For the WINIO manager see base in the GHC.Event modules. |
| 95 | + */ |
| 96 | + #include "Rts.h" |
| 97 | ++#include "MIOManager.h" |
| 98 | ++#include "ThreadLabels.h" |
| 99 | + #include <windows.h> |
| 100 | + #include "ConsoleHandler.h" |
| 101 | + #include "Schedule.h" |
| 102 | +diff --git a/rts/win32/ThrIOManager.c b/rts/win32/ThrIOManager.c |
| 103 | +index 023aee4c1922..61ccd5379c28 100644 |
| 104 | +--- a/rts/win32/ThrIOManager.c |
| 105 | ++++ b/rts/win32/ThrIOManager.c |
| 106 | +@@ -9,6 +9,7 @@ |
| 107 | + * ---------------------------------------------------------------------------*/ |
| 108 | + |
| 109 | + #include "Rts.h" |
| 110 | ++#include "IOManager.h" |
| 111 | + #include "ThrIOManager.h" |
| 112 | + #include "MIOManager.h" |
| 113 | + #include "rts/OSThreads.h" |
| 114 | +diff --git a/utils/fs/fs.c b/utils/fs/fs.c |
| 115 | +index a5377af7e2bc..d64094cae158 100644 |
| 116 | +--- a/utils/fs/fs.c |
| 117 | ++++ b/utils/fs/fs.c |
| 118 | +@@ -140,7 +140,7 @@ static int setErrNoFromWin32Error (void); |
| 119 | + This function should only be called when the creation of the fd actually |
| 120 | + failed and you want to return -1 for the fd. */ |
| 121 | + static |
| 122 | +-int setErrNoFromWin32Error () { |
| 123 | ++int setErrNoFromWin32Error (void) { |
| 124 | + switch (GetLastError()) { |
| 125 | + case ERROR_SUCCESS: |
| 126 | + errno = 0; |
0 commit comments