GitHub|Download|Report a bug Mucc Home|Documentation»C Language Support

C Language Support

Mucc compiles C: C17 by default, C23 with -std=c23, and the GNU extensions real code uses. Its target is simple to state: any C program that gcc compiles for Linux should compile with mucc and do the same thing. Where it doesn't, that is a bug, unless it is listed under What Mucc Does Not Support.

Standards

-std=What you get
c89, c99, c11The older standards. They differ from C17 mostly in what's missing: each later one only adds to the one before it.
c17 (the default)C17, the C most code is written in today, with the GNU extensions
c23C23: constexpr, typeof, #embed, nullptr, bool, true and false as keywords, attributes in [[...]], __VA_OPT__, binary literals, digit separators, and the rest of what C23 adds, except _BitInt
gnu89 ... gnu23The same; the GNU extensions are always on

C Features

GNU Extensions

Builtins

gcc's builtins that real code uses: __builtin_expect, __builtin_unreachable, __builtin_constant_p, __builtin_offsetof, __builtin_types_compatible_p, __builtin_choose_expr, the overflow checks (__builtin_add_overflow and the rest), the bit counts (__builtin_clz, ctz, popcount, ...), byte swaps, __builtin_va_*, __builtin_alloca, the __atomic_* and __sync_* families, and others. fabs, fabsf and fabsl are builtins too, so they need no -lm.

Predefined Macros

Mucc defines what gcc does for the target, so code finds what it expects: __GNUC__ (4, as clang says), __STDC_VERSION__, __x86_64__ or __aarch64__, __linux__, __LP64__, __SIZEOF_*__, __CHAR_UNSIGNED__ on ARM64, and the rest. mucc -dM -E - < /dev/null lists them all.

What Mucc Does Not Support

The Details

Programs Known to Work

These build with mucc and pass their own test suites (test/thirdparty/):

With the bundled muslSQLite, Lua, Redis, Tcl, jq, zlib
With the system's glibcGit, libpng, QuickJS, TinyCC, and CPython (nearly all of its tests)
Andmucc itself, which rebuilds itself byte for byte