Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
fe91871
bump release version
kromych Jul 1, 2026
76bf6fb
mach-o: route an executable's dynamic exports through the export trie
kromych Jul 2, 2026
fd8b755
elf: reject _Thread_local data in shared-library output
kromych Jul 2, 2026
7130eeb
preprocessor: literal-aware comment handling, missing #include is fatal
kromych Jul 2, 2026
293f58c
pe: sort the export name pointer table lexically
kromych Jul 2, 2026
58bf282
link: honor sh_addralign through data concat and image placement
kromych Jul 2, 2026
e4a9840
aggregate: allocate packed bitfield storage in the trailing repack
kromych Jul 2, 2026
d7d3c0e
initializer: nested-designator member dispatch, unbraced union conver…
kromych Jul 2, 2026
7a7f45f
headers: fix strtof/ioctl/shm_open bindings; runtime: C99 snprintf on…
kromych Jul 2, 2026
c49a75d
c5: track integer type facts through literals, constants, and operators
kromych Jul 2, 2026
48d8304
tests: re-pin the relocatable golden table, add fixture snapshots
kromych Jul 2, 2026
10acec9
headers: bundle TargetConditionals.h; sqlite3 demo passes its include…
kromych Jul 2, 2026
e67269e
headers: bundle fenv.h and the MSVC io.h surface
kromych Jul 2, 2026
c3d41ae
headers: bundle direct.h and intrin.h; case-insensitive Windows inclu…
kromych Jul 2, 2026
6976cf9
demos/raylib: complete the shim tree for includes the fatal diagnosti…
kromych Jul 2, 2026
59cfd5c
headers: bundle bcrypt.h; demos/curl: _mingw.h shim
kromych Jul 2, 2026
24958b7
volatile: carry the qualifier from the parser through the IR to emit
kromych Jul 2, 2026
e25f8a3
tests: snapshots for volatile-honoring codegen
kromych Jul 2, 2026
cc1f5cc
diag: qualifiers do not affect assignment compatibility
kromych Jul 2, 2026
e4b7665
walk: strip both qualifier bits before parameter band classification
kromych Jul 2, 2026
9287e8c
inline: resolve forward references in the multi-block splice
kromych Jul 2, 2026
dbca43a
reg_alloc: gate the sign-narrow shift fold on source-place survival
kromych Jul 2, 2026
ba621cd
shadow: attribute a one-past-the-end data reloc to its own object
kromych Jul 2, 2026
3c116b1
compiler: tail-jump sys trampolines for variadic libc bindings
kromych Jul 2, 2026
d02055c
compiler: carry the fn-pointer prototype through a block-scope typedef
kromych Jul 2, 2026
7cb22f6
aarch64: source atomic operands from the working-register save area
kromych Jul 2, 2026
1c3bfad
reg_alloc: make the inline setjmp intrinsic a call barrier
kromych Jul 2, 2026
4f9d9aa
x86_64: order mixed-aggregate eightbyte loads with the parallel move
kromych Jul 2, 2026
3e1f033
x86_64: classify a variadic callee's aggregate return eightbytes
kromych Jul 2, 2026
b2bf213
x86_64: stop va_copy from borrowing rcx unsaved
kromych Jul 2, 2026
cc3494f
x86_64: save rcx around a variable shift whenever it is allocated
kromych Jul 2, 2026
e8792c3
aarch64: apply the AAPCS64 B.5 post-increment check in va_arg
kromych Jul 2, 2026
de156ea
codegen: pass windows-arm64 variadic composites in the integer bank
kromych Jul 2, 2026
95ba779
tests: snapshots for the call-ABI and allocator fixes
kromych Jul 2, 2026
32203e2
compiler: record the prototype of a cast-to-fn-pointer callee
kromych Jul 2, 2026
1c28dcc
tests: snapshots for the cast-prototype fixtures
kromych Jul 2, 2026
819a491
headers: POSIX variadic fcntl on Linux; fixture: LLP64-safe shift widths
kromych Jul 2, 2026
d6c3858
vm, jit, compiler: fix execution-mode linkage and libc-shim defects
kromych Jul 2, 2026
c6db534
preprocessor: alias-chain blue paint, #if fixes, __has_include dirs
kromych Jul 2, 2026
fd78143
lexer: diagnose bytes that cannot start a token
kromych Jul 2, 2026
33ffad8
link: per-entry prologue anchors, weak-undef to zero, section pads
kromych Jul 2, 2026
4931d33
compiler: honor _Alignas up to 16, keep tentative defs over extern
kromych Jul 2, 2026
c7897fc
driver: on-demand archive members, link-preferred definitions, -c pra…
kromych Jul 2, 2026
4066646
headers, runtime: drop dead libc bindings, wire Windows tz outputs
kromych Jul 2, 2026
4a45c40
headers, runtime: tz data imports on both Windows arches; ucrt byteswap
kromych Jul 2, 2026
be4cb95
vm: pin the bound-data interp diagnostic test to an explicit target
kromych Jul 2, 2026
6915038
vm: ASCII-only comment in the e-conversion doc
kromych Jul 2, 2026
d343135
headers: bundle the CI-corpus include surfaces (real, no coverage loss)
kromych Jul 2, 2026
ec39a9d
lexer: wrap the octal accumulator like the other bases
kromych Jul 2, 2026
30fc6f7
parser: bound recursion depth with a diagnostic
kromych Jul 2, 2026
bab8658
c5: route the FP-typed ternary through the fused StoreLocal path
kromych Jul 2, 2026
ddcce68
c5: reconcile stale invariant comments with the code
kromych Jul 2, 2026
5b29022
windows, driver: POSIX setenv overwrite, JIT handle unification, arch…
kromych Jul 2, 2026
cffc32b
tests: snapshots for the M1/M5 medium fixes
kromych Jul 2, 2026
ae64481
windows: setenv as an inline overwrite-honoring wrapper, not a runtim…
kromych Jul 2, 2026
ffa5f51
vm: bridge _putenv_s so the Windows setenv wrapper runs under the int…
kromych Jul 2, 2026
bc9a612
headers: rustfmt the bundled-header registry additions
kromych Jul 2, 2026
e74ecf3
headers: bundle sys/cdefs.h and the CoreFoundation/SystemConfiguratio…
kromych Jul 2, 2026
55a7b0d
aarch64: honor folded FP displacement; widen call-site SP adjust
kromych Jul 2, 2026
29270c8
tests: snapshots for the aarch64 FP-displacement and SP-adjust codegen
kromych Jul 2, 2026
60f7286
tests: normalize CRLF in the auto-include printf assertion
kromych Jul 2, 2026
6a00184
object/linker: honor PE executable exports, drop bogus Mach-O data-im…
kromych Jul 2, 2026
f156029
headers: bundle os/lock.h and crt_externs.h for the macOS demos
kromych Jul 2, 2026
fd2cfac
c5: implement C99 variable-length arrays
kromych Jul 2, 2026
4b194dd
tests: snapshots for the VLA fixtures
kromych Jul 2, 2026
ae3555d
tests: compile _Thread_local per target instead of re-emitting a host…
kromych Jul 2, 2026
4e0abcf
tests: skip the VLA rejection fixtures in the compile-all smoke
kromych Jul 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ demos/curl/*
!demos/curl/curl_client.c
!demos/curl/curl_config.h
!demos/curl/curl_syslink.h
!demos/curl/_mingw.h
# stb -- a collection of single-file public-domain headers.
# `setup.py` pulls the upstream archive from the vendor-deps
# release and drops a curated set of headers into `demos/stb/`;
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "badc"
version = "0.1.1"
version = "0.1.2"
edition = "2024"
license = "MIT"
description = "A quick, slim cross-platform C compiler (also a compiler-as-library) (C99, C11, and more) with a JIT and native ELF / PE / Mach-O backends."
Expand Down
6 changes: 6 additions & 0 deletions demos/curl/_mingw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Demo-local <_mingw.h>. MinGW's internal glue header; the demo
* defines __MINGW32__ only to select curl's MinGW code paths, and the
* bundled headers already carry the referenced surface. */
#ifndef CURL_DEMO_MINGW_H
#define CURL_DEMO_MINGW_H
#endif
10 changes: 10 additions & 0 deletions demos/raylib/include/X11/Xresource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Xrm (resource manager) surface for the RGFW desktop backend. This
* shim tree keeps the Xrm types and prototypes in Xutil.h; the system
* header split is not mirrored here. */
#ifndef _X11_XRESOURCE_H_
#define _X11_XRESOURCE_H_

#include <X11/Xlib.h>
#include <X11/Xutil.h>

#endif
6 changes: 6 additions & 0 deletions demos/raylib/include/minwinbase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Demo-local <minwinbase.h>. The Windows SDK sub-header split is not
* mirrored here; the bundled <windows.h> carries the surface. */
#ifndef RGFW_DEMO_MINWINBASE_H
#define RGFW_DEMO_MINWINBASE_H
#include <windows.h>
#endif
6 changes: 6 additions & 0 deletions demos/raylib/include/minwindef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Demo-local <minwindef.h>. The Windows SDK sub-header split is not
* mirrored here; the bundled <windows.h> carries the surface. */
#ifndef RGFW_DEMO_MINWINDEF_H
#define RGFW_DEMO_MINWINDEF_H
#include <windows.h>
#endif
6 changes: 6 additions & 0 deletions demos/raylib/include/sdkddkver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Demo-local <sdkddkver.h>. The Windows SDK sub-header split is not
* mirrored here; the bundled <windows.h> carries the surface. */
#ifndef RGFW_DEMO_SDKDDKVER_H
#define RGFW_DEMO_SDKDDKVER_H
#include <windows.h>
#endif
4 changes: 4 additions & 0 deletions demos/sqlite3/smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ def build_shell(badc: Path, combined: bytes, out_path: Path, optimize: bool) ->
cmd: list[str | os.PathLike[str]] = [str(badc)]
if optimize:
cmd.append("-O")
# stdin input has no source directory, so shell.c's quoted
# `#include "sqlite3.h"` needs the demo directory on the search
# path (gcc would need the same -I for a stdin pipeline).
cmd += ["-I", str(Path(__file__).resolve().parent)]
cmd += ["-include", "msvc_compat.h", "-", "-o", str(out_path)]
cmd += [f"-D{d}" for d in BUILD_DEFINES]
subprocess.run(cmd, input=combined, check=True)
Expand Down
54 changes: 54 additions & 0 deletions headers/include/AvailabilityMacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// AvailabilityMacros.h -- macOS version gates. Version constants and
// the MIN_REQUIRED/MAX_ALLOWED derivation follow the SDK header; the
// compiler predefines __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
// to match the LC_BUILD_VERSION minimum it stamps.

#pragma once

#ifdef __APPLE__

#include <TargetConditionals.h>

// Encoded MMmm(pp): 10.x as 10x0 through 10.9, 10MM00/MM0000 after.
// Values from the SDK's <AvailabilityVersions.h>.
#define MAC_OS_X_VERSION_10_0 1000
#define MAC_OS_X_VERSION_10_1 1010
#define MAC_OS_X_VERSION_10_2 1020
#define MAC_OS_X_VERSION_10_3 1030
#define MAC_OS_X_VERSION_10_4 1040
#define MAC_OS_X_VERSION_10_5 1050
#define MAC_OS_X_VERSION_10_6 1060
#define MAC_OS_X_VERSION_10_7 1070
#define MAC_OS_X_VERSION_10_8 1080
#define MAC_OS_X_VERSION_10_9 1090
#define MAC_OS_X_VERSION_10_10 101000
#define MAC_OS_X_VERSION_10_11 101100
#define MAC_OS_X_VERSION_10_12 101200
#define MAC_OS_X_VERSION_10_13 101300
#define MAC_OS_X_VERSION_10_14 101400
#define MAC_OS_X_VERSION_10_15 101500
#define MAC_OS_X_VERSION_10_16 101600
#define MAC_OS_VERSION_11_0 110000
#define MAC_OS_VERSION_12_0 120000
#define MAC_OS_VERSION_13_0 130000
#define MAC_OS_VERSION_14_0 140000

#ifndef MAC_OS_X_VERSION_MIN_REQUIRED
#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
#define MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
#else
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_5
#endif
#endif

#ifndef MAC_OS_X_VERSION_MAX_ALLOWED
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_14_0
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_MIN_REQUIRED
#else
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_14_0
#endif
#endif

// TODO: AVAILABLE_MAC_OS_X_VERSION_* attribute decorators.

#endif
24 changes: 24 additions & 0 deletions headers/include/CoreFoundation/CoreFoundation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Minimal Apple CoreFoundation surface (<CoreFoundation/CoreFoundation.h>).
** Opaque CF*Ref handles are pointers; libSystem provides the runtime.
** Only the types and calls the bundled demos reference are declared. */
#pragma once

#ifdef __APPLE__

typedef const void *CFTypeRef;
typedef struct __CFString *CFStringRef;
typedef struct __CFDictionary *CFDictionaryRef;
typedef struct __CFAllocator *CFAllocatorRef;
typedef long CFIndex;
typedef unsigned long CFTypeID;

#pragma dylib(corefoundation, "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")
#pragma binding(corefoundation::CFRelease, "_CFRelease")
#pragma binding(corefoundation::CFRetain, "_CFRetain")
#pragma binding(corefoundation::CFGetTypeID, "_CFGetTypeID")

void CFRelease(CFTypeRef cf);
CFTypeRef CFRetain(CFTypeRef cf);
CFTypeID CFGetTypeID(CFTypeRef cf);

#endif
17 changes: 17 additions & 0 deletions headers/include/SystemConfiguration/SCDynamicStoreCopySpecific.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Apple SystemConfiguration dynamic-store queries
** (<SystemConfiguration/SCDynamicStoreCopySpecific.h>). Declares the
** subset the bundled demos reach for; the framework supplies the code. */
#pragma once

#ifdef __APPLE__

#include <CoreFoundation/CoreFoundation.h>

typedef struct __SCDynamicStore *SCDynamicStoreRef;

#pragma dylib(systemconfiguration, "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration")
#pragma binding(systemconfiguration::SCDynamicStoreCopyProxies, "_SCDynamicStoreCopyProxies")

CFDictionaryRef SCDynamicStoreCopyProxies(SCDynamicStoreRef store);

#endif
44 changes: 44 additions & 0 deletions headers/include/TargetConditionals.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* Apple platform-dispatch macros. The SDK header classifies the
** compilation target; code gates on TARGET_OS_* after including it
** unconditionally under __APPLE__. badc targets macOS only, so the
** macOS values are fixed; every other platform macro is 0. On
** non-Apple targets everything is 0, matching code that includes
** this header without an __APPLE__ guard. */
#pragma once

#ifdef __APPLE__
#define TARGET_OS_MAC 1
#define TARGET_OS_OSX 1
#else
#define TARGET_OS_MAC 0
#define TARGET_OS_OSX 0
#endif
#define TARGET_OS_WIN32 0
#define TARGET_OS_WINDOWS 0
#define TARGET_OS_UNIX 0
#define TARGET_OS_LINUX 0
#define TARGET_OS_IPHONE 0
#define TARGET_OS_IOS 0
#define TARGET_OS_WATCH 0
#define TARGET_OS_TV 0
#define TARGET_OS_VISION 0
#define TARGET_OS_SIMULATOR 0
#define TARGET_OS_EMBEDDED 0
#define TARGET_OS_MACCATALYST 0
#define TARGET_OS_DRIVERKIT 0

#ifdef __aarch64__
#define TARGET_CPU_ARM64 1
#define TARGET_CPU_X86_64 0
#else
#define TARGET_CPU_ARM64 0
#define TARGET_CPU_X86_64 1
#endif
#define TARGET_CPU_ARM 0
#define TARGET_CPU_X86 0
#define TARGET_CPU_PPC 0
#define TARGET_CPU_PPC64 0

#define TARGET_RT_LITTLE_ENDIAN 1
#define TARGET_RT_BIG_ENDIAN 0
#define TARGET_RT_64_BIT 1
7 changes: 7 additions & 0 deletions headers/include/aclapi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// aclapi.h -- access-control-list editing (advapi32). Consumers so far
// reach only the <windows.h> security types. TODO: SetEntriesInAclW,
// GetNamedSecurityInfoW, SetNamedSecurityInfoW.

#pragma once

#include <windows.h>
6 changes: 6 additions & 0 deletions headers/include/bcrypt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Windows CNG (<bcrypt.h>). The bound surface lives in the bundled
** <windows.h>; this header resolves the SDK's include split. */
#pragma once
#ifdef _WIN32
#include <windows.h>
#endif
16 changes: 6 additions & 10 deletions headers/include/conio.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
// MSVC CRT direct-console I/O (`_getch` family) plus the `_locking`
// mode constants. These entry points live in msvcrt.dll; the
// underscore-prefixed names are the spellings the CRT exports.
// MSVC CRT direct-console I/O (`_getch` family). These entry points
// live in msvcrt.dll; the underscore-prefixed names are the spellings
// the CRT exports.
#ifdef _WIN32
// `wchar_t` (<stddef.h>) and `wint_t` (<wchar.h>) back the wide
// console entry points below.
Expand Down Expand Up @@ -30,11 +30,7 @@ int _ungetch(int c);
wint_t _ungetwch(wint_t c);
int _kbhit(void);

// `_locking` mode argument (MSVC <sys/locking.h>). Values pinned by
// the CRT.
#define _LK_UNLCK 0
#define _LK_LOCK 1
#define _LK_NBLCK 2
#define _LK_RLCK 3
#define _LK_NBRLCK 4
// Callers historically reached the `_locking` mode constants through
// this header; they live in their CRT home now.
#include <sys/locking.h>
#endif
19 changes: 19 additions & 0 deletions headers/include/crt_externs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Apple <crt_externs.h>: accessors for the process argument and
** environment vectors, which a Mach-O image reaches through
** libSystem rather than as data symbols. */
#pragma once

#ifdef __APPLE__

#pragma dylib(libc, "/usr/lib/libSystem.B.dylib")
#pragma binding(libc::_NSGetEnviron, "__NSGetEnviron")
#pragma binding(libc::_NSGetArgc, "__NSGetArgc")
#pragma binding(libc::_NSGetArgv, "__NSGetArgv")
#pragma binding(libc::_NSGetProgname, "__NSGetProgname")

char ***_NSGetEnviron(void);
int *_NSGetArgc(void);
char ***_NSGetArgv(void);
char **_NSGetProgname(void);

#endif
37 changes: 37 additions & 0 deletions headers/include/crtdbg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// crtdbg.h -- CRT debug-heap and report interface. badc never defines
// _DEBUG, so this is the release shape of the UCRT header: report
// constants keep their values, entry points fold to the same no-op
// macros the UCRT uses. TODO: the _DEBUG report/heap entry points.

#pragma once

#ifdef _WIN32
#include <stdint.h>

typedef void *_HFILE;

#define _CRT_WARN 0
#define _CRT_ERROR 1
#define _CRT_ASSERT 2
#define _CRT_ERRCNT 3

#define _CRTDBG_MODE_FILE 0x1
#define _CRTDBG_MODE_DEBUG 0x2
#define _CRTDBG_MODE_WNDW 0x4
#define _CRTDBG_REPORT_MODE -1

#define _CRTDBG_INVALID_HFILE ((_HFILE)(intptr_t)-1)
#define _CRTDBG_HFILE_ERROR ((_HFILE)(intptr_t)-2)
#define _CRTDBG_FILE_STDOUT ((_HFILE)(intptr_t)-4)
#define _CRTDBG_FILE_STDERR ((_HFILE)(intptr_t)-5)
#define _CRTDBG_REPORT_FILE ((_HFILE)(intptr_t)-6)

#define _CrtSetReportMode(t, f) ((int)0)
#define _CrtSetReportFile(t, f) ((_HFILE)0)
#define _CrtSetDbgFlag(f) ((int)0)
#define _CrtCheckMemory() ((int)1)
#define _CrtDumpMemoryLeaks() ((int)0)
#define _CrtDbgBreak() ((void)0)
#define _ASSERT(expr) ((void)0)
#define _ASSERTE(expr) ((void)0)
#endif
18 changes: 18 additions & 0 deletions headers/include/direct.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* MSVC directory-management (<direct.h>): underscored POSIX-shaped
** calls over msvcrt. */
#pragma once

#ifdef _WIN32

#pragma dylib(msvcrt, "msvcrt.dll")
#pragma binding(msvcrt::_mkdir, "_mkdir")
#pragma binding(msvcrt::_rmdir, "_rmdir")
#pragma binding(msvcrt::_chdir, "_chdir")
#pragma binding(msvcrt::_getcwd, "_getcwd")

int _mkdir(char *path);
int _rmdir(char *path);
int _chdir(char *path);
char *_getcwd(char *buf, int size);

#endif
2 changes: 1 addition & 1 deletion headers/include/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ int openat(int dirfd, const char *path, int flags, ...);
#pragma binding(libc::splice, "splice")
#pragma binding(libc::posix_fadvise, "posix_fadvise")
#pragma binding(libc::posix_fallocate, "posix_fallocate")
int fcntl(int fd, int cmd, int arg);
int fcntl(int fd, int cmd, ...);
int openat(int dirfd, const char *path, int flags, ...);
// Move data between two descriptors, one of which must be a pipe; the
// `off_*` parameters are in/out file offsets or null.
Expand Down
Loading
Loading