build: drop Windows CE / CeGCC support

Windows CE support was limited to successful builds with ming32ce
(a toolchain that hasn't seen an update since 2009, using an ancient gcc
version and "old mingw"-style SDK headers, that curl deprecated earlier).
Builds with MSVC were broken for a long time. mingw32ce builds were never
actually tested and runtime and unlikely to work due to missing stubs.
Windows CE toolchains also miss to comply with C89. Paired with lack of
demand and support for the platform, curl deprecated it earlier.

This patch removes support from the codebase to ease maintaining Windows
codepaths.

Follow-up to f98c0ba834 #17924
Follow-up to 8491e6574c #17379
Follow-up to 2a292c3984 #15975

Closes #17927
This commit is contained in:
Viktor Szakats 2025-07-15 00:36:08 +02:00
parent 2dc71ba8bf
commit 554dfa5568
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
81 changed files with 166 additions and 975 deletions

View file

@ -121,7 +121,7 @@ if(CURL_HAS_LTO)
set_target_properties(${EXE_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
if(ENABLE_UNICODE AND MINGW AND NOT MINGW32CE)
if(ENABLE_UNICODE AND MINGW)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
set_property(TARGET ${EXE_NAME} APPEND PROPERTY LINK_OPTIONS "-municode")
else()

View file

@ -64,7 +64,7 @@ unsigned int get_terminal_columns(void)
struct winsize ts;
if(!ioctl(STDIN_FILENO, TIOCGWINSZ, &ts))
cols = (int)ts.ws_col;
#elif defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
#elif defined(_WIN32) && !defined(CURL_WINDOWS_UWP)
{
HANDLE stderr_hnd = GetStdHandle(STD_ERROR_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO console_info;

View file

@ -156,7 +156,7 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
/*
* Truncate the etag save stream, it can have an existing etag value.
*/
#if defined(HAVE_FTRUNCATE) && !defined(__MINGW32CE__)
#ifdef HAVE_FTRUNCATE
if(ftruncate(fileno(etag_save->stream), 0)) {
return CURL_WRITEFUNC_ERROR;
}

View file

@ -122,11 +122,11 @@ size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
On Linux per->infd should be stdin (0) and the block below should not
execute */
if(per->uploadfile && !strcmp(per->uploadfile, ".") && per->infd > 0) {
#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP)
rc = CURL_RECV(per->infd, buffer, curlx_uztosi(sz * nmemb), 0);
if(rc < 0) {
if(SOCKERRNO == SOCKEWOULDBLOCK) {
CURL_SETERRNO(0);
errno = 0;
config->readbusy = TRUE;
return CURL_READFUNC_PAUSE;
}
@ -142,7 +142,7 @@ size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
rc = read(per->infd, buffer, sz*nmemb);
if(rc < 0) {
if(errno == EAGAIN) {
CURL_SETERRNO(0);
errno = 0;
config->readbusy = TRUE;
return CURL_READFUNC_PAUSE;
}

View file

@ -78,7 +78,7 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
}
#endif
#if defined(__AMIGA__) || defined(__MINGW32CE__)
#ifdef __AMIGA__
if(LSEEK_ERROR == lseek(per->infd, (off_t)offset, whence))
#else
if(LSEEK_ERROR == lseek(per->infd, offset, whence))

View file

@ -109,7 +109,7 @@ bool tool_create_output_file(struct OutStruct *outs,
return TRUE;
}
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
static size_t win_console(intptr_t fhnd, struct OutStruct *outs,
char *buffer, size_t bytes,
size_t *retp)
@ -247,7 +247,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
struct OperationConfig *config = per->config;
size_t bytes = sz * nmemb;
bool is_tty = global->isatty;
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
CONSOLE_SCREEN_BUFFER_INFO console_info;
intptr_t fhnd;
#endif
@ -321,7 +321,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
}
}
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
fhnd = _get_osfhandle(fileno(outs->stream));
/* if Windows console then UTF-8 must be converted to UTF-16 */
if(isatty(fileno(outs->stream)) &&

View file

@ -261,7 +261,7 @@ static void free_globalconfig(void)
global->trace_stream = NULL;
tool_safefree(global->libcurl);
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
free(global->term.buf);
#endif
}

View file

@ -326,7 +326,7 @@ struct OperationConfig {
BIT(skip_existing);
};
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
struct termout {
wchar_t *buf;
DWORD len;
@ -343,7 +343,7 @@ struct GlobalConfig {
struct OperationConfig *first;
struct OperationConfig *current;
struct OperationConfig *last;
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
struct termout term;
#endif
timediff_t ms_per_transfer; /* start next transfer after (at least) this

View file

@ -23,8 +23,8 @@
***************************************************************************/
#include "tool_setup.h"
#if defined(_WIN32) && !defined(UNDER_CE)
# include <direct.h>
#ifdef _WIN32
#include <direct.h>
#endif
#include "tool_dirhie.h"

View file

@ -561,7 +561,7 @@ char **__crt0_glob_function(char *arg)
#ifdef _WIN32
#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) && \
#if !defined(CURL_WINDOWS_UWP) && \
!defined(CURL_DISABLE_CA_SEARCH) && !defined(CURL_CA_SEARCH_SAFE)
/* Search and set the CA cert file for Windows.
*
@ -613,7 +613,7 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
struct curl_slist *GetLoadedModulePaths(void)
{
struct curl_slist *slist = NULL;
#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
#ifndef CURL_WINDOWS_UWP
HANDLE hnd = INVALID_HANDLE_VALUE;
MODULEENTRY32 mod = {0};
@ -664,7 +664,7 @@ cleanup:
bool tool_term_has_bold;
#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
#ifndef CURL_WINDOWS_UWP
/* The terminal settings to restore on exit */
static struct TerminalSettings {
HANDLE hStdOut;
@ -735,14 +735,14 @@ static void init_terminal(void)
CURLcode win32_init(void)
{
curlx_now_init();
#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
#ifndef CURL_WINDOWS_UWP
init_terminal();
#endif
return CURLE_OK;
}
#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
#ifndef CURL_WINDOWS_UWP
/* The following STDIN non - blocking read techniques are heavily inspired
by nmap and ncat (https://nmap.org/ncat/) */
struct win_thread_data {
@ -949,7 +949,7 @@ curl_socket_t win32_stdin_read_thread(void)
return socket_r;
}
#endif /* !CURL_WINDOWS_UWP && !UNDER_CE */
#endif /* !CURL_WINDOWS_UWP */
#endif /* _WIN32 */

View file

@ -47,7 +47,7 @@ char **__crt0_glob_function(char *arg);
#ifdef _WIN32
#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) && \
#if !defined(CURL_WINDOWS_UWP) && \
!defined(CURL_DISABLE_CA_SEARCH) && !defined(CURL_CA_SEARCH_SAFE)
CURLcode FindWin32CACert(struct OperationConfig *config,
const TCHAR *bundle_file);
@ -55,9 +55,9 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
struct curl_slist *GetLoadedModulePaths(void);
CURLcode win32_init(void);
#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
#ifndef CURL_WINDOWS_UWP
curl_socket_t win32_stdin_read_thread(void);
#endif /* !CURL_WINDOWS_UWP && !UNDER_CE */
#endif
#endif /* _WIN32 */

View file

@ -121,11 +121,7 @@ static struct tool_mime *tool_mime_new_filedata(struct tool_mime *parent,
}
}
else { /* Standard input. */
#ifdef UNDER_CE
int fd = STDIN_FILENO;
#else
int fd = fileno(stdin);
#endif
char *data = NULL;
curl_off_t size;
curl_off_t origin;

View file

@ -379,7 +379,7 @@ void parse_cert_parameter(const char *cert_parameter,
ParameterError parse_args(int argc, argv_item_t argv[]);
#if defined(UNICODE) && defined(_WIN32) && !defined(UNDER_CE)
#if defined(UNICODE) && defined(_WIN32)
#define convert_UTF8_to_tchar(ptr) curlx_convert_UTF8_to_wchar((ptr))
#define convert_tchar_to_UTF8(ptr) curlx_convert_wchar_to_UTF8((ptr))

View file

@ -42,7 +42,7 @@
# include iodef
#endif
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
# include <conio.h>
#endif
@ -115,7 +115,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
return buffer; /* we always return success */
}
#define DONE
#endif /* _WIN32 && !UNDER_CE */
#endif /* _WIN32 */
#ifndef DONE /* not previously provided */

View file

@ -27,9 +27,7 @@
#include <tchar.h>
#endif
#ifndef UNDER_CE
#include <signal.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
@ -143,7 +141,7 @@ static void memory_tracking_init(void)
/*
** curl tool main function.
*/
#if defined(_UNICODE) && !defined(UNDER_CE)
#ifdef _UNICODE
#if defined(__GNUC__) || defined(__clang__)
/* GCC does not know about wmain() */
#pragma GCC diagnostic push
@ -159,7 +157,7 @@ int main(int argc, char *argv[])
tool_init_stderr();
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
/* Undocumented diagnostic option to list the full paths of all loaded
modules. This is purposely pre-init. */
if(argc == 2 && !_tcscmp(argv[1], _T("--dump-module-paths"))) {
@ -169,8 +167,7 @@ int main(int argc, char *argv[])
curl_slist_free_all(head);
return head ? 0 : 1;
}
#endif
#ifdef _WIN32
/* win32_init must be called before other init routines. */
result = win32_init();
if(result) {
@ -214,7 +211,7 @@ int main(int argc, char *argv[])
#endif
}
#if defined(_UNICODE) && !defined(UNDER_CE)
#ifdef _UNICODE
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif

View file

@ -555,25 +555,19 @@ static CURLcode retrycheck(struct OperationConfig *config,
}
if(truncate && outs->bytes && outs->filename && outs->stream) {
#ifndef __MINGW32CE__
struct_stat fileinfo;
/* The output can be a named pipe or a character device etc that
cannot be truncated. Only truncate regular files. */
if(!fstat(fileno(outs->stream), &fileinfo) &&
S_ISREG(fileinfo.st_mode))
#else
/* Windows CE's fileno() is bad so just skip the check */
#endif
{
S_ISREG(fileinfo.st_mode)) {
int rc;
/* We have written data to an output file, we truncate file */
fflush(outs->stream);
notef("Throwing away %" CURL_FORMAT_CURL_OFF_T " bytes",
outs->bytes);
/* truncate file at the position where we started appending */
#if defined(HAVE_FTRUNCATE) && !defined(__DJGPP__) && !defined(__AMIGA__) && \
!defined(__MINGW32CE__)
#if defined(HAVE_FTRUNCATE) && !defined(__DJGPP__) && !defined(__AMIGA__)
if(ftruncate(fileno(outs->stream), outs->init)) {
/* when truncate fails, we cannot just append as then we will
create something strange, bail out */
@ -625,7 +619,7 @@ static CURLcode post_per_transfer(struct per_transfer *per,
if(per->uploadfile) {
if(!strcmp(per->uploadfile, ".") && per->infd > 0) {
#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP)
sclose(per->infd);
#else
warnf("Closing per->infd != 0: FD == "
@ -1122,7 +1116,7 @@ static void check_stdin_upload(struct OperationConfig *config,
CURLX_SET_BINMODE(stdin);
if(!strcmp(per->uploadfile, ".")) {
#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP)
/* non-blocking stdin behavior on Windows is challenging
Spawn a new thread that will read from stdin and write
out to a socket */
@ -2100,8 +2094,7 @@ static CURLcode cacertpaths(struct OperationConfig *config)
goto fail;
}
}
#elif !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) && \
!defined(CURL_DISABLE_CA_SEARCH)
#elif !defined(CURL_WINDOWS_UWP) && !defined(CURL_DISABLE_CA_SEARCH)
result = FindWin32CACert(config, TEXT("curl-ca-bundle.crt"));
if(result)
goto fail;
@ -2234,11 +2227,8 @@ CURLcode operate(int argc, argv_item_t argv[])
{
CURLcode result = CURLE_OK;
const char *first_arg;
#ifdef UNDER_CE
first_arg = argc > 1 ? strdup(argv[1]) : NULL;
#else
first_arg = argc > 1 ? convert_tchar_to_UTF8(argv[1]) : NULL;
#endif
#ifdef HAVE_SETLOCALE
/* Override locale for number parsing (only) */

View file

@ -100,7 +100,7 @@ ParameterError parseconfig(const char *filename, int max_recursive)
}
filename = pathalloc = curlrc;
}
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
else {
char *fullp;
/* check for .curlrc then _curlrc in the directory of the executable */

View file

@ -93,15 +93,6 @@ extern FILE *tool_stderr;
/* set in init_terminal() */
extern bool tool_term_has_bold;
#ifdef UNDER_CE
# undef isatty
# define isatty(fd) 0 /* fd is void*, expects int */
# undef _get_osfhandle
# define _get_osfhandle(fd) (fd)
# undef _getch
# define _getch() 0
#endif
#ifndef HAVE_FTRUNCATE
int tool_ftruncate64(int fd, curl_off_t where);

View file

@ -80,17 +80,9 @@ int struplocompare4sort(const void *p1, const void *p2)
}
#ifdef USE_TOOL_FTRUNCATE
#ifdef UNDER_CE
/* 64-bit lseek-like function unavailable */
# undef _lseeki64
# define _lseeki64(hnd,ofs,whence) lseek(hnd,ofs,whence)
#endif
/*
* Truncate a file handle at a 64-bit position 'where'.
*/
int tool_ftruncate64(int fd, curl_off_t where)
{
intptr_t handle = _get_osfhandle(fd);
@ -103,10 +95,9 @@ int tool_ftruncate64(int fd, curl_off_t where)
return 0;
}
#endif /* USE_TOOL_FTRUNCATE */
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
FILE *tool_execpath(const char *filename, char **pathp)
{
static char filebuffer[512];

View file

@ -34,7 +34,7 @@ struct timeval tvrealnow(void);
int struplocompare(const char *p1, const char *p2);
int struplocompare4sort(const void *p1, const void *p2);
#if defined(_WIN32) && !defined(UNDER_CE)
#ifdef _WIN32
FILE *tool_execpath(const char *filename, char **pathp);
#endif