Add curl demo; fix declarator, fn-ptr-param, and Windows type/ABI gaps#266
Merged
Conversation
demos/curl builds curl 8.11.1 with badc on every supported target as a static archive, a shared library, and an exe linked against each, plus a flavour linked against the system libcurl. HTTP + file:// + WebSocket with the threaded resolver and IPv6; HTTPS via badc-compiled BearSSL. Transfers run against a hermetic loopback server. Green on macOS aarch64, Linux x86_64/aarch64, and Windows x86_64 (the system and BearSSL lanes skip where the platform lacks a system libcurl or openssl). Compiler fixes (regression fixtures added): - A typedef name may be redeclared as a declarator identifier once a complete type specifier precedes it (C99 6.7.2p2); the typedef branch in the declaration-specifier and struct-field parsers is guarded with !saw_int_mod so `unsigned short bit;` after `typedef unsigned int bit;` parses. - A parameter that is a pointer to a function-pointer typedef gains one fn-pointer indirection level per leading `*`, so `*p = v` is a real dereference through the pointer rather than the `*fp == fp` decay no-op. Header additions. POSIX: sa_family_t, PF_*, IPPROTO_IP + IP options, the EAI_* family, MSG_NOSIGNAL/SO_NOSIGPIPE, CLOCK_MONOTONIC_RAW, and a new netinet/tcp.h. Windows: the missing type/ABI surface (LPTSTR/LPCTSTR, the WSA event family, wincrypt.h, tchar.h, _stati64/_fseeki64, ...); the Winsock struct timeval is 8 bytes (two 32-bit long fields); and the unsigned pointer-width types (SIZE_T/UINT_PTR/ULONG_PTR/DWORD_PTR) are unsigned so SOCKET compares correctly against INVALID_SOCKET. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The client only includes the public <curl/curl.h>, whose system.h keys curl_off_t / curl_socket_t on __MINGW32__ on Windows. Without it the __GNUC__ branch is taken, which resolves the types for x86_64 but leaves them undefined on aarch64 (curl.h:219 "type expected in struct field"). The library build already passed __MINGW32__; apply it to the client and TLS-client links so both Windows targets agree. No-op on POSIX. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
- BearSSL selects its RNG seeder automatically again: the Win32 CryptoAPI on Windows, /dev/urandom on POSIX. The `-DBR_USE_WIN32_RAND=0` override was a bring-up scope limiter from before the WinCrypt surface existed; drop it from the bearssl and curl smokes. Without a seeder, curl's BearSSL backend returns CURLE_FAILED_INIT on the TLS handshake (br_prng_seeder_system returns NULL), so HTTPS failed on Windows. - wincrypt.h gains CryptGenRandom (advapi32), which br_prng_seeder_system needs. - nt_loader: drop its own TCHAR typedef and select the wide surface via UNICODE so TCHAR comes from <windows.h>, which now provides it. The self-typedef collided with the windows.h definition. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The client requested line buffering (_IOLBF). The Windows legacy CRT does not honour it and falls back to full buffering, so a piped stdout held the whole run in a block buffer and lost it when the process-exit flush was preempted by lingering network worker threads -- an intermittent empty-stdout result (exit 0, transfer still succeeded) on Windows. Unbuffered output writes each line immediately on every platform. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Verified the _IOLBF behaviour with a no-flush (TerminateProcess) probe: the Windows C runtime treats _IOLBF as full buffering identically under badc and MSVC cl.exe, at -O0/-O and /Od//O2. It is a platform CRT property, not specific to the legacy CRT. No code change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
demos/curl builds curl 8.11.1 with badc on every supported target as a static archive, a shared library, and an exe linked against each, plus a flavour linked against the system libcurl. HTTP + file:// + WebSocket with the threaded resolver and IPv6; HTTPS via badc-compiled BearSSL. Transfers run against a hermetic loopback server. Green on macOS aarch64, Linux x86_64/aarch64, and Windows x86_64 (the system and BearSSL lanes skip where the platform lacks a system libcurl or openssl).
Compiler fixes (regression fixtures added):
unsigned short bit;aftertypedef unsigned int bit;parses.*, so*p = vis a real dereference through the pointer rather than the*fp == fpdecay no-op.Header additions. POSIX: sa_family_t, PF_, IPPROTO_IP + IP options, the EAI_ family, MSG_NOSIGNAL/SO_NOSIGPIPE, CLOCK_MONOTONIC_RAW, and a new netinet/tcp.h. Windows: the missing type/ABI surface (LPTSTR/LPCTSTR, the WSA event family, wincrypt.h, tchar.h, _stati64/_fseeki64, ...); the Winsock struct timeval is 8 bytes (two 32-bit long fields); and the unsigned pointer-width types (SIZE_T/UINT_PTR/ULONG_PTR/DWORD_PTR) are unsigned so SOCKET compares correctly against INVALID_SOCKET.