Skip to content

Add curl demo; fix declarator, fn-ptr-param, and Windows type/ABI gaps#266

Merged
kromych merged 6 commits into
masterfrom
compile/curl
Jul 1, 2026
Merged

Add curl demo; fix declarator, fn-ptr-param, and Windows type/ABI gaps#266
kromych merged 6 commits into
masterfrom
compile/curl

Conversation

@kromych

@kromych kromych commented Jul 1, 2026

Copy link
Copy Markdown
Owner

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.

kromych and others added 2 commits July 1, 2026 01:36
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>
@kromych

kromych commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author

kromych and others added 4 commits July 1, 2026 08:20
- 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>
@kromych kromych merged commit 3674a36 into master Jul 1, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant