Skip to content

Commit 112ef9a

Browse files
committed
clang-cl (#153)
1 parent d9f6283 commit 112ef9a

File tree

4 files changed

+106
-13
lines changed

4 files changed

+106
-13
lines changed

mcwin32/doc/INSTALL.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The project can be built from source, using one of several supported tool-chains
77
The following environments and toolchains are supported.
88

99
* Microsoft Visual C++ (MSVC) 2015 - 2022; or
10+
* clang-cl using MSVC the linker; or
1011
* Open-Watcom (OWC) 1.9 or 2.0; or
1112
* Mingw64, both 32 and 64 bit targets.
1213

@@ -76,6 +77,10 @@ Several alternative profiles are available:
7677
* vc2017config - Visual Studio C/C++ 2017.
7778
* vc2019config - Visual Studio C/C++ 2019.
7879
* vc2022config - Visual Studio C/C++ 2022.
80+
81+
* clang-cl; or
82+
83+
* cclconfig - Clang cl driver, using MSVC tool-chain. See MSVC setup for primary configuration details.
7984

8085
* Open-Watcom (OWC) 1.9 or 2.0; or
8186

@@ -169,7 +174,7 @@ The follow offers a more detailed discussion of the requirements and instruction
169174
- [Native builds using Open-Watcom](#native-builds-using-openwatcom-c-c)
170175
- [Native builds using Visual C++](#native-builds-using-visual-c-c)
171176
- [Native builds using MinGW64](#native-builds-using-mingw)
172-
177+
173178
Finally, please review the packaged example alternative configurations as win32 development environments can be problematic, dependent on the host setup:
174179

175180
- .github/workflows, github build actions for owc, msvc and mingw64 toolchains.

mcwin32/libw32/w32_check.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <edidentifier.h>
2-
__CIDENT_RCSID(gr_w32_check_c,"$Id: w32_check.c,v 1.17 2025/06/11 17:33:57 cvsuser Exp $")
2+
__CIDENT_RCSID(gr_w32_check_c,"$Id: w32_check.c,v 1.18 2025/06/12 12:28:08 cvsuser Exp $")
33

44
/* -*- mode: c; indent-width: 4; -*- */
55
/*
@@ -120,7 +120,9 @@ struct __packed_pre__ mypackedstruct {
120120
} __packed_post__;
121121
#include <sys/pack0.h>
122122

123-
extern int __w32_check_attr(mode_t mode);
123+
int __w32_check_attr(mode_t mode);
124+
int __w32_check_errno(int rc);
125+
124126

125127
/*
126128
* check for unique mode bits ...
@@ -175,6 +177,14 @@ __w32_check_attr(mode_t mode)
175177
}
176178

177179

180+
/////////////////////////////////////////////////////////////////////////////////////////
181+
// errno mapping
182+
183+
#include <errno.h>
184+
#include "win32_errno.h"
185+
#include <errno.h>
186+
#include "win32_errno.h"
187+
178188
int
179189
__w32_check_errno(int rc)
180190
{

mcwin32/libw32/w32_statfs.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <edidentifier.h>
2-
__CIDENT_RCSID(gr_w32_statfs_c,"$Id: w32_statfs.c,v 1.28 2025/06/11 17:30:58 cvsuser Exp $")
2+
__CIDENT_RCSID(gr_w32_statfs_c,"$Id: w32_statfs.c,v 1.29 2025/06/12 12:27:56 cvsuser Exp $")
33

44
/* -*- mode: c; indent-width: 4; -*- */
55
/*
@@ -718,9 +718,12 @@ NetworkEnum(unsigned ndrives)
718718
// enumeration worker
719719
if (trigger) {
720720
if (InterlockedCompareExchange(&x_nestat.status, NCRunning, NCIdle) == NCIdle) {
721+
#if defined(__GNUC__)
722+
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast"
723+
#endif
721724
DWORD dwThreadId = 0;
722725
HANDLE thread =
723-
CreateThread(NULL, 0, NetworkEnumThread, (void*)(ndrives), 0, &dwThreadId);
726+
CreateThread(NULL, 0, NetworkEnumThread, (void *)(ndrives), 0, &dwThreadId);
724727
if (thread != NULL) {
725728
CloseHandle(thread); // detach
726729
} else { // thread failure
@@ -775,6 +778,9 @@ NetworkCached(struct StatBlock *sb)
775778
static DWORD WINAPI
776779
NetworkEnumThread(LPVOID lpParam)
777780
{
781+
#if defined(__GNUC__)
782+
#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
783+
#endif
778784
const unsigned ndrives = (unsigned)(lpParam);
779785
struct StatBlock *previous = NULL, *sb;
780786
const time_t then = time(NULL);
@@ -879,3 +885,4 @@ drive_mask(int drive)
879885
}
880886

881887
/*end*/
888+

mcwin32/libw32/win32_errno.h

Lines changed: 79 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef LIBW32_WIN32_ERRNO_H_INCLUDED
22
#define LIBW32_WIN32_ERRNO_H_INCLUDED
33
#include <edidentifier.h>
4-
__CIDENT_RCSID(gr_libw32_win32_errno_h,"$Id: win32_errno.h,v 1.17 2025/06/11 17:33:57 cvsuser Exp $")
4+
__CIDENT_RCSID(gr_libw32_win32_errno_h,"$Id: win32_errno.h,v 1.18 2025/06/12 12:28:08 cvsuser Exp $")
55

66
/* -*- mode: c; indent-width: 4; -*- */
77
/*
@@ -44,12 +44,15 @@ __CIDENT_RCSID(gr_libw32_win32_errno_h,"$Id: win32_errno.h,v 1.17 2025/06/11 17:
4444
#pragma message("<system_error.h> is incompatible with _CRT_NO_POSIX_ERROR_CODES.")
4545
#endif
4646
/*
47-
* RETHINK, as the following are assumed by the MinGW pthread package:
47+
* Rethink, the following values are assumed by the MinGW pthread package and possibility more;
4848
*
49-
* #define ETIMEDOUT 138
5049
* #define ENOTSUP 129
50+
* #define ETIMEDOUT 138
5151
* #define EWOULDBLOCK 140
5252
*/
53+
#if (ENOTSUP != 129 || ETIMEDOUT != 138 || EWOULDBLOCK != 140)
54+
#error Unexpected errno definitions
55+
#endif
5356
#include "msvc_errno.h" /* undef error codes */
5457
#else
5558
#error unexpected EADDRINUSE value
@@ -70,13 +73,22 @@ __CIDENT_RCSID(gr_libw32_win32_errno_h,"$Id: win32_errno.h,v 1.17 2025/06/11 17:
7073
#include <errno.h>
7174
#endif
7275

76+
#if defined(__MINGW32__)
77+
#if (EADDRINUSE == 100) /* _CRT_NO_POSIX_ERROR_CODES was ineffective */
78+
#if (ENOTSUP != 129 || ETIMEDOUT != 138 || EWOULDBLOCK != 140)
79+
#error Unexpected errno definitions
80+
#endif
81+
#include "msvc_errno.h"
82+
#endif
83+
#endif //__MINGW32__
84+
7385
/*
7486
* Addition UNIX style errno's, plus Windows Sockets errors redefined as regular Berkeley error constants.
7587
*/
7688

7789
/*
7890
* General use error codes,
79-
* which utilise their defined value under MSVC POSIX definition, see <errno.h>
91+
* which utilise their defined value under MSVC (and emulation) POSIX definition, see <errno.h>
8092
*
8193
* MSVC: Their definitions can be disabled using _CRT_NO_POSIX_ERROR_CODES, as many conflict with the
8294
* WinSock aliases below, but this generates complication errors within C++ code elements.
@@ -100,6 +112,10 @@ __CIDENT_RCSID(gr_libw32_win32_errno_h,"$Id: win32_errno.h,v 1.17 2025/06/11 17:
100112
#define ETXTBSY 139 /* Text file busy; OWC=33. */
101113
#endif
102114

115+
/* conflicts */
116+
#define ETIMEDOUT2 138
117+
#define EWOULDBLOCK2 140
118+
103119
/* additional 141+ */
104120
#define EBADFD 141 /* Bad file descriptor. */
105121
#define EBADRQC 142
@@ -123,26 +139,81 @@ __CIDENT_RCSID(gr_libw32_win32_errno_h,"$Id: win32_errno.h,v 1.17 2025/06/11 17:
123139

124140
#endif /*LIBW32_WIN32_ERRNO_H_INCLUDED*/
125141

142+
143+
// -----------------------------------------------------------------------------------------------
144+
126145
/*
127146
* Outside include guard, set/verify WinSock error mapping.
128147
* Note: Force errors on inconsistent redefinitions
129148
*/
149+
150+
#if !defined(__MAKEDEPEND__)
151+
#if (EBADMSG != 104) /* Bad message. */
152+
#error Inconsistent EBSDMSG definition ....
153+
#endif
154+
#if (ECANCELED != 105) /* Operation canceled. */
155+
#error Inconsistent ECANCELED definition ....
156+
#endif
157+
#if (EIDRM != 111) /* Identifier removed. */
158+
#error Inconsistent EIDRM definition ....
159+
#endif
160+
#if (ENODATA != 120) /* No data. */
161+
#error Inconsistent ENODATA definition ....
162+
#endif
163+
#if (ENOLINK != 121) /* Virtual circuit is gone. */
164+
#error Inconsistent ENOLINK definition ....
165+
#endif
166+
#if (ENOMSG != 122) /* No message. */
167+
#error Inconsistent ENOMSG definition ....
168+
#endif
169+
#if (ENOSR != 124) /* No stream resources. */
170+
#error Inconsistent ENOSR definition ....
171+
#endif
172+
#if (ENOSTR != 125) /* Not a stream. */
173+
#error Inconsistent ENOSTR definition ....
174+
#endif
175+
#if (ENOTRECOVERABLE != 127) /* Not recoverable. */
176+
#error Inconsistent ENOTRECOVERABLE definition ....
177+
#endif
178+
#if (ENOTSUP != 129) /* Not supported. */
179+
#error Inconsistent ENOTSUP definition ....
180+
#endif
181+
#if (EOTHER != 131) /* Other error. */
182+
#error Inconsistent EOTHER definition ....
183+
#endif
184+
#if (EOVERFLOW != 132) /* Overflow. */
185+
#error Inconsistent EOVERFLOW definition ....
186+
#endif
187+
#if (EOWNERDEAD != 133) /* Owner dead. */
188+
#error Inconsistent EOWNERDEAD definition ....
189+
#endif
190+
#if (ETIME != 137) /* Stream ioctl timeout. */
191+
#error Inconsistent ETIME definition ....
192+
#endif
193+
#if (EPROTO != 134)
194+
#error Inconsistent EPROTO definition ....
195+
#endif
196+
#endif //__MAKEDEPEND__)
197+
198+
130199
#if defined(WSAEINTR) && !defined(__MAKEDEPEND__)
131200
// && !defined(LIBW32_ERRNO_WINSOCK)
132201
// #define LIBW32_ERRNO_WINSOCK
133202

203+
#define ESTRINGIZE(__x) __ESTRINGIZE(__x)
204+
#define __ESTRINGIZE(__x) #__x
205+
134206
#if !defined(EWOULDBLOCK)
135207
#define EWOULDBLOCK WSAEWOULDBLOCK /* 10035 "Operation would block" */
136208
#elif (EWOULDBLOCK != WSAEWOULDBLOCK)
137-
#define STRINGIZE(__x) __STRINGIZE(__x)
138-
#define __STRINGIZE(__x) #__x
139-
#pragma message("errno: EWOULDBLOCK(" STRINGIZE(EWOULDBLOCK) ") != WSAEWOULDBLOCK(" STRINGIZE(WSAEWOULDBLOCK) ")" )
209+
#pragma message "errno: EWOULDBLOCK(" ESTRINGIZE(EWOULDBLOCK) ") != WSAEWOULDBLOCK(" ESTRINGIZE(WSAEWOULDBLOCK) ")"
140210
#error Inconsistent EWOULDBLOCK definition ....
141211
#endif
142212

143213
#if !defined(EINPROGRESS)
144214
#define EINPROGRESS WSAEINPROGRESS /* 10036 "Operation now in progress" */
145215
#elif (EINPROGRESS != WSAEINPROGRESS)
216+
#pragma message "errno: EINPROGRESS(" ESTRINGIZE(EINPROGRESS) ") != WSAEINPROGRESS(" ESTRINGIZE(WSAEINPROGRESS) ")"
146217
#error Inconsistent EINPROGRESS definition ....
147218
#endif
148219

@@ -460,6 +531,6 @@ __CIDENT_RCSID(gr_libw32_win32_errno_h,"$Id: win32_errno.h,v 1.17 2025/06/11 17:
460531
#define ELOOP 10062 /* 10062 "Too many levels of symbolic links" */
461532
#endif
462533

463-
#endif /*LIBW32_WIN32_ERRNO_H_INCLUDED*/
534+
#endif //LIBW32_ERRNO_WINSOCK
464535

465536
/*end*/

0 commit comments

Comments
 (0)