The Entirety of a Language

The smallest piece of self-contained, executable code that showcases 100% of a programming language's grammar, keywords, types, and directives. Zero warnings under pedantic compiler flags.

GitLab Upstream (Canonical) GitHub Mirror (SHA-1) OpenLat Mirror
omni / c / c23.c Modern Standard

ISO/IEC 9899:2024 (C23)

Full ISO C23 standard reference with standard attributes, extended #embed parameters, constexpr, nullptr, typeof, typeof_unqual, _BitInt, binary literals, and digit separators.

Verification Command -std=c23 -Wall -Wextra -pedantic -Werror -pthread -lm
Lexical Metrics 501 lines • 59 / 59 keywords saturated
Threat Model Anchors
Standard Capabilities Showcase (7 items)
  • Extended #embed with limit, prefix, suffix, and if_empty parameters
  • Standard attributes ([[nodiscard]], [[maybe_unused]], [[reproducible]], [[unsequenced]], [[noreturn]])
  • constexpr, bool/true/false, nullptr, typeof, typeof_unqual
  • Bit-precise integers (_BitInt) with variable widths
  • Binary literals (0b...) and single-quote digit separators
  • Dual-Path Saturation Pattern for Annex F/H (DFP) and Annex G (Imaginary)
  • Scalar state accumulator consuming all symbols without unused-variable warnings
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
/*
 * omni: c23.c
 * Canonical, exhaustive ISO/IEC 9899:2024 (C23) language syntax compendium.
 * Build: $(CC) -std=c23 -Wall -Wextra -pedantic -Werror -pthread c23.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdarg.h>
#include <stdbool.h>
#include <uchar.h>
#include <complex.h>
#include <stdatomic.h>
#include <stdbit.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (ISO C23 Clause 6.10)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE_TOKENS(a, b) a ## b
#define LOG_FMT(fmt, ...) printf(fmt __VA_OPT__(,) __VA_ARGS__)

#undef OMNI_UNDEFINED_FLAG
#define OMNI_ACTIVE_MACRO 1

#if __has_include(<stdio.h>)
#  if __has_c_attribute(nodiscard)
#    define HAS_NODISCARD_ATTR 1
#  endif
#elifdef OMNI_UNDEFINED_FLAG
#  error "Unreachable branch: elifdef"
#elifndef OMNI_ACTIVE_MACRO
#  error "Unreachable branch: elifndef"
#else
#  error "Unreachable branch: else"
#endif

#if 0
#warning "Standard C23 diagnostic warning directive"
#pragma STDC FP_CONTRACT ON
#endif

#if defined(__clang__)
#  pragma clang diagnostic push
#  pragma clang diagnostic ignored "-W#pragma-messages"
#endif
_Pragma("message(\"Omni: Verifying ISO C23 Language Construct Compliance\")")
#if defined(__clang__)
#  pragma clang diagnostic pop
#endif

/*
 * Section 2: Standard Attributes (Clause 6.7.12) and Assertions
 */

static_assert(__STDC_VERSION__ >= 202311L, "Must be ISO C23 or later");
static_assert(sizeof(int32_t) == 4);
static_assert(sizeof(int64_t) == 8, "int64_t must be 8 bytes");
_Static_assert(sizeof(char) == 1, "char is 1 byte by definition");

#if __has_c_attribute(reproducible)
#  define ATTR_REPRODUCIBLE [[reproducible]]
#else
#  define ATTR_REPRODUCIBLE
#endif

#if __has_c_attribute(unsequenced)
#  define ATTR_UNSEQUENCED [[unsequenced]]
#else
#  define ATTR_UNSEQUENCED
#endif

[[nodiscard("computation result must be consumed")]]
static inline int math_square(int x) ATTR_REPRODUCIBLE {
    return x * x;
}

static inline int math_increment(int x) ATTR_UNSEQUENCED {
    return x + 1;
}

[[deprecated("use modern_terminator instead")]]
[[maybe_unused]]
_Noreturn static void legacy_terminator(void) {
    exit(EXIT_FAILURE);
}

[[noreturn]]
static void modern_terminator(void) {
    unreachable();
}

/*
 * Section 3: Types, Enums, Bitfields, and Complex Declarators (Clause 6.7)
 */

/*
 * Dual-Path Saturation Pattern (ISO C23 Clause 6.4.1):
 * Optional normative keywords (Annex F/H DFP and Annex G Imaginary)
 */
#ifdef __STDC_IEC_60559_DFP__
static _Decimal32  active_d32  = 1.0DF;
static _Decimal64  active_d64  = 1.0DD;
static _Decimal128 active_d128 = 1.0DL;
#else
#  if 0
typedef _Decimal32  d32_ref;
typedef _Decimal64  d64_ref;
typedef _Decimal128 d128_ref;
#  endif
#endif

#ifdef __STDC_IEC_559_COMPLEX__
/* Annex G Imaginary types supported */
#else
#  if 0
typedef _Imaginary double imag_ref;
#  endif
#endif

typedef enum StateMachine : uint8_t {
    STATE_INIT = 0,
    STATE_WORK = 1,
    STATE_DONE = 2
} StateMachine;

typedef union RegisterWord {
    uint32_t raw;
    /* [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness */
    struct {
        uint32_t flag_a : 1;
        uint32_t flag_b : 1;
        uint32_t        : 2; /* Unnamed bitfield padding */
        uint32_t        : 0; /* Zero-width bitfield forces alignment to next boundary */
        uint32_t payload : 16;
    } bits;
} RegisterWord;

struct AlignedBlock {
    alignas(16) uint8_t simd_buffer[16];
    alignas(double) char aligned_as_double;
    _Alignas(16) uint8_t legacy_aligned[16];
};

struct Container {
    union {
        int id;
        float alt_id;
    };
    struct {
        uint16_t sub_code;
        double precision;
    };
};

typedef struct DynamicPacket {
    size_t length;
    int payload[]; /* Flexible array member */
} DynamicPacket;

/* Complex function and array pointer declarators */
static int static_array_data[3] = {100, 200, 300};

static int (*array_pointer_provider(void))[3] {
    return &static_array_data;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) { return a * b; }
static binary_op_fn dispatch_table[1] = { op_multiply };

/* Function prototype with variable length array dimension indicator [*] */
void matrix_worker(int rows, int cols, double matrix[*][*]);

void matrix_worker(int rows, int cols, double matrix[rows][cols]) {
    if (rows > 0 && cols > 0) matrix[0][0] = 42.0;
}

/* Parameter array qualified with static and restrict */
static void qualified_consumer(int buffer[static restrict 4]) {
    buffer[0] += 1;
}

/* Variadic function */
static int sum_variadic(size_t count, ...) {
    va_list ap;
    va_start(ap, count);
    int total = 0;
    for (size_t i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

/* C23 empty parameter list means (void) */
static int empty_param_worker() {
    return 7;
}

/* Generic type selection macro */
#define TYPE_NAME(x) _Generic((x), \
    bool: "bool", \
    char: "char", \
    signed char: "signed char", \
    unsigned char: "unsigned char", \
    short: "short", \
    unsigned short: "unsigned short", \
    int: "int", \
    unsigned int: "unsigned int", \
    long: "long", \
    unsigned long: "unsigned long", \
    long long: "long long", \
    unsigned long long: "unsigned long long", \
    float: "float", \
    double: "double", \
    long double: "long double", \
    nullptr_t: "nullptr_t", \
    default: "pointer/other")

/*
 * Section 4: Execution Context, Linkage, and Main Driver
 */

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 0xAA;

static void sigint_handler(int sig) {
    (void)sig;
}

int main(void) {
    /* Storage classes and type inference */
    auto deduced_double = 3.141592653589793;
    auto int legacy_auto = 1;
    register int fast_counter = 0;
    static unsigned long run_counter = 0;
    thread_local static int tls_var = 42;
    _Thread_local static int legacy_tls_var = 84;

    /* Constants, keywords, and type operators */
    constexpr int compile_magic = 0xBEEF;
    bool active_flag = true;
    active_flag = false;
    _Bool legacy_bool_flag = false; /* Retained keyword in ISO C23 §6.4.1 */
    nullptr_t null_token = nullptr;
    int *null_ptr = nullptr;

    /* Type-generic bitwise operations from stdbit.h (C23) */
    unsigned int bit_sample = 0b0001'0000;
    bool single_bit_flag = stdc_has_single_bit(bit_sample);
    unsigned int l_zeros = stdc_leading_zeros(bit_sample);

    typeof(deduced_double) cloned_double = 2.71828;
    typeof_unqual(const volatile int) clean_integer = 128;

    /* Scalar types and literals */
    signed char s_char = -12;
    unsigned char u_char = 255U;
    short s_short = -32767;
    unsigned short u_short = 65535U;
    int s_int = -2147483647;
    unsigned int u_int = 4294967295U;
    long s_long = -2147483647L;
    unsigned long u_long = 4294967295UL;
    long long s_llong = -9'223'372'036'854'775'807LL;
    unsigned long long u_llong = 18'446'744'073'709'551'615ULL;

    /* Alignment operators */
    size_t align_c23 = alignof(struct AlignedBlock);
    size_t align_c11 = _Alignof(struct AlignedBlock);

    /* Digit separators, octal, binary, and hex floating point */
    int octal_literal = 0755;
    int binary_literal = 0b1010'1111'0000'0101;
    double hex_float = 0x1.0p-3;
    float dec_float = 1.25e-2f;
    long double ext_float = 1.0L;

    /* Universal character names in identifiers */
    int \u03c0_symbol = 314;

    /* Complex types */
    float complex complex_f = 1.0f + 2.0f * I;
    double _Complex complex_d = 3.0 + 4.0 * I;

    /* Character and string literals (standard, wide, unicode, UTF-8 char) */
    char c_ascii = 'A';
    wchar_t c_wide = L'Ω';
    char16_t c_u16 = u'ñ';
    char32_t c_u32 = U'Ψ';
    unsigned char c_u8 = u8'z';
    const char *s_ascii = "ASCII string";
    const wchar_t *s_wide = L"Wide string";
    const char16_t *s_u16 = u"UTF-16 string";
    const char32_t *s_u32 = U"UTF-32 string";
    const char8_t *s_u8 = u8"UTF-8 string";

    /* Exact-width integers */
#if defined(__BITINT_MAXWIDTH__)
    _BitInt(24) bit_int_val = -1234wb;
    unsigned _BitInt(48) u_bit_int_val = 0xABCD'EF01uwb;
#endif

    /* Qualifiers and atomic operations */
    const volatile int hw_reg = 0xCAFE;
    const volatile int *ptr_hw = &hw_reg;
    int memory_target = 10;
    int *const const_p = &memory_target;
    int *restrict restrict_p = &memory_target;

    /* [!SECURITY-NOTE: SEC-ATOMIC-01] Relaxed atomic operations lack synchronization barriers */
    _Atomic int atomic_counter = 0;
    _Atomic(uint32_t) atomic_wrapped = 100U;
    atomic_init(&atomic_counter, 1);
    atomic_fetch_add_explicit(&atomic_counter, 2, memory_order_relaxed);
    atomic_store_explicit(&atomic_wrapped, 200U, memory_order_release);
    atomic_flag atomic_spin = ATOMIC_FLAG_INIT;
    bool spin_acquired = !atomic_flag_test_and_set(&atomic_spin);
    if (spin_acquired) {
        atomic_flag_clear(&atomic_spin);
    }

    /* Universal zero-initializers, designated initializers, compound literals */
    int universal_zero_array[4] = {};
    struct Container empty_container = {};
    struct Container filled_container = {
        .id = 500,
        .sub_code = 12,
        .precision = 3.14159265
    };
    RegisterWord reg_word = {
        .bits = { .flag_a = 1, .flag_b = 0, .payload = 0x7FFF }
    };
    int sparse_indices[5] = { [0] = 1, [3] = 4 };

    int *compound_arr = (int[]){ 10, 20, 30 };
    struct Container compound_cont = (struct Container){ .id = 99, .sub_code = 1 };

    /* [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object (stack exhaustion hazard) */
    size_t dynamic_dim = (size_t)(fast_counter + 3);
    int vla_block[dynamic_dim];
    vla_block[0] = math_square(5);

    /* VM (variably modified) type pointer (mandatory in ISO C23) */
    int (*vm_ptr)[dynamic_dim] = &vla_block;

    /* Dynamic allocation with flexible array member */
    DynamicPacket *packet = malloc(sizeof(DynamicPacket) + (sizeof(int) * 2));
    if (packet) {
        packet->length = 2;
        packet->payload[0] = 0x11;
        packet->payload[1] = 0x22;
        free(packet);
    }

    /* Embedded resource parameters */
#if defined(__has_embed)
#  if __has_embed("c23.c")
    static const unsigned char embedded_data[] = {
#    embed "c23.c" limit(4) prefix(0xAA, ) suffix(, 0xFF) if_empty(0x00)
    };
    int embed_checksum = embedded_data[0] + embedded_data[5];
#  else
    int embed_checksum = 0;
#  endif
#else
    int embed_checksum = 0;
#endif

    /* Operators, associativity, precedence chaining */
    int op_x = 20, op_y = 6;
    int arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    int bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    bool logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    int ternary = logical ? (reg_word.bits.flag_a ? 100 : 200) : 300;
    int comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    /* Control flow and modern C23 label placement */
    StateMachine state = STATE_WORK;

    if (ternary == 100 && (state == STATE_WORK)) {
        goto label_pre_declaration;
    } else {
        while (false) {}
    }

label_pre_declaration:
    /* C23: Label placed directly before a declaration */
    int newly_declared_in_scope = 42;

    do {
        switch (state) {
            case STATE_INIT:
                run_counter++;
                [[fallthrough]];
            case STATE_WORK:
                for (int i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATE_DONE:
                break;
            default:
                modern_terminator();
        }
    } while (0);

    {
        goto scoped_entry;
    scoped_entry:
        int scoped_num = 1;
        (void)scoped_num;
    [[maybe_unused]] label_block_terminal:
        /* C23: Label placed at the end of a block without trailing semicolon */
    }

    /* Non-local jumps, signals, floating-point environment */
    /* [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers */
    volatile bool jump_performed = false;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = true;
            longjmp(nonlocal_buf, 1);
        }
    }
    signal(SIGINT, sigint_handler);

    /* Calling function pointers, VLA prototypes, and qualifiers */
    array_provider_fn provider = array_pointer_provider;
    int (*resolved_triplet)[3] = provider();
    int triplet_element = (*resolved_triplet)[1];

    int dispatch_result = dispatch_table[0](10, 5);

    double test_matrix[2][2] = {};
    matrix_worker(2, 2, test_matrix);

    int test_seq[4] = {1, 2, 3, 4};
    qualified_consumer(test_seq);

    int variadic_sum = sum_variadic(3, 10, 20, 30);
    int empty_param_res = empty_param_worker();

    /* Predefined macros and token pasting */
    int GLUE_TOKENS(verified_, variable) = 999;
    const char *active_fn = __func__;

    LOG_FMT("File: %s | Line: %d | Func: %s | Token: %d\n",
            __FILE__, __LINE__, active_fn, verified_variable);

    printf("Omni C23 Verification: Type=%s | Square=%d | Incr=%d | Sum=%d | State=%u\n",
           TYPE_NAME(compile_magic), math_square(4), math_increment(9),
           variadic_sum, (unsigned)state);

    /*
     * Compact state hash: Consumes all declared scalars to guarantee
     * full compilation coverage without dead (void) suppressions.
     */
    long double checksum =
        (long double)legacy_auto + deduced_double + cloned_double + clean_integer +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        (s_llong + u_llong) + binary_literal + hex_float + dec_float + ext_float +
        creal(complex_f) + cimag(complex_d) + c_ascii + (int)c_wide + (int)c_u16 +
        (int)c_u32 + c_u8 + s_ascii[0] + s_wide[0] + s_u16[0] + s_u32[0] + s_u8[0] +
        *ptr_hw + *const_p + *restrict_p + atomic_counter + atomic_wrapped +
        universal_zero_array[0] + empty_container.id + filled_container.precision +
        reg_word.raw + sparse_indices[0] + compound_arr[0] + compound_cont.id +
        vla_block[0] + embed_checksum + arithmetic + bitwise + (int)logical +
        comma_res + newly_declared_in_scope + triplet_element + dispatch_result +
        test_matrix[0][0] + test_seq[0] + empty_param_res + run_counter +
        tls_var + legacy_tls_var + external_symbol + (null_token == null_ptr ? 1 : 0) +
        (active_flag ? 1 : 0) + (spin_acquired ? 1 : 0) +
        align_c23 + align_c11 + octal_literal + \u03c0_symbol +
        (legacy_bool_flag ? 1 : 0) + (single_bit_flag ? 1 : 0) + l_zeros + (*vm_ptr)[0];

#if defined(__BITINT_MAXWIDTH__)
    checksum += (long double)bit_int_val + (long double)u_bit_int_val;
#endif

    if (isnan((double)checksum)) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
/*
 * omni: c23.c
 * Canonical, exhaustive ISO/IEC 9899:2024 (C23) language syntax compendium.
 * Build: $(CC) -std=c23 -Wall -Wextra -pedantic -Werror -pthread c23.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdarg.h>
#include <stdbool.h>
#include <uchar.h>
#include <complex.h>
#include <stdatomic.h>
#include <stdbit.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (ISO C23 Clause 6.10)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE_TOKENS(a, b) a ## b
#define LOG_FMT(fmt, ...) printf(fmt __VA_OPT__(,) __VA_ARGS__)

#undef OMNI_UNDEFINED_FLAG
#define OMNI_ACTIVE_MACRO 1

#if __has_include(<stdio.h>)
#  if __has_c_attribute(nodiscard)
#    define HAS_NODISCARD_ATTR 1
#  endif
#elifdef OMNI_UNDEFINED_FLAG
#  error "Unreachable branch: elifdef"
#elifndef OMNI_ACTIVE_MACRO
#  error "Unreachable branch: elifndef"
#else
#  error "Unreachable branch: else"
#endif

#if 0
#warning "Standard C23 diagnostic warning directive"
#pragma STDC FP_CONTRACT ON
#endif

#if defined(__clang__)
#  pragma clang diagnostic push
#  pragma clang diagnostic ignored "-W#pragma-messages"
#endif
_Pragma("message(\"Omni: Verifying ISO C23 Language Construct Compliance\")")
#if defined(__clang__)
#  pragma clang diagnostic pop
#endif

/*
 * Section 2: Standard Attributes (Clause 6.7.12) and Assertions
 */

static_assert(__STDC_VERSION__ >= 202311L, "Must be ISO C23 or later");
static_assert(sizeof(int32_t) == 4);
static_assert(sizeof(int64_t) == 8, "int64_t must be 8 bytes");
_Static_assert(sizeof(char) == 1, "char is 1 byte by definition");

#if __has_c_attribute(reproducible)
#  define ATTR_REPRODUCIBLE [[reproducible]]
#else
#  define ATTR_REPRODUCIBLE
#endif

#if __has_c_attribute(unsequenced)
#  define ATTR_UNSEQUENCED [[unsequenced]]
#else
#  define ATTR_UNSEQUENCED
#endif

[[nodiscard("computation result must be consumed")]]
static inline int math_square(int x) ATTR_REPRODUCIBLE {
    return x * x;
}

static inline int math_increment(int x) ATTR_UNSEQUENCED {
    return x + 1;
}

[[deprecated("use modern_terminator instead")]]
[[maybe_unused]]
_Noreturn static void legacy_terminator(void) {
    exit(EXIT_FAILURE);
}

[[noreturn]]
static void modern_terminator(void) {
    unreachable();
}

/*
 * Section 3: Types, Enums, Bitfields, and Complex Declarators (Clause 6.7)
 */

/*
 * Dual-Path Saturation Pattern (ISO C23 Clause 6.4.1):
 * Optional normative keywords (Annex F/H DFP and Annex G Imaginary)
 */
#ifdef __STDC_IEC_60559_DFP__
static _Decimal32  active_d32  = 1.0DF;
static _Decimal64  active_d64  = 1.0DD;
static _Decimal128 active_d128 = 1.0DL;
#else
#  if 0
typedef _Decimal32  d32_ref;
typedef _Decimal64  d64_ref;
typedef _Decimal128 d128_ref;
#  endif
#endif

#ifdef __STDC_IEC_559_COMPLEX__
/* Annex G Imaginary types supported */
#else
#  if 0
typedef _Imaginary double imag_ref;
#  endif
#endif

typedef enum StateMachine : uint8_t {
    STATE_INIT = 0,
    STATE_WORK = 1,
    STATE_DONE = 2
} StateMachine;

typedef union RegisterWord {
    uint32_t raw;
    /* [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness */
    struct {
        uint32_t flag_a : 1;
        uint32_t flag_b : 1;
        uint32_t        : 2; /* Unnamed bitfield padding */
        uint32_t        : 0; /* Zero-width bitfield forces alignment to next boundary */
        uint32_t payload : 16;
    } bits;
} RegisterWord;

struct AlignedBlock {
    alignas(16) uint8_t simd_buffer[16];
    alignas(double) char aligned_as_double;
    _Alignas(16) uint8_t legacy_aligned[16];
};

struct Container {
    union {
        int id;
        float alt_id;
    };
    struct {
        uint16_t sub_code;
        double precision;
    };
};

typedef struct DynamicPacket {
    size_t length;
    int payload[]; /* Flexible array member */
} DynamicPacket;

/* Complex function and array pointer declarators */
static int static_array_data[3] = {100, 200, 300};

static int (*array_pointer_provider(void))[3] {
    return &static_array_data;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) { return a * b; }
static binary_op_fn dispatch_table[1] = { op_multiply };

/* Function prototype with variable length array dimension indicator [*] */
void matrix_worker(int rows, int cols, double matrix[*][*]);

void matrix_worker(int rows, int cols, double matrix[rows][cols]) {
    if (rows > 0 && cols > 0) matrix[0][0] = 42.0;
}

/* Parameter array qualified with static and restrict */
static void qualified_consumer(int buffer[static restrict 4]) {
    buffer[0] += 1;
}

/* Variadic function */
static int sum_variadic(size_t count, ...) {
    va_list ap;
    va_start(ap, count);
    int total = 0;
    for (size_t i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

/* C23 empty parameter list means (void) */
static int empty_param_worker() {
    return 7;
}

/* Generic type selection macro */
#define TYPE_NAME(x) _Generic((x), \
    bool: "bool", \
    char: "char", \
    signed char: "signed char", \
    unsigned char: "unsigned char", \
    short: "short", \
    unsigned short: "unsigned short", \
    int: "int", \
    unsigned int: "unsigned int", \
    long: "long", \
    unsigned long: "unsigned long", \
    long long: "long long", \
    unsigned long long: "unsigned long long", \
    float: "float", \
    double: "double", \
    long double: "long double", \
    nullptr_t: "nullptr_t", \
    default: "pointer/other")

/*
 * Section 4: Execution Context, Linkage, and Main Driver
 */

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 0xAA;

static void sigint_handler(int sig) {
    (void)sig;
}

int main(void) {
    /* Storage classes and type inference */
    auto deduced_double = 3.141592653589793;
    auto int legacy_auto = 1;
    register int fast_counter = 0;
    static unsigned long run_counter = 0;
    thread_local static int tls_var = 42;
    _Thread_local static int legacy_tls_var = 84;

    /* Constants, keywords, and type operators */
    constexpr int compile_magic = 0xBEEF;
    bool active_flag = true;
    active_flag = false;
    _Bool legacy_bool_flag = false; /* Retained keyword in ISO C23 §6.4.1 */
    nullptr_t null_token = nullptr;
    int *null_ptr = nullptr;

    /* Type-generic bitwise operations from stdbit.h (C23) */
    unsigned int bit_sample = 0b0001'0000;
    bool single_bit_flag = stdc_has_single_bit(bit_sample);
    unsigned int l_zeros = stdc_leading_zeros(bit_sample);

    typeof(deduced_double) cloned_double = 2.71828;
    typeof_unqual(const volatile int) clean_integer = 128;

    /* Scalar types and literals */
    signed char s_char = -12;
    unsigned char u_char = 255U;
    short s_short = -32767;
    unsigned short u_short = 65535U;
    int s_int = -2147483647;
    unsigned int u_int = 4294967295U;
    long s_long = -2147483647L;
    unsigned long u_long = 4294967295UL;
    long long s_llong = -9'223'372'036'854'775'807LL;
    unsigned long long u_llong = 18'446'744'073'709'551'615ULL;

    /* Alignment operators */
    size_t align_c23 = alignof(struct AlignedBlock);
    size_t align_c11 = _Alignof(struct AlignedBlock);

    /* Digit separators, octal, binary, and hex floating point */
    int octal_literal = 0755;
    int binary_literal = 0b1010'1111'0000'0101;
    double hex_float = 0x1.0p-3;
    float dec_float = 1.25e-2f;
    long double ext_float = 1.0L;

    /* Universal character names in identifiers */
    int \u03c0_symbol = 314;

    /* Complex types */
    float complex complex_f = 1.0f + 2.0f * I;
    double _Complex complex_d = 3.0 + 4.0 * I;

    /* Character and string literals (standard, wide, unicode, UTF-8 char) */
    char c_ascii = 'A';
    wchar_t c_wide = L'Ω';
    char16_t c_u16 = u'ñ';
    char32_t c_u32 = U'Ψ';
    unsigned char c_u8 = u8'z';
    const char *s_ascii = "ASCII string";
    const wchar_t *s_wide = L"Wide string";
    const char16_t *s_u16 = u"UTF-16 string";
    const char32_t *s_u32 = U"UTF-32 string";
    const char8_t *s_u8 = u8"UTF-8 string";

    /* Exact-width integers */
#if defined(__BITINT_MAXWIDTH__)
    _BitInt(24) bit_int_val = -1234wb;
    unsigned _BitInt(48) u_bit_int_val = 0xABCD'EF01uwb;
#endif

    /* Qualifiers and atomic operations */
    const volatile int hw_reg = 0xCAFE;
    const volatile int *ptr_hw = &hw_reg;
    int memory_target = 10;
    int *const const_p = &memory_target;
    int *restrict restrict_p = &memory_target;

    /* [!SECURITY-NOTE: SEC-ATOMIC-01] Relaxed atomic operations lack synchronization barriers */
    _Atomic int atomic_counter = 0;
    _Atomic(uint32_t) atomic_wrapped = 100U;
    atomic_init(&atomic_counter, 1);
    atomic_fetch_add_explicit(&atomic_counter, 2, memory_order_relaxed);
    atomic_store_explicit(&atomic_wrapped, 200U, memory_order_release);
    atomic_flag atomic_spin = ATOMIC_FLAG_INIT;
    bool spin_acquired = !atomic_flag_test_and_set(&atomic_spin);
    if (spin_acquired) {
        atomic_flag_clear(&atomic_spin);
    }

    /* Universal zero-initializers, designated initializers, compound literals */
    int universal_zero_array[4] = {};
    struct Container empty_container = {};
    struct Container filled_container = {
        .id = 500,
        .sub_code = 12,
        .precision = 3.14159265
    };
    RegisterWord reg_word = {
        .bits = { .flag_a = 1, .flag_b = 0, .payload = 0x7FFF }
    };
    int sparse_indices[5] = { [0] = 1, [3] = 4 };

    int *compound_arr = (int[]){ 10, 20, 30 };
    struct Container compound_cont = (struct Container){ .id = 99, .sub_code = 1 };

    /* [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object (stack exhaustion hazard) */
    size_t dynamic_dim = (size_t)(fast_counter + 3);
    int vla_block[dynamic_dim];
    vla_block[0] = math_square(5);

    /* VM (variably modified) type pointer (mandatory in ISO C23) */
    int (*vm_ptr)[dynamic_dim] = &vla_block;

    /* Dynamic allocation with flexible array member */
    DynamicPacket *packet = malloc(sizeof(DynamicPacket) + (sizeof(int) * 2));
    if (packet) {
        packet->length = 2;
        packet->payload[0] = 0x11;
        packet->payload[1] = 0x22;
        free(packet);
    }

    /* Embedded resource parameters */
#if defined(__has_embed)
#  if __has_embed("c23.c")
    static const unsigned char embedded_data[] = {
#    embed "c23.c" limit(4) prefix(0xAA, ) suffix(, 0xFF) if_empty(0x00)
    };
    int embed_checksum = embedded_data[0] + embedded_data[5];
#  else
    int embed_checksum = 0;
#  endif
#else
    int embed_checksum = 0;
#endif

    /* Operators, associativity, precedence chaining */
    int op_x = 20, op_y = 6;
    int arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    int bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    bool logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    int ternary = logical ? (reg_word.bits.flag_a ? 100 : 200) : 300;
    int comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    /* Control flow and modern C23 label placement */
    StateMachine state = STATE_WORK;

    if (ternary == 100 && (state == STATE_WORK)) {
        goto label_pre_declaration;
    } else {
        while (false) {}
    }

label_pre_declaration:
    /* C23: Label placed directly before a declaration */
    int newly_declared_in_scope = 42;

    do {
        switch (state) {
            case STATE_INIT:
                run_counter++;
                [[fallthrough]];
            case STATE_WORK:
                for (int i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATE_DONE:
                break;
            default:
                modern_terminator();
        }
    } while (0);

    {
        goto scoped_entry;
    scoped_entry:
        int scoped_num = 1;
        (void)scoped_num;
    [[maybe_unused]] label_block_terminal:
        /* C23: Label placed at the end of a block without trailing semicolon */
    }

    /* Non-local jumps, signals, floating-point environment */
    /* [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers */
    volatile bool jump_performed = false;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = true;
            longjmp(nonlocal_buf, 1);
        }
    }
    signal(SIGINT, sigint_handler);

    /* Calling function pointers, VLA prototypes, and qualifiers */
    array_provider_fn provider = array_pointer_provider;
    int (*resolved_triplet)[3] = provider();
    int triplet_element = (*resolved_triplet)[1];

    int dispatch_result = dispatch_table[0](10, 5);

    double test_matrix[2][2] = {};
    matrix_worker(2, 2, test_matrix);

    int test_seq[4] = {1, 2, 3, 4};
    qualified_consumer(test_seq);

    int variadic_sum = sum_variadic(3, 10, 20, 30);
    int empty_param_res = empty_param_worker();

    /* Predefined macros and token pasting */
    int GLUE_TOKENS(verified_, variable) = 999;
    const char *active_fn = __func__;

    LOG_FMT("File: %s | Line: %d | Func: %s | Token: %d\n",
            __FILE__, __LINE__, active_fn, verified_variable);

    printf("Omni C23 Verification: Type=%s | Square=%d | Incr=%d | Sum=%d | State=%u\n",
           TYPE_NAME(compile_magic), math_square(4), math_increment(9),
           variadic_sum, (unsigned)state);

    /*
     * Compact state hash: Consumes all declared scalars to guarantee
     * full compilation coverage without dead (void) suppressions.
     */
    long double checksum =
        (long double)legacy_auto + deduced_double + cloned_double + clean_integer +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        (s_llong + u_llong) + binary_literal + hex_float + dec_float + ext_float +
        creal(complex_f) + cimag(complex_d) + c_ascii + (int)c_wide + (int)c_u16 +
        (int)c_u32 + c_u8 + s_ascii[0] + s_wide[0] + s_u16[0] + s_u32[0] + s_u8[0] +
        *ptr_hw + *const_p + *restrict_p + atomic_counter + atomic_wrapped +
        universal_zero_array[0] + empty_container.id + filled_container.precision +
        reg_word.raw + sparse_indices[0] + compound_arr[0] + compound_cont.id +
        vla_block[0] + embed_checksum + arithmetic + bitwise + (int)logical +
        comma_res + newly_declared_in_scope + triplet_element + dispatch_result +
        test_matrix[0][0] + test_seq[0] + empty_param_res + run_counter +
        tls_var + legacy_tls_var + external_symbol + (null_token == null_ptr ? 1 : 0) +
        (active_flag ? 1 : 0) + (spin_acquired ? 1 : 0) +
        align_c23 + align_c11 + octal_literal + \u03c0_symbol +
        (legacy_bool_flag ? 1 : 0) + (single_bit_flag ? 1 : 0) + l_zeros + (*vm_ptr)[0];

#if defined(__BITINT_MAXWIDTH__)
    checksum += (long double)bit_int_val + (long double)u_bit_int_val;
#endif

    if (isnan((double)checksum)) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
omni / c / c17.c Consolidation

ISO/IEC 9899:2018 (C17)

Technical defect-resolution edition of C11. Enforces strict __STDC_VERSION__ == 201710L and adopts direct atomic initialization following Defect Report 485 deprecation of ATOMIC_VAR_INIT.

Verification Command -std=c17 -Wall -Wextra -pedantic -Werror -pthread -lm
Lexical Metrics 348 lines • Full ISO C17 keyword saturation
Threat Model Anchors
Standard Capabilities Showcase (5 items)
  • Fixed standard macro __STDC_VERSION__ == 201710L
  • Atomic initialization differentiation via direct initialization (DR 485)
  • Retains all C11 features (_Atomic, _Generic, _Static_assert, _Thread_local, _Alignas)
  • Dual-Path Saturation Pattern for optional Annex G _Imaginary
  • Scalar state accumulator consuming all declared scalars
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
/*
 * omni: c17.c
 * Canonical, exhaustive ISO/IEC 9899:2018 (C17) language compendium.
 * Build: $(CC) -std=c17 -Wall -Wextra -pedantic -Werror -pthread c17.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <uchar.h>
#include <complex.h>
#include <stdatomic.h>
#include <stdalign.h>
#include <stdnoreturn.h>
#include <inttypes.h>
#include <fenv.h>
#include <stdarg.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (ISO C17 Clause 6.10)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE(a, b) a ## b
#define LOG_MSG(fmt, ...) printf(fmt, __VA_ARGS__)

#undef OMNI_UNDEFINED
#define OMNI_C17_ACTIVE 1

#if __STDC_VERSION__ != 201710L
#  error "Strict ISO C17 compliance required"
#endif

#if defined(OMNI_C17_ACTIVE)
#  define CONFIG_FLAG 1
#elif !defined(OMNI_UNDEFINED)
#  error "Unreachable branch"
#else
#  error "Unreachable branch"
#endif

#if defined(__clang__)
#  pragma clang diagnostic push
#  pragma clang diagnostic ignored "-W#pragma-messages"
#endif
_Pragma("message(\"Omni: Verifying ISO C17 Language Construct Compliance\")")
#if defined(__clang__)
#  pragma clang diagnostic pop
#endif

/*
 * Section 2: Assertions, Atomics, Alignment, and Types (Clause 6.7)
 */

/*
 * Dual-Path Saturation Pattern (ISO C17 Clause 6.7.2):
 * Optional normative keyword _Imaginary (Annex G)
 */
#ifdef __STDC_IEC_559_COMPLEX__
/* Annex G Imaginary types supported */
#else
#  if 0
typedef _Imaginary double imag_ref;
#  endif
#endif

_Static_assert(__STDC_VERSION__ == 201710L, "C17 version verification");
_Static_assert(sizeof(int32_t) == 4, "int32_t must be 4 bytes");

struct AlignedBlock {
    _Alignas(16) uint8_t simd_buffer[16];
    alignas(double) char aligned_as_double;
};

struct Container {
    union {
        int id;
        float alt_id;
    };
    struct {
        uint16_t sub_code;
        double precision;
    };
};

struct DynamicPacket {
    size_t length;
    int payload[]; // Flexible array member
};

// [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness
struct BitFields {
    unsigned int flag_a : 1;
    unsigned int flag_b : 1;
    unsigned int        : 2; // Unnamed padding
    unsigned int        : 0; // Boundary alignment
    unsigned int val    : 4;
};

_Noreturn static void fatal_abort(void) {
    exit(EXIT_FAILURE);
}

#define TYPE_NAME(x) _Generic((x), \
    bool: "bool", \
    char: "char", \
    int: "int", \
    long: "long", \
    float: "float", \
    double: "double", \
    default: "other")

inline static int math_square(int x) {
    return x * x;
}

void matrix_worker(int rows, int cols, double matrix[*][*]);

void matrix_worker(int rows, int cols, double matrix[rows][cols]) {
    if (rows > 0 && cols > 0) matrix[0][0] = 42.0;
}

static void qualified_consumer(int buffer[static restrict 4]) {
    buffer[0] += 1;
}

static int static_triplet[3] = {10, 20, 30};

static int (*array_provider(void))[3] {
    return &static_triplet;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) { return a * b; }
static binary_op_fn dispatch_table[1] = { op_multiply };

static int sum_variadic(size_t count, ...) {
    va_list ap;
    int total = 0;
    va_start(ap, count);
    for (size_t i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 42;

static void sigint_handler(int sig) {
    (void)sig;
}

// [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers
static int execute_nonlocal_jump(void) {
    volatile int jump_performed = 0;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = 1;
            longjmp(nonlocal_buf, 1);
        }
    }
    return jump_performed;
}

int main(void) {
    auto int legacy_auto = 1;
    register int fast_counter = 0;
    static unsigned long run_counter = 0;

    _Thread_local static int tls_var = 10;

    signed char s_char = -12;
    unsigned char u_char = 255U;
    short s_short = -32767;
    unsigned short u_short = 65535U;
    int s_int = -2147483647;
    unsigned int u_int = 4294967295U;
    long s_long = -2147483647L;
    unsigned long u_long = 4294967295UL;
    long long s_llong = -9223372036854775807LL;
    unsigned long long u_llong = 18446744073709551615ULL;

    int32_t exact_32 = INT32_C(-100);
    uint64_t exact_u64 = UINT64_C(200);

    bool active_flag = true;
    active_flag = false;
    _Bool legacy_bool_flag = 1;

    float dec_float = 1.25e-2f;
    double reg_double = 3.1415926535;
    long double ext_double = 2.718281828L;
    double hex_float = 0x1.0p-3;

    float complex complex_f = 1.0f + 2.0f * I;
    double _Complex complex_d = 3.0 + 4.0 * I;

    char c_ascii = 'A';
    wchar_t c_wide = L'Ω';
    char16_t c_u16 = u'ñ';
    char32_t c_u32 = U'Ψ';
    const char *s_ascii = "ISO C17 Literal";
    const wchar_t *s_wide = L"Wide String";
    const char16_t *s_u16 = u"UTF-16 String";
    const char32_t *s_u32 = U"UTF-32 String";
    const char *s_u8 = u8"UTF-8 String";

    const volatile int hw_reg = 0xBEEF;
    const volatile int *ptr_hw = &hw_reg;
    int memory_target = 10;
    int *const const_p = &memory_target;
    int *restrict restrict_p = &memory_target;

    // [!SECURITY-NOTE: SEC-ATOMIC-01] Relaxed atomic operations lack synchronization barriers
    // In C17 (DR 485), ATOMIC_VAR_INIT is deprecated; direct initialization is standard
    _Atomic int atomic_counter = 0;
    _Atomic(uint32_t) atomic_wrapped = 100U;
    atomic_flag atomic_spin = ATOMIC_FLAG_INIT;

    atomic_init(&atomic_counter, 1);
    atomic_fetch_add_explicit(&atomic_counter, 2, memory_order_relaxed);
    atomic_store_explicit(&atomic_wrapped, 200U, memory_order_release);
    bool spin_acquired = !atomic_flag_test_and_set(&atomic_spin);
    if (spin_acquired) {
        atomic_flag_clear(&atomic_spin);
    }

    size_t align_c17_a = _Alignof(struct AlignedBlock);
    size_t align_c17_b = alignof(struct AlignedBlock);

    int sparse_arr[5] = { [1] = 11, [3] = 33 };
    struct Container cont = { .id = 100, .sub_code = 12, .precision = 3.14 };
    struct BitFields bit_unit = { .flag_a = 1, .flag_b = 0, .val = 7 };

    int *compound_arr = (int[]){ 10, 20, 30 };
    struct Container compound_cont = (struct Container){ .id = 200, .sub_code = 24 };

    // [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object (stack exhaustion hazard)
    size_t vla_len = (size_t)(fast_counter + 3);
    int vla_storage[vla_len];
    vla_storage[0] = math_square(5);

    struct DynamicPacket *packet = malloc(sizeof(struct DynamicPacket) + (sizeof(int) * 2));
    if (packet) {
        packet->length = 2;
        packet->payload[0] = 0x11;
        packet->payload[1] = 0x22;
        free(packet);
    }

    int GLUE(symbolic_, var) = 777;
    const char *current_fn = __func__;

    int op_x = 20, op_y = 6;
    int arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    int bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    bool logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    int ternary = logical ? (bit_unit.flag_a ? 100 : 200) : 300;
    int comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    enum { STATE_INIT, STATE_WORK, STATE_DONE } state = STATE_WORK;

    if (ternary == 100 && (state == STATE_WORK)) {
        goto target_label;
    } else {
        while (false) {}
    }

target_label:
    do {
        switch (state) {
            case STATE_INIT:
                run_counter++;
                // Fallthrough
            case STATE_WORK:
                for (int i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATE_DONE:
                break;
            default:
                fatal_abort();
        }
    } while (0);

    if (ternary == 999) goto end_control_label;
end_control_label: ;

    int jump_res = execute_nonlocal_jump();
    signal(SIGINT, sigint_handler);
    feclearexcept(FE_ALL_EXCEPT);

    array_provider_fn provider = array_provider;
    int (*resolved_triplet)[3] = provider();
    int triplet_val = (*resolved_triplet)[1];

    int dispatch_res = dispatch_table[0](10, 5);

    double test_matrix[2][2] = { {0.0, 0.0}, {0.0, 0.0} };
    matrix_worker(2, 2, test_matrix);

    int test_seq[4] = {1, 2, 3, 4};
    qualified_consumer(test_seq);

    int var_sum = sum_variadic(3, 10, 20, 30);

    LOG_MSG("File: %s | Line: %d | Func: %s | Symbol: %d\n",
            __FILE__, __LINE__, current_fn, symbolic_var);
    printf("C17 check: Type=%s | Square=%d | Sum=%d | Triplet=%d | Dispatch=%d | Runs=%lu\n",
           TYPE_NAME(s_int), math_square(4), var_sum, triplet_val, dispatch_res, run_counter);

    long double checksum =
        (long double)legacy_auto + fast_counter + run_counter + *ptr_hw + *const_p + *restrict_p +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        (s_llong + u_llong) + exact_32 + exact_u64 + (active_flag ? 1 : 0) + (legacy_bool_flag ? 1 : 0) +
        dec_float + reg_double + ext_double + hex_float +
        creal(complex_f) + cimag(complex_d) + c_ascii + (int)c_wide + (int)c_u16 + (int)c_u32 +
        s_ascii[0] + (int)s_wide[0] + (int)s_u16[0] + (int)s_u32[0] + s_u8[0] +
        atomic_counter + atomic_wrapped + (spin_acquired ? 1 : 0) +
        align_c17_a + align_c17_b + sparse_arr[1] + cont.id + bit_unit.val +
        compound_arr[0] + compound_cont.id + vla_storage[0] + symbolic_var +
        arithmetic + bitwise + (logical ? 1 : 0) + ternary + comma_res +
        (int)state + jump_res + triplet_val + dispatch_res + test_matrix[0][0] +
        test_seq[0] + var_sum + external_symbol + CONFIG_FLAG + tls_var;

    if (isnan((double)checksum)) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
/*
 * omni: c17.c
 * Canonical, exhaustive ISO/IEC 9899:2018 (C17) language compendium.
 * Build: $(CC) -std=c17 -Wall -Wextra -pedantic -Werror -pthread c17.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <uchar.h>
#include <complex.h>
#include <stdatomic.h>
#include <stdalign.h>
#include <stdnoreturn.h>
#include <inttypes.h>
#include <fenv.h>
#include <stdarg.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (ISO C17 Clause 6.10)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE(a, b) a ## b
#define LOG_MSG(fmt, ...) printf(fmt, __VA_ARGS__)

#undef OMNI_UNDEFINED
#define OMNI_C17_ACTIVE 1

#if __STDC_VERSION__ != 201710L
#  error "Strict ISO C17 compliance required"
#endif

#if defined(OMNI_C17_ACTIVE)
#  define CONFIG_FLAG 1
#elif !defined(OMNI_UNDEFINED)
#  error "Unreachable branch"
#else
#  error "Unreachable branch"
#endif

#if defined(__clang__)
#  pragma clang diagnostic push
#  pragma clang diagnostic ignored "-W#pragma-messages"
#endif
_Pragma("message(\"Omni: Verifying ISO C17 Language Construct Compliance\")")
#if defined(__clang__)
#  pragma clang diagnostic pop
#endif

/*
 * Section 2: Assertions, Atomics, Alignment, and Types (Clause 6.7)
 */

/*
 * Dual-Path Saturation Pattern (ISO C17 Clause 6.7.2):
 * Optional normative keyword _Imaginary (Annex G)
 */
#ifdef __STDC_IEC_559_COMPLEX__
/* Annex G Imaginary types supported */
#else
#  if 0
typedef _Imaginary double imag_ref;
#  endif
#endif

_Static_assert(__STDC_VERSION__ == 201710L, "C17 version verification");
_Static_assert(sizeof(int32_t) == 4, "int32_t must be 4 bytes");

struct AlignedBlock {
    _Alignas(16) uint8_t simd_buffer[16];
    alignas(double) char aligned_as_double;
};

struct Container {
    union {
        int id;
        float alt_id;
    };
    struct {
        uint16_t sub_code;
        double precision;
    };
};

struct DynamicPacket {
    size_t length;
    int payload[]; // Flexible array member
};

// [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness
struct BitFields {
    unsigned int flag_a : 1;
    unsigned int flag_b : 1;
    unsigned int        : 2; // Unnamed padding
    unsigned int        : 0; // Boundary alignment
    unsigned int val    : 4;
};

_Noreturn static void fatal_abort(void) {
    exit(EXIT_FAILURE);
}

#define TYPE_NAME(x) _Generic((x), \
    bool: "bool", \
    char: "char", \
    int: "int", \
    long: "long", \
    float: "float", \
    double: "double", \
    default: "other")

inline static int math_square(int x) {
    return x * x;
}

void matrix_worker(int rows, int cols, double matrix[*][*]);

void matrix_worker(int rows, int cols, double matrix[rows][cols]) {
    if (rows > 0 && cols > 0) matrix[0][0] = 42.0;
}

static void qualified_consumer(int buffer[static restrict 4]) {
    buffer[0] += 1;
}

static int static_triplet[3] = {10, 20, 30};

static int (*array_provider(void))[3] {
    return &static_triplet;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) { return a * b; }
static binary_op_fn dispatch_table[1] = { op_multiply };

static int sum_variadic(size_t count, ...) {
    va_list ap;
    int total = 0;
    va_start(ap, count);
    for (size_t i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 42;

static void sigint_handler(int sig) {
    (void)sig;
}

// [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers
static int execute_nonlocal_jump(void) {
    volatile int jump_performed = 0;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = 1;
            longjmp(nonlocal_buf, 1);
        }
    }
    return jump_performed;
}

int main(void) {
    auto int legacy_auto = 1;
    register int fast_counter = 0;
    static unsigned long run_counter = 0;

    _Thread_local static int tls_var = 10;

    signed char s_char = -12;
    unsigned char u_char = 255U;
    short s_short = -32767;
    unsigned short u_short = 65535U;
    int s_int = -2147483647;
    unsigned int u_int = 4294967295U;
    long s_long = -2147483647L;
    unsigned long u_long = 4294967295UL;
    long long s_llong = -9223372036854775807LL;
    unsigned long long u_llong = 18446744073709551615ULL;

    int32_t exact_32 = INT32_C(-100);
    uint64_t exact_u64 = UINT64_C(200);

    bool active_flag = true;
    active_flag = false;
    _Bool legacy_bool_flag = 1;

    float dec_float = 1.25e-2f;
    double reg_double = 3.1415926535;
    long double ext_double = 2.718281828L;
    double hex_float = 0x1.0p-3;

    float complex complex_f = 1.0f + 2.0f * I;
    double _Complex complex_d = 3.0 + 4.0 * I;

    char c_ascii = 'A';
    wchar_t c_wide = L'Ω';
    char16_t c_u16 = u'ñ';
    char32_t c_u32 = U'Ψ';
    const char *s_ascii = "ISO C17 Literal";
    const wchar_t *s_wide = L"Wide String";
    const char16_t *s_u16 = u"UTF-16 String";
    const char32_t *s_u32 = U"UTF-32 String";
    const char *s_u8 = u8"UTF-8 String";

    const volatile int hw_reg = 0xBEEF;
    const volatile int *ptr_hw = &hw_reg;
    int memory_target = 10;
    int *const const_p = &memory_target;
    int *restrict restrict_p = &memory_target;

    // [!SECURITY-NOTE: SEC-ATOMIC-01] Relaxed atomic operations lack synchronization barriers
    // In C17 (DR 485), ATOMIC_VAR_INIT is deprecated; direct initialization is standard
    _Atomic int atomic_counter = 0;
    _Atomic(uint32_t) atomic_wrapped = 100U;
    atomic_flag atomic_spin = ATOMIC_FLAG_INIT;

    atomic_init(&atomic_counter, 1);
    atomic_fetch_add_explicit(&atomic_counter, 2, memory_order_relaxed);
    atomic_store_explicit(&atomic_wrapped, 200U, memory_order_release);
    bool spin_acquired = !atomic_flag_test_and_set(&atomic_spin);
    if (spin_acquired) {
        atomic_flag_clear(&atomic_spin);
    }

    size_t align_c17_a = _Alignof(struct AlignedBlock);
    size_t align_c17_b = alignof(struct AlignedBlock);

    int sparse_arr[5] = { [1] = 11, [3] = 33 };
    struct Container cont = { .id = 100, .sub_code = 12, .precision = 3.14 };
    struct BitFields bit_unit = { .flag_a = 1, .flag_b = 0, .val = 7 };

    int *compound_arr = (int[]){ 10, 20, 30 };
    struct Container compound_cont = (struct Container){ .id = 200, .sub_code = 24 };

    // [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object (stack exhaustion hazard)
    size_t vla_len = (size_t)(fast_counter + 3);
    int vla_storage[vla_len];
    vla_storage[0] = math_square(5);

    struct DynamicPacket *packet = malloc(sizeof(struct DynamicPacket) + (sizeof(int) * 2));
    if (packet) {
        packet->length = 2;
        packet->payload[0] = 0x11;
        packet->payload[1] = 0x22;
        free(packet);
    }

    int GLUE(symbolic_, var) = 777;
    const char *current_fn = __func__;

    int op_x = 20, op_y = 6;
    int arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    int bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    bool logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    int ternary = logical ? (bit_unit.flag_a ? 100 : 200) : 300;
    int comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    enum { STATE_INIT, STATE_WORK, STATE_DONE } state = STATE_WORK;

    if (ternary == 100 && (state == STATE_WORK)) {
        goto target_label;
    } else {
        while (false) {}
    }

target_label:
    do {
        switch (state) {
            case STATE_INIT:
                run_counter++;
                // Fallthrough
            case STATE_WORK:
                for (int i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATE_DONE:
                break;
            default:
                fatal_abort();
        }
    } while (0);

    if (ternary == 999) goto end_control_label;
end_control_label: ;

    int jump_res = execute_nonlocal_jump();
    signal(SIGINT, sigint_handler);
    feclearexcept(FE_ALL_EXCEPT);

    array_provider_fn provider = array_provider;
    int (*resolved_triplet)[3] = provider();
    int triplet_val = (*resolved_triplet)[1];

    int dispatch_res = dispatch_table[0](10, 5);

    double test_matrix[2][2] = { {0.0, 0.0}, {0.0, 0.0} };
    matrix_worker(2, 2, test_matrix);

    int test_seq[4] = {1, 2, 3, 4};
    qualified_consumer(test_seq);

    int var_sum = sum_variadic(3, 10, 20, 30);

    LOG_MSG("File: %s | Line: %d | Func: %s | Symbol: %d\n",
            __FILE__, __LINE__, current_fn, symbolic_var);
    printf("C17 check: Type=%s | Square=%d | Sum=%d | Triplet=%d | Dispatch=%d | Runs=%lu\n",
           TYPE_NAME(s_int), math_square(4), var_sum, triplet_val, dispatch_res, run_counter);

    long double checksum =
        (long double)legacy_auto + fast_counter + run_counter + *ptr_hw + *const_p + *restrict_p +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        (s_llong + u_llong) + exact_32 + exact_u64 + (active_flag ? 1 : 0) + (legacy_bool_flag ? 1 : 0) +
        dec_float + reg_double + ext_double + hex_float +
        creal(complex_f) + cimag(complex_d) + c_ascii + (int)c_wide + (int)c_u16 + (int)c_u32 +
        s_ascii[0] + (int)s_wide[0] + (int)s_u16[0] + (int)s_u32[0] + s_u8[0] +
        atomic_counter + atomic_wrapped + (spin_acquired ? 1 : 0) +
        align_c17_a + align_c17_b + sparse_arr[1] + cont.id + bit_unit.val +
        compound_arr[0] + compound_cont.id + vla_storage[0] + symbolic_var +
        arithmetic + bitwise + (logical ? 1 : 0) + ternary + comma_res +
        (int)state + jump_res + triplet_val + dispatch_res + test_matrix[0][0] +
        test_seq[0] + var_sum + external_symbol + CONFIG_FLAG + tls_var;

    if (isnan((double)checksum)) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
omni / c / c11.c Concurrency & Generics

ISO/IEC 9899:2011 (C11)

Major milestone introducing standardized multithreading, atomic operations, compile-time assertions, type-generic expressions, alignment queries, and unicode string literals.

Verification Command -std=c11 -Wall -Wextra -pedantic -Werror -pthread -lm
Lexical Metrics 359 lines • Full ISO C11 keyword saturation
Threat Model Anchors
Standard Capabilities Showcase (7 items)
  • Atomics with stdatomic.h and memory order parameters (ATOMIC_VAR_INIT)
  • Compile-time static assertions (_Static_assert)
  • Type-generic selection expressions (_Generic)
  • Thread-local storage duration (_Thread_local)
  • Alignment specifiers (_Alignas) and queries (_Alignof)
  • Anonymous structures and unions
  • Unicode characters and string literals (u8, u, U, char16_t, char32_t)
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/*
 * omni: c11.c
 * Canonical, exhaustive ISO/IEC 9899:2011 (C11) language compendium.
 * Build: $(CC) -std=c11 -Wall -Wextra -pedantic -Werror -pthread c11.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <uchar.h>
#include <complex.h>
#include <stdatomic.h>
#include <stdalign.h>
#include <stdnoreturn.h>
#include <inttypes.h>
#include <fenv.h>
#include <stdarg.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (ISO C11 Clause 6.10)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE(a, b) a ## b
#define LOG_MSG(fmt, ...) printf(fmt, __VA_ARGS__)

#undef OMNI_UNDEFINED
#define OMNI_C11_ACTIVE 1

#if __STDC_VERSION__ != 201112L
#  error "Strict ISO C11 compliance required"
#endif

#if defined(OMNI_C11_ACTIVE)
#  define CONFIG_FLAG 1
#elif !defined(OMNI_UNDEFINED)
#  error "Unreachable branch"
#else
#  error "Unreachable branch"
#endif

#if defined(__clang__)
#  pragma clang diagnostic push
#  pragma clang diagnostic ignored "-W#pragma-messages"
#endif
_Pragma("message(\"Omni: Verifying ISO C11 Language Construct Compliance\")")
#if defined(__clang__)
#  pragma clang diagnostic pop
#endif

/*
 * Section 2: Assertions, Atomics, Alignment, and Types (Clause 6.7)
 */

/*
 * Dual-Path Saturation Pattern (ISO C11 Clause 6.7.2):
 * Optional normative keyword _Imaginary (Annex G)
 */
#ifdef __STDC_IEC_559_COMPLEX__
/* Annex G Imaginary types supported */
#else
#  if 0
typedef _Imaginary double imag_ref;
#  endif
#endif

// In C11, _Static_assert requires two arguments
_Static_assert(__STDC_VERSION__ == 201112L, "C11 version verification");
_Static_assert(sizeof(int32_t) == 4, "int32_t must be 4 bytes");

// Alignment specifiers
struct AlignedBlock {
    _Alignas(16) uint8_t simd_buffer[16];
    alignas(double) char aligned_as_double;
};

// Anonymous structure and union members
struct Container {
    union {
        int id;
        float alt_id;
    };
    struct {
        uint16_t sub_code;
        double precision;
    };
};

struct DynamicPacket {
    size_t length;
    int payload[]; // Flexible array member
};

// [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness
struct BitFields {
    unsigned int flag_a : 1;
    unsigned int flag_b : 1;
    unsigned int        : 2; // Unnamed padding
    unsigned int        : 0; // Boundary alignment
    unsigned int val    : 4;
};

// _Noreturn function specifier
_Noreturn static void fatal_abort(void) {
    exit(EXIT_FAILURE);
}

// C11 generic selection macro
#define TYPE_NAME(x) _Generic((x), \
    bool: "bool", \
    char: "char", \
    int: "int", \
    long: "long", \
    float: "float", \
    double: "double", \
    default: "other")

inline static int math_square(int x) {
    return x * x;
}

void matrix_worker(int rows, int cols, double matrix[*][*]);

void matrix_worker(int rows, int cols, double matrix[rows][cols]) {
    if (rows > 0 && cols > 0) matrix[0][0] = 42.0;
}

static void qualified_consumer(int buffer[static restrict 4]) {
    buffer[0] += 1;
}

static int static_triplet[3] = {10, 20, 30};

static int (*array_provider(void))[3] {
    return &static_triplet;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) { return a * b; }
static binary_op_fn dispatch_table[1] = { op_multiply };

static int sum_variadic(size_t count, ...) {
    va_list ap;
    int total = 0;
    va_start(ap, count);
    for (size_t i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 42;

static void sigint_handler(int sig) {
    (void)sig;
}

// [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers
static int execute_nonlocal_jump(void) {
    volatile int jump_performed = 0;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = 1;
            longjmp(nonlocal_buf, 1);
        }
    }
    return jump_performed;
}

int main(void) {
    auto int legacy_auto = 1;
    register int fast_counter = 0;
    static unsigned long run_counter = 0;

    // C11 Thread-local storage specifiers
    _Thread_local static int tls_var = 10;

    // Scalar types
    signed char s_char = -12;
    unsigned char u_char = 255U;
    short s_short = -32767;
    unsigned short u_short = 65535U;
    int s_int = -2147483647;
    unsigned int u_int = 4294967295U;
    long s_long = -2147483647L;
    unsigned long u_long = 4294967295UL;
    long long s_llong = -9223372036854775807LL;
    unsigned long long u_llong = 18446744073709551615ULL;

    int32_t exact_32 = INT32_C(-100);
    uint64_t exact_u64 = UINT64_C(200);

    bool active_flag = true;
    active_flag = false;
    _Bool legacy_bool_flag = 1;

    float dec_float = 1.25e-2f;
    double reg_double = 3.1415926535;
    long double ext_double = 2.718281828L;
    double hex_float = 0x1.0p-3;

    float complex complex_f = 1.0f + 2.0f * I;
    double _Complex complex_d = 3.0 + 4.0 * I;

    // Unicode characters and strings (C11 uchar.h)
    char c_ascii = 'A';
    wchar_t c_wide = L'Ω';
    char16_t c_u16 = u'ñ';
    char32_t c_u32 = U'Ψ';
    const char *s_ascii = "ISO C11 Literal";
    const wchar_t *s_wide = L"Wide String";
    const char16_t *s_u16 = u"UTF-16 String";
    const char32_t *s_u32 = U"UTF-32 String";
    const char *s_u8 = u8"UTF-8 String";

    // Qualifiers and atomics
    const volatile int hw_reg = 0xBEEF;
    const volatile int *ptr_hw = &hw_reg;
    int memory_target = 10;
    int *const const_p = &memory_target;
    int *restrict restrict_p = &memory_target;

    // [!SECURITY-NOTE: SEC-ATOMIC-01] Relaxed atomic operations lack synchronization barriers
    _Atomic int atomic_counter = ATOMIC_VAR_INIT(0);
    _Atomic(uint32_t) atomic_wrapped = 100U;
    atomic_flag atomic_spin = ATOMIC_FLAG_INIT;

    atomic_init(&atomic_counter, 1);
    atomic_fetch_add_explicit(&atomic_counter, 2, memory_order_relaxed);
    atomic_store_explicit(&atomic_wrapped, 200U, memory_order_release);
    bool spin_acquired = !atomic_flag_test_and_set(&atomic_spin);
    if (spin_acquired) {
        atomic_flag_clear(&atomic_spin);
    }

    // Alignment operators
    size_t align_c11_a = _Alignof(struct AlignedBlock);
    size_t align_c11_b = alignof(struct AlignedBlock);

    // Designated initializers and compound literals
    int sparse_arr[5] = { [1] = 11, [3] = 33 };
    struct Container cont = { .id = 100, .sub_code = 12, .precision = 3.14 };
    struct BitFields bit_unit = { .flag_a = 1, .flag_b = 0, .val = 7 };

    int *compound_arr = (int[]){ 10, 20, 30 };
    struct Container compound_cont = (struct Container){ .id = 200, .sub_code = 24 };

    // [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object (stack exhaustion hazard)
    size_t vla_len = (size_t)(fast_counter + 3);
    int vla_storage[vla_len];
    vla_storage[0] = math_square(5);

    // Flexible array member allocation
    struct DynamicPacket *packet = malloc(sizeof(struct DynamicPacket) + (sizeof(int) * 2));
    if (packet) {
        packet->length = 2;
        packet->payload[0] = 0x11;
        packet->payload[1] = 0x22;
        free(packet);
    }

    int GLUE(symbolic_, var) = 777;
    const char *current_fn = __func__;

    int op_x = 20, op_y = 6;
    int arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    int bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    bool logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    int ternary = logical ? (bit_unit.flag_a ? 100 : 200) : 300;
    int comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    enum { STATE_INIT, STATE_WORK, STATE_DONE } state = STATE_WORK;

    if (ternary == 100 && (state == STATE_WORK)) {
        goto target_label;
    } else {
        while (false) {}
    }

target_label:
    do {
        switch (state) {
            case STATE_INIT:
                run_counter++;
                // Fallthrough
            case STATE_WORK:
                for (int i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATE_DONE:
                break;
            default:
                fatal_abort();
        }
    } while (0);

    if (ternary == 999) goto end_control_label;
end_control_label: ;

    int jump_res = execute_nonlocal_jump();
    signal(SIGINT, sigint_handler);
    feclearexcept(FE_ALL_EXCEPT);

    array_provider_fn provider = array_provider;
    int (*resolved_triplet)[3] = provider();
    int triplet_val = (*resolved_triplet)[1];

    int dispatch_res = dispatch_table[0](10, 5);

    double test_matrix[2][2] = { {0.0, 0.0}, {0.0, 0.0} };
    matrix_worker(2, 2, test_matrix);

    int test_seq[4] = {1, 2, 3, 4};
    qualified_consumer(test_seq);

    int var_sum = sum_variadic(3, 10, 20, 30);

    LOG_MSG("File: %s | Line: %d | Func: %s | Symbol: %d\n",
            __FILE__, __LINE__, current_fn, symbolic_var);
    printf("C11 check: Type=%s | Square=%d | Sum=%d | Triplet=%d | Dispatch=%d | Runs=%lu\n",
           TYPE_NAME(s_int), math_square(4), var_sum, triplet_val, dispatch_res, run_counter);

    long double checksum =
        (long double)legacy_auto + fast_counter + run_counter + *ptr_hw + *const_p + *restrict_p +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        (s_llong + u_llong) + exact_32 + exact_u64 + (active_flag ? 1 : 0) + (legacy_bool_flag ? 1 : 0) +
        dec_float + reg_double + ext_double + hex_float +
        creal(complex_f) + cimag(complex_d) + c_ascii + (int)c_wide + (int)c_u16 + (int)c_u32 +
        s_ascii[0] + (int)s_wide[0] + (int)s_u16[0] + (int)s_u32[0] + s_u8[0] +
        atomic_counter + atomic_wrapped + (spin_acquired ? 1 : 0) +
        align_c11_a + align_c11_b + sparse_arr[1] + cont.id + bit_unit.val +
        compound_arr[0] + compound_cont.id + vla_storage[0] + symbolic_var +
        arithmetic + bitwise + (logical ? 1 : 0) + ternary + comma_res +
        (int)state + jump_res + triplet_val + dispatch_res + test_matrix[0][0] +
        test_seq[0] + var_sum + external_symbol + CONFIG_FLAG + tls_var;

    if (isnan((double)checksum)) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/*
 * omni: c11.c
 * Canonical, exhaustive ISO/IEC 9899:2011 (C11) language compendium.
 * Build: $(CC) -std=c11 -Wall -Wextra -pedantic -Werror -pthread c11.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <uchar.h>
#include <complex.h>
#include <stdatomic.h>
#include <stdalign.h>
#include <stdnoreturn.h>
#include <inttypes.h>
#include <fenv.h>
#include <stdarg.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (ISO C11 Clause 6.10)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE(a, b) a ## b
#define LOG_MSG(fmt, ...) printf(fmt, __VA_ARGS__)

#undef OMNI_UNDEFINED
#define OMNI_C11_ACTIVE 1

#if __STDC_VERSION__ != 201112L
#  error "Strict ISO C11 compliance required"
#endif

#if defined(OMNI_C11_ACTIVE)
#  define CONFIG_FLAG 1
#elif !defined(OMNI_UNDEFINED)
#  error "Unreachable branch"
#else
#  error "Unreachable branch"
#endif

#if defined(__clang__)
#  pragma clang diagnostic push
#  pragma clang diagnostic ignored "-W#pragma-messages"
#endif
_Pragma("message(\"Omni: Verifying ISO C11 Language Construct Compliance\")")
#if defined(__clang__)
#  pragma clang diagnostic pop
#endif

/*
 * Section 2: Assertions, Atomics, Alignment, and Types (Clause 6.7)
 */

/*
 * Dual-Path Saturation Pattern (ISO C11 Clause 6.7.2):
 * Optional normative keyword _Imaginary (Annex G)
 */
#ifdef __STDC_IEC_559_COMPLEX__
/* Annex G Imaginary types supported */
#else
#  if 0
typedef _Imaginary double imag_ref;
#  endif
#endif

// In C11, _Static_assert requires two arguments
_Static_assert(__STDC_VERSION__ == 201112L, "C11 version verification");
_Static_assert(sizeof(int32_t) == 4, "int32_t must be 4 bytes");

// Alignment specifiers
struct AlignedBlock {
    _Alignas(16) uint8_t simd_buffer[16];
    alignas(double) char aligned_as_double;
};

// Anonymous structure and union members
struct Container {
    union {
        int id;
        float alt_id;
    };
    struct {
        uint16_t sub_code;
        double precision;
    };
};

struct DynamicPacket {
    size_t length;
    int payload[]; // Flexible array member
};

// [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness
struct BitFields {
    unsigned int flag_a : 1;
    unsigned int flag_b : 1;
    unsigned int        : 2; // Unnamed padding
    unsigned int        : 0; // Boundary alignment
    unsigned int val    : 4;
};

// _Noreturn function specifier
_Noreturn static void fatal_abort(void) {
    exit(EXIT_FAILURE);
}

// C11 generic selection macro
#define TYPE_NAME(x) _Generic((x), \
    bool: "bool", \
    char: "char", \
    int: "int", \
    long: "long", \
    float: "float", \
    double: "double", \
    default: "other")

inline static int math_square(int x) {
    return x * x;
}

void matrix_worker(int rows, int cols, double matrix[*][*]);

void matrix_worker(int rows, int cols, double matrix[rows][cols]) {
    if (rows > 0 && cols > 0) matrix[0][0] = 42.0;
}

static void qualified_consumer(int buffer[static restrict 4]) {
    buffer[0] += 1;
}

static int static_triplet[3] = {10, 20, 30};

static int (*array_provider(void))[3] {
    return &static_triplet;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) { return a * b; }
static binary_op_fn dispatch_table[1] = { op_multiply };

static int sum_variadic(size_t count, ...) {
    va_list ap;
    int total = 0;
    va_start(ap, count);
    for (size_t i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 42;

static void sigint_handler(int sig) {
    (void)sig;
}

// [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers
static int execute_nonlocal_jump(void) {
    volatile int jump_performed = 0;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = 1;
            longjmp(nonlocal_buf, 1);
        }
    }
    return jump_performed;
}

int main(void) {
    auto int legacy_auto = 1;
    register int fast_counter = 0;
    static unsigned long run_counter = 0;

    // C11 Thread-local storage specifiers
    _Thread_local static int tls_var = 10;

    // Scalar types
    signed char s_char = -12;
    unsigned char u_char = 255U;
    short s_short = -32767;
    unsigned short u_short = 65535U;
    int s_int = -2147483647;
    unsigned int u_int = 4294967295U;
    long s_long = -2147483647L;
    unsigned long u_long = 4294967295UL;
    long long s_llong = -9223372036854775807LL;
    unsigned long long u_llong = 18446744073709551615ULL;

    int32_t exact_32 = INT32_C(-100);
    uint64_t exact_u64 = UINT64_C(200);

    bool active_flag = true;
    active_flag = false;
    _Bool legacy_bool_flag = 1;

    float dec_float = 1.25e-2f;
    double reg_double = 3.1415926535;
    long double ext_double = 2.718281828L;
    double hex_float = 0x1.0p-3;

    float complex complex_f = 1.0f + 2.0f * I;
    double _Complex complex_d = 3.0 + 4.0 * I;

    // Unicode characters and strings (C11 uchar.h)
    char c_ascii = 'A';
    wchar_t c_wide = L'Ω';
    char16_t c_u16 = u'ñ';
    char32_t c_u32 = U'Ψ';
    const char *s_ascii = "ISO C11 Literal";
    const wchar_t *s_wide = L"Wide String";
    const char16_t *s_u16 = u"UTF-16 String";
    const char32_t *s_u32 = U"UTF-32 String";
    const char *s_u8 = u8"UTF-8 String";

    // Qualifiers and atomics
    const volatile int hw_reg = 0xBEEF;
    const volatile int *ptr_hw = &hw_reg;
    int memory_target = 10;
    int *const const_p = &memory_target;
    int *restrict restrict_p = &memory_target;

    // [!SECURITY-NOTE: SEC-ATOMIC-01] Relaxed atomic operations lack synchronization barriers
    _Atomic int atomic_counter = ATOMIC_VAR_INIT(0);
    _Atomic(uint32_t) atomic_wrapped = 100U;
    atomic_flag atomic_spin = ATOMIC_FLAG_INIT;

    atomic_init(&atomic_counter, 1);
    atomic_fetch_add_explicit(&atomic_counter, 2, memory_order_relaxed);
    atomic_store_explicit(&atomic_wrapped, 200U, memory_order_release);
    bool spin_acquired = !atomic_flag_test_and_set(&atomic_spin);
    if (spin_acquired) {
        atomic_flag_clear(&atomic_spin);
    }

    // Alignment operators
    size_t align_c11_a = _Alignof(struct AlignedBlock);
    size_t align_c11_b = alignof(struct AlignedBlock);

    // Designated initializers and compound literals
    int sparse_arr[5] = { [1] = 11, [3] = 33 };
    struct Container cont = { .id = 100, .sub_code = 12, .precision = 3.14 };
    struct BitFields bit_unit = { .flag_a = 1, .flag_b = 0, .val = 7 };

    int *compound_arr = (int[]){ 10, 20, 30 };
    struct Container compound_cont = (struct Container){ .id = 200, .sub_code = 24 };

    // [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object (stack exhaustion hazard)
    size_t vla_len = (size_t)(fast_counter + 3);
    int vla_storage[vla_len];
    vla_storage[0] = math_square(5);

    // Flexible array member allocation
    struct DynamicPacket *packet = malloc(sizeof(struct DynamicPacket) + (sizeof(int) * 2));
    if (packet) {
        packet->length = 2;
        packet->payload[0] = 0x11;
        packet->payload[1] = 0x22;
        free(packet);
    }

    int GLUE(symbolic_, var) = 777;
    const char *current_fn = __func__;

    int op_x = 20, op_y = 6;
    int arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    int bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    bool logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    int ternary = logical ? (bit_unit.flag_a ? 100 : 200) : 300;
    int comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    enum { STATE_INIT, STATE_WORK, STATE_DONE } state = STATE_WORK;

    if (ternary == 100 && (state == STATE_WORK)) {
        goto target_label;
    } else {
        while (false) {}
    }

target_label:
    do {
        switch (state) {
            case STATE_INIT:
                run_counter++;
                // Fallthrough
            case STATE_WORK:
                for (int i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATE_DONE:
                break;
            default:
                fatal_abort();
        }
    } while (0);

    if (ternary == 999) goto end_control_label;
end_control_label: ;

    int jump_res = execute_nonlocal_jump();
    signal(SIGINT, sigint_handler);
    feclearexcept(FE_ALL_EXCEPT);

    array_provider_fn provider = array_provider;
    int (*resolved_triplet)[3] = provider();
    int triplet_val = (*resolved_triplet)[1];

    int dispatch_res = dispatch_table[0](10, 5);

    double test_matrix[2][2] = { {0.0, 0.0}, {0.0, 0.0} };
    matrix_worker(2, 2, test_matrix);

    int test_seq[4] = {1, 2, 3, 4};
    qualified_consumer(test_seq);

    int var_sum = sum_variadic(3, 10, 20, 30);

    LOG_MSG("File: %s | Line: %d | Func: %s | Symbol: %d\n",
            __FILE__, __LINE__, current_fn, symbolic_var);
    printf("C11 check: Type=%s | Square=%d | Sum=%d | Triplet=%d | Dispatch=%d | Runs=%lu\n",
           TYPE_NAME(s_int), math_square(4), var_sum, triplet_val, dispatch_res, run_counter);

    long double checksum =
        (long double)legacy_auto + fast_counter + run_counter + *ptr_hw + *const_p + *restrict_p +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        (s_llong + u_llong) + exact_32 + exact_u64 + (active_flag ? 1 : 0) + (legacy_bool_flag ? 1 : 0) +
        dec_float + reg_double + ext_double + hex_float +
        creal(complex_f) + cimag(complex_d) + c_ascii + (int)c_wide + (int)c_u16 + (int)c_u32 +
        s_ascii[0] + (int)s_wide[0] + (int)s_u16[0] + (int)s_u32[0] + s_u8[0] +
        atomic_counter + atomic_wrapped + (spin_acquired ? 1 : 0) +
        align_c11_a + align_c11_b + sparse_arr[1] + cont.id + bit_unit.val +
        compound_arr[0] + compound_cont.id + vla_storage[0] + symbolic_var +
        arithmetic + bitwise + (logical ? 1 : 0) + ternary + comma_res +
        (int)state + jump_res + triplet_val + dispatch_res + test_matrix[0][0] +
        test_seq[0] + var_sum + external_symbol + CONFIG_FLAG + tls_var;

    if (isnan((double)checksum)) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
omni / c / c99.c Modernization

ISO/IEC 9899:1999 (C99)

Landmark modernization standard introducing mixed declarations, variable-length arrays, designated initializers, compound literals, flexible array members, complex arithmetic, and exact-width integer types.

Verification Command -std=c99 -Wall -Wextra -pedantic -Werror -lm
Lexical Metrics 313 lines • Full ISO C99 keyword saturation
Threat Model Anchors
Standard Capabilities Showcase (8 items)
  • Mixed declarations and statements; for-loop index declarations
  • Variable-length arrays (VLAs) and flexible array members
  • Designated initializers and compound literals
  • Native Boolean type (_Bool) via stdbool.h
  • Exact-width integer types via stdint.h
  • Complex arithmetic via complex.h
  • inline functions and restrict pointer qualifiers
  • Variadic macros and preprocessor __func__ identifier
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/*
 * omni: c99.c
 * Canonical, exhaustive ISO/IEC 9899:1999 (C99) language compendium.
 * Build: $(CC) -std=c99 -Wall -Wextra -pedantic -Werror c99.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
#include <complex.h>
#include <fenv.h>
#include <stdarg.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (ISO C99 Clause 6.10)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE(a, b) a ## b
#define LOG_MSG(fmt, ...) printf(fmt, __VA_ARGS__)

#undef OMNI_UNDEFINED
#define OMNI_C99_ACTIVE 1

#if __STDC_VERSION__ != 199901L
#  error "Strict ISO C99 compliance required"
#endif

#if defined(OMNI_C99_ACTIVE)
#  define CONFIG_FLAG 1
#elif !defined(OMNI_UNDEFINED)
#  error "Unreachable branch"
#else
#  error "Unreachable branch"
#endif

#if defined(__clang__)
#  pragma clang diagnostic push
#  pragma clang diagnostic ignored "-W#pragma-messages"
#endif
_Pragma("message(\"Omni: Verifying ISO C99 Language Construct Compliance\")")
#if defined(__clang__)
#  pragma clang diagnostic pop
#endif

/*
 * Section 2: Declarations, Structs, VLAs, Inlines, Qualifiers (Clause 6.7)
 */

/*
 * Dual-Path Saturation Pattern (ISO C99 Clause 6.7.2):
 * Optional normative keyword _Imaginary (Annex G)
 */
#ifdef __STDC_IEC_559_COMPLEX__
/* Annex G Imaginary types supported */
#else
#  if 0
typedef _Imaginary double imag_ref;
#  endif
#endif

enum Status {
    STATUS_INIT = 0,
    STATUS_WORK = 1,
    STATUS_DONE = 2, // C99 allows trailing comma in enum
};

struct DynamicPacket {
    size_t length;
    int payload[]; // Flexible array member
};

// [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness
struct BitFields {
    unsigned int flag_a : 1;
    unsigned int flag_b : 1;
    unsigned int        : 2; // Unnamed padding
    unsigned int        : 0; // Boundary alignment
    unsigned int val    : 4;
};

// C99 inline function
inline static int math_square(int x) {
    return x * x;
}

// Function prototype with variable-length array dimension indicator [*]
void matrix_worker(int rows, int cols, double matrix[*][*]);

void matrix_worker(int rows, int cols, double matrix[rows][cols]) {
    if (rows > 0 && cols > 0) matrix[0][0] = 42.0;
}

// Array parameter qualified with static and restrict
static void qualified_consumer(int buffer[static restrict 4]) {
    buffer[0] += 1;
}

// Pointer to array and complex function pointer types
static int static_triplet[3] = {10, 20, 30};

static int (*array_provider(void))[3] {
    return &static_triplet;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) {
    return a * b;
}

static binary_op_fn dispatch_table[1] = { op_multiply };

// Variadic function conforming to C99
static int sum_variadic(size_t count, ...) {
    va_list ap;
    int total = 0;
    va_start(ap, count);
    for (size_t i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 42;

static void sigint_handler(int sig) {
    (void)sig;
}

// [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers
static int execute_nonlocal_jump(void) {
    volatile int jump_performed = 0;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = 1;
            longjmp(nonlocal_buf, 1);
        }
    }
    return jump_performed;
}

int main(void) {
    // In C99, declarations can mix with code
    auto int legacy_auto = 1;
    register int fast_counter = 0;
    static unsigned long run_counter = 0;

    // Standard scalar types
    signed char s_char = -12;
    unsigned char u_char = 255U;
    short s_short = -32767;
    unsigned short u_short = 65535U;
    int s_int = -2147483647;
    unsigned int u_int = 4294967295U;
    long s_long = -2147483647L;
    unsigned long u_long = 4294967295UL;
    long long s_llong = -9223372036854775807LL;
    unsigned long long u_llong = 18446744073709551615ULL;

    // Exact-width integers from stdint.h
    int32_t exact_32 = INT32_C(-100);
    uint64_t exact_u64 = UINT64_C(200);

    // Boolean type
    bool active_flag = true;
    active_flag = false;
    _Bool legacy_bool_flag = 1;

    // Floating-point representations
    float dec_float = 1.25e-2f;
    double reg_double = 3.1415926535;
    long double ext_double = 2.718281828L;
    double hex_float = 0x1.0p-3; // C99 hexadecimal floating-point

    // Complex numbers from complex.h
    float complex complex_f = 1.0f + 2.0f * I;
    double _Complex complex_d = 3.0 + 4.0 * I;

    // Character and string literals
    char c_ascii = 'A';
    wchar_t c_wide = L'Z';
    const char *s_ascii = "ISO C99 Literal";
    const wchar_t *s_wide = L"Wide String";

    // Qualifiers
    const volatile int hw_reg = 0xBEEF;
    const volatile int *ptr_hw = &hw_reg;
    int memory_target = 10;
    int *const const_p = &memory_target;
    int *restrict restrict_p = &memory_target;

    // C99 Designated initializers
    int sparse_arr[5] = { [1] = 11, [3] = 33 };
    struct BitFields bit_unit = { .flag_a = 1, .flag_b = 0, .val = 7 };

    // C99 Compound literals
    int *compound_arr = (int[]){ 10, 20, 30 };
    struct BitFields compound_bf = (struct BitFields){ .flag_a = 0, .flag_b = 1, .val = 3 };

    // [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object (stack exhaustion hazard)
    size_t vla_len = (size_t)(fast_counter + 3);
    int vla_storage[vla_len];
    vla_storage[0] = math_square(5);

    // Flexible array member allocation
    struct DynamicPacket *packet = malloc(sizeof(struct DynamicPacket) + (sizeof(int) * 2));
    if (packet) {
        packet->length = 2;
        packet->payload[0] = 0x11;
        packet->payload[1] = 0x22;
        free(packet);
    }

    // Preprocessor token pasting and __func__
    int GLUE(symbolic_, var) = 777;
    const char *current_fn = __func__;

    // Operators and precedence
    int op_x = 20, op_y = 6;
    int arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    int bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    bool logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    int ternary = logical ? (bit_unit.flag_a ? 100 : 200) : 300;
    int comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    // Control flow
    enum Status state = STATUS_WORK;

    if (ternary == 100 && (state == STATUS_WORK)) {
        goto target_label;
    } else {
        while (false) {}
    }

target_label:
    do {
        switch (state) {
            case STATUS_INIT:
                run_counter++;
                // Fallthrough
            case STATUS_WORK:
                // C99 for-loop variable declaration
                for (int i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATUS_DONE:
                break;
            default:
                exit(EXIT_FAILURE);
        }
    } while (0);

    if (ternary == 999) goto end_control_label;
end_control_label: ;

    int jump_res = execute_nonlocal_jump();
    signal(SIGINT, sigint_handler);
    feclearexcept(FE_ALL_EXCEPT);

    array_provider_fn provider = array_provider;
    int (*resolved_triplet)[3] = provider();
    int triplet_val = (*resolved_triplet)[1];

    int dispatch_res = dispatch_table[0](10, 5);

    double test_matrix[2][2] = { {0.0, 0.0}, {0.0, 0.0} };
    matrix_worker(2, 2, test_matrix);

    int test_seq[4] = {1, 2, 3, 4};
    qualified_consumer(test_seq);

    int var_sum = sum_variadic(3, 10, 20, 30);

    LOG_MSG("File: %s | Line: %d | Func: %s | Symbol: %d\n",
            __FILE__, __LINE__, current_fn, symbolic_var);
    printf("C99 check: Square=%d | Sum=%d | Triplet=%d | Dispatch=%d | Runs=%lu\n",
           math_square(4), var_sum, triplet_val, dispatch_res, run_counter);

    long double checksum =
        (long double)legacy_auto + fast_counter + run_counter + *ptr_hw + *const_p + *restrict_p +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        (s_llong + u_llong) + exact_32 + exact_u64 + (active_flag ? 1 : 0) + (legacy_bool_flag ? 1 : 0) +
        dec_float + reg_double + ext_double + hex_float +
        creal(complex_f) + cimag(complex_d) + c_ascii + (int)c_wide + s_ascii[0] + (int)s_wide[0] +
        sparse_arr[1] + bit_unit.val + compound_arr[0] + compound_bf.val +
        vla_storage[0] + symbolic_var + arithmetic + bitwise + (logical ? 1 : 0) +
        ternary + comma_res + (int)state + jump_res + triplet_val + dispatch_res +
        test_matrix[0][0] + test_seq[0] + var_sum + external_symbol + CONFIG_FLAG;

    if (isnan((double)checksum)) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/*
 * omni: c99.c
 * Canonical, exhaustive ISO/IEC 9899:1999 (C99) language compendium.
 * Build: $(CC) -std=c99 -Wall -Wextra -pedantic -Werror c99.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
#include <complex.h>
#include <fenv.h>
#include <stdarg.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (ISO C99 Clause 6.10)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE(a, b) a ## b
#define LOG_MSG(fmt, ...) printf(fmt, __VA_ARGS__)

#undef OMNI_UNDEFINED
#define OMNI_C99_ACTIVE 1

#if __STDC_VERSION__ != 199901L
#  error "Strict ISO C99 compliance required"
#endif

#if defined(OMNI_C99_ACTIVE)
#  define CONFIG_FLAG 1
#elif !defined(OMNI_UNDEFINED)
#  error "Unreachable branch"
#else
#  error "Unreachable branch"
#endif

#if defined(__clang__)
#  pragma clang diagnostic push
#  pragma clang diagnostic ignored "-W#pragma-messages"
#endif
_Pragma("message(\"Omni: Verifying ISO C99 Language Construct Compliance\")")
#if defined(__clang__)
#  pragma clang diagnostic pop
#endif

/*
 * Section 2: Declarations, Structs, VLAs, Inlines, Qualifiers (Clause 6.7)
 */

/*
 * Dual-Path Saturation Pattern (ISO C99 Clause 6.7.2):
 * Optional normative keyword _Imaginary (Annex G)
 */
#ifdef __STDC_IEC_559_COMPLEX__
/* Annex G Imaginary types supported */
#else
#  if 0
typedef _Imaginary double imag_ref;
#  endif
#endif

enum Status {
    STATUS_INIT = 0,
    STATUS_WORK = 1,
    STATUS_DONE = 2, // C99 allows trailing comma in enum
};

struct DynamicPacket {
    size_t length;
    int payload[]; // Flexible array member
};

// [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness
struct BitFields {
    unsigned int flag_a : 1;
    unsigned int flag_b : 1;
    unsigned int        : 2; // Unnamed padding
    unsigned int        : 0; // Boundary alignment
    unsigned int val    : 4;
};

// C99 inline function
inline static int math_square(int x) {
    return x * x;
}

// Function prototype with variable-length array dimension indicator [*]
void matrix_worker(int rows, int cols, double matrix[*][*]);

void matrix_worker(int rows, int cols, double matrix[rows][cols]) {
    if (rows > 0 && cols > 0) matrix[0][0] = 42.0;
}

// Array parameter qualified with static and restrict
static void qualified_consumer(int buffer[static restrict 4]) {
    buffer[0] += 1;
}

// Pointer to array and complex function pointer types
static int static_triplet[3] = {10, 20, 30};

static int (*array_provider(void))[3] {
    return &static_triplet;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) {
    return a * b;
}

static binary_op_fn dispatch_table[1] = { op_multiply };

// Variadic function conforming to C99
static int sum_variadic(size_t count, ...) {
    va_list ap;
    int total = 0;
    va_start(ap, count);
    for (size_t i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 42;

static void sigint_handler(int sig) {
    (void)sig;
}

// [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers
static int execute_nonlocal_jump(void) {
    volatile int jump_performed = 0;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = 1;
            longjmp(nonlocal_buf, 1);
        }
    }
    return jump_performed;
}

int main(void) {
    // In C99, declarations can mix with code
    auto int legacy_auto = 1;
    register int fast_counter = 0;
    static unsigned long run_counter = 0;

    // Standard scalar types
    signed char s_char = -12;
    unsigned char u_char = 255U;
    short s_short = -32767;
    unsigned short u_short = 65535U;
    int s_int = -2147483647;
    unsigned int u_int = 4294967295U;
    long s_long = -2147483647L;
    unsigned long u_long = 4294967295UL;
    long long s_llong = -9223372036854775807LL;
    unsigned long long u_llong = 18446744073709551615ULL;

    // Exact-width integers from stdint.h
    int32_t exact_32 = INT32_C(-100);
    uint64_t exact_u64 = UINT64_C(200);

    // Boolean type
    bool active_flag = true;
    active_flag = false;
    _Bool legacy_bool_flag = 1;

    // Floating-point representations
    float dec_float = 1.25e-2f;
    double reg_double = 3.1415926535;
    long double ext_double = 2.718281828L;
    double hex_float = 0x1.0p-3; // C99 hexadecimal floating-point

    // Complex numbers from complex.h
    float complex complex_f = 1.0f + 2.0f * I;
    double _Complex complex_d = 3.0 + 4.0 * I;

    // Character and string literals
    char c_ascii = 'A';
    wchar_t c_wide = L'Z';
    const char *s_ascii = "ISO C99 Literal";
    const wchar_t *s_wide = L"Wide String";

    // Qualifiers
    const volatile int hw_reg = 0xBEEF;
    const volatile int *ptr_hw = &hw_reg;
    int memory_target = 10;
    int *const const_p = &memory_target;
    int *restrict restrict_p = &memory_target;

    // C99 Designated initializers
    int sparse_arr[5] = { [1] = 11, [3] = 33 };
    struct BitFields bit_unit = { .flag_a = 1, .flag_b = 0, .val = 7 };

    // C99 Compound literals
    int *compound_arr = (int[]){ 10, 20, 30 };
    struct BitFields compound_bf = (struct BitFields){ .flag_a = 0, .flag_b = 1, .val = 3 };

    // [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object (stack exhaustion hazard)
    size_t vla_len = (size_t)(fast_counter + 3);
    int vla_storage[vla_len];
    vla_storage[0] = math_square(5);

    // Flexible array member allocation
    struct DynamicPacket *packet = malloc(sizeof(struct DynamicPacket) + (sizeof(int) * 2));
    if (packet) {
        packet->length = 2;
        packet->payload[0] = 0x11;
        packet->payload[1] = 0x22;
        free(packet);
    }

    // Preprocessor token pasting and __func__
    int GLUE(symbolic_, var) = 777;
    const char *current_fn = __func__;

    // Operators and precedence
    int op_x = 20, op_y = 6;
    int arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    int bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    bool logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    int ternary = logical ? (bit_unit.flag_a ? 100 : 200) : 300;
    int comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    // Control flow
    enum Status state = STATUS_WORK;

    if (ternary == 100 && (state == STATUS_WORK)) {
        goto target_label;
    } else {
        while (false) {}
    }

target_label:
    do {
        switch (state) {
            case STATUS_INIT:
                run_counter++;
                // Fallthrough
            case STATUS_WORK:
                // C99 for-loop variable declaration
                for (int i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATUS_DONE:
                break;
            default:
                exit(EXIT_FAILURE);
        }
    } while (0);

    if (ternary == 999) goto end_control_label;
end_control_label: ;

    int jump_res = execute_nonlocal_jump();
    signal(SIGINT, sigint_handler);
    feclearexcept(FE_ALL_EXCEPT);

    array_provider_fn provider = array_provider;
    int (*resolved_triplet)[3] = provider();
    int triplet_val = (*resolved_triplet)[1];

    int dispatch_res = dispatch_table[0](10, 5);

    double test_matrix[2][2] = { {0.0, 0.0}, {0.0, 0.0} };
    matrix_worker(2, 2, test_matrix);

    int test_seq[4] = {1, 2, 3, 4};
    qualified_consumer(test_seq);

    int var_sum = sum_variadic(3, 10, 20, 30);

    LOG_MSG("File: %s | Line: %d | Func: %s | Symbol: %d\n",
            __FILE__, __LINE__, current_fn, symbolic_var);
    printf("C99 check: Square=%d | Sum=%d | Triplet=%d | Dispatch=%d | Runs=%lu\n",
           math_square(4), var_sum, triplet_val, dispatch_res, run_counter);

    long double checksum =
        (long double)legacy_auto + fast_counter + run_counter + *ptr_hw + *const_p + *restrict_p +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        (s_llong + u_llong) + exact_32 + exact_u64 + (active_flag ? 1 : 0) + (legacy_bool_flag ? 1 : 0) +
        dec_float + reg_double + ext_double + hex_float +
        creal(complex_f) + cimag(complex_d) + c_ascii + (int)c_wide + s_ascii[0] + (int)s_wide[0] +
        sparse_arr[1] + bit_unit.val + compound_arr[0] + compound_bf.val +
        vla_storage[0] + symbolic_var + arithmetic + bitwise + (logical ? 1 : 0) +
        ternary + comma_res + (int)state + jump_res + triplet_val + dispatch_res +
        test_matrix[0][0] + test_seq[0] + var_sum + external_symbol + CONFIG_FLAG;

    if (isnan((double)checksum)) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
omni / c / c89.c The Baseline

ANSI X3.159-1989 / ISO/IEC 9899:1990

The original standardized ANSI/ISO C compendium. Exercises the complete foundational grammar under strict declarations-before-statements ordering, exact 32 keywords, and classic K&R compatibility.

Verification Command -std=c89 -Wall -Wextra -pedantic -Werror -lm
Lexical Metrics 307 lines • Exact 32 ANSI C keywords saturated
Threat Model Anchors
Standard Capabilities Showcase (7 items)
  • Strict declaration-before-statement ordering across all lexical blocks
  • Exact 32 keywords defined in ANSI X3.159-1989
  • Absence of trailing enum commas (strictly forbidden in C89)
  • Variadic arguments via standard stdarg.h (sum_variadic)
  • Non-local jumps (setjmp/longjmp) and pure ISO signal handling (SIGINT)
  • Unbounded string manipulation demonstration (strcpy) with threat modeling
  • Scalar state accumulator consuming all declared variables
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
/*
 * omni: c89.c
 * Canonical, exhaustive ANSI X3.159-1989 / ISO/IEC 9899:1990 (C89/C90) language compendium.
 * Build: $(CC) -std=c89 -Wall -Wextra -pedantic -Werror c89.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <stdarg.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (C89 Clause 3.8 / ISO 6.8)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE(a, b) a ## b
#define SQR(x) ((x) * (x))

#undef OMNI_UNDEFINED
#define OMNI_C89_ACTIVE 1

#ifndef __STDC__
#  error "Strict ANSI C conformance required"
#endif

#ifdef __STDC_VERSION__
#  error "__STDC_VERSION__ is not defined in ANSI C89 / ISO C90"
#endif

#if defined(OMNI_C89_ACTIVE)
#  define CONFIG_FLAG 1
#elif !defined(OMNI_UNDEFINED)
#  error "Unreachable branch"
#else
#  error "Unreachable branch"
#endif

#pragma pack()

/*
 * Section 2: Types, Declarators, Structs, Unions, Enums (C89 Clause 3.5 / ISO 6.5)
 */

enum Status {
    STATUS_INIT = 0,
    STATUS_WORK = 1,
    STATUS_DONE = 2
    /* Note: Trailing comma is forbidden in C89 */
};

/* [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness */
struct BitFieldUnit {
    unsigned int flag_a : 1;
    unsigned int flag_b : 1;
    unsigned int        : 2; /* Unnamed padding bitfield */
    unsigned int        : 0; /* Force alignment to next storage boundary */
    unsigned int val    : 4;
};

union DataPayload {
    int id;
    float alt_id;
    char raw[sizeof(float)];
};

struct Record {
    struct BitFieldUnit flags;
    union DataPayload payload;
    double precision;
};

/* Pointer to array and complex function pointer types */
static int backing_array[3] = {10, 20, 30};

static int (*array_provider(void))[3] {
    return &backing_array;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) {
    return a * b;
}

static binary_op_fn dispatch_table[1] = { op_multiply };

/* Variadic function conforming to C89 stdarg.h */
static int sum_variadic(int count, ...) {
    va_list ap;
    int total = 0;
    int i;

    va_start(ap, count);
    for (i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 42;

static void sigint_handler(int sig) {
    (void)sig;
}

/* [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers */
static int execute_nonlocal_jump(void) {
    volatile int jump_performed;
    jump_performed = 0;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = 1;
            longjmp(nonlocal_buf, 1);
        }
    }
    return jump_performed;
}

int main(void) {
    /*
     * In C89, all declarations within any block MUST strictly precede
     * all statements. Mixing declarations and code is forbidden.
     */
    auto int legacy_auto;
    register int fast_counter;
    static unsigned long run_counter;

    const volatile int hw_reg = 0xBEEF;
    const volatile int *ptr_hw;
    int memory_target;
    int *const const_p = &memory_target;

    signed char s_char;
    unsigned char u_char;
    short s_short;
    unsigned short u_short;
    int s_int;
    unsigned int u_int;
    long s_long;
    unsigned long u_long;

    float dec_float;
    double reg_double;
    long double ext_double;

    int octal_literal;
    int hex_literal;

    char c_ascii;
    wchar_t c_wide;
    const char *s_ascii;
    const wchar_t *s_wide;
    char dest_buf[64];

    enum Status current_status;
    struct Record record_inst;
    int static_arr[4];

    int GLUE(symbolic_, var);
    int op_x, op_y;
    int arithmetic, bitwise;
    int logical, ternary, comma_res;

    int jump_result;
    array_provider_fn provider;
    int (*resolved_triplet)[3];
    int triplet_val;
    int dispatch_res;
    int var_sum;
    int i;
    double checksum;

    /* Statements start strictly here */
    legacy_auto = 1;
    fast_counter = 0;
    run_counter = 0;

    memory_target = 10;
    ptr_hw = &hw_reg;

    s_char = -12;
    u_char = 255U;
    s_short = -32767;
    u_short = 65535U;
    s_int = -32767;
    u_int = 65535U;
    s_long = -2147483647L;
    u_long = 4294967295UL;

    dec_float = 1.25e-2f;
    reg_double = 3.1415926535;
    ext_double = 2.718281828L;

    octal_literal = 0755;
    hex_literal = 0xABCD;

    c_ascii = 'A';
    c_wide = L'Z';
    s_ascii = "ANSI C89" " Literal Concatenation";
    s_wide = L"Wide String";

    current_status = STATUS_WORK;

    record_inst.flags.flag_a = 1;
    record_inst.flags.flag_b = 0;
    record_inst.flags.val = 7;
    record_inst.payload.id = 500;
    record_inst.precision = 0.001;

    static_arr[0] = 1;
    static_arr[1] = 2;
    static_arr[2] = 3;
    static_arr[3] = 4;

    symbolic_var = 123;

    op_x = 20;
    op_y = 6;
    arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    ternary = logical ? (record_inst.flags.flag_a ? 100 : 200) : 300;
    comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    if (ternary == 100 && current_status == STATUS_WORK) {
        goto target_label;
    } else {
        while (0) {
            /* Empty loop */
        }
    }

target_label:
    do {
        switch (current_status) {
            case STATUS_INIT:
                run_counter++;
                /* Fallthrough */
            case STATUS_WORK:
                for (i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATUS_DONE:
                break;
            default:
                exit(EXIT_FAILURE);
        }
    } while (0);

    if (ternary == 999) {
        goto end_control_label;
    }

    /* In C89, labels require an explicit statement (e.g. null statement ;) */
end_control_label: ;

    /* [!SECURITY-NOTE: SEC-C89-UNBOUNDED-01] Classic buffer overflow via unbounded string copy */
    strcpy(dest_buf, s_ascii);

    jump_result = execute_nonlocal_jump();
    signal(SIGINT, sigint_handler);

    provider = array_provider;
    resolved_triplet = provider();
    triplet_val = (*resolved_triplet)[1];

    dispatch_res = dispatch_table[0](10, 5);
    var_sum = sum_variadic(3, 10, 20, 30);

    printf("File: %s | Line: %d | Symbol: %d\n", __FILE__, __LINE__, symbolic_var);
    printf("C89 check: Sqr=%d | Sum=%d | Triplet=%d | Dispatch=%d | Runs=%lu\n",
           SQR(5), var_sum, triplet_val, dispatch_res, run_counter);

    checksum =
        (double)legacy_auto + fast_counter + run_counter + *ptr_hw + *const_p +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        dec_float + reg_double + (double)ext_double + octal_literal + hex_literal +
        c_ascii + (int)c_wide + s_ascii[0] + (int)s_wide[0] + dest_buf[0] + current_status +
        record_inst.flags.val + record_inst.payload.id + record_inst.precision +
        static_arr[0] + symbolic_var + arithmetic + bitwise + logical + ternary +
        comma_res + triplet_val + dispatch_res + var_sum + external_symbol +
        CONFIG_FLAG + jump_result;

    if (checksum < 0.0) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
/*
 * omni: c89.c
 * Canonical, exhaustive ANSI X3.159-1989 / ISO/IEC 9899:1990 (C89/C90) language compendium.
 * Build: $(CC) -std=c89 -Wall -Wextra -pedantic -Werror c89.c -lm
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <stdarg.h>
#include <setjmp.h>
#include <signal.h>
#include <math.h>

/*
 * Section 1: Preprocessor Directives (C89 Clause 3.8 / ISO 6.8)
 */

#define STR_EXPAND(x) #x
#define STR(x) STR_EXPAND(x)
#define GLUE(a, b) a ## b
#define SQR(x) ((x) * (x))

#undef OMNI_UNDEFINED
#define OMNI_C89_ACTIVE 1

#ifndef __STDC__
#  error "Strict ANSI C conformance required"
#endif

#ifdef __STDC_VERSION__
#  error "__STDC_VERSION__ is not defined in ANSI C89 / ISO C90"
#endif

#if defined(OMNI_C89_ACTIVE)
#  define CONFIG_FLAG 1
#elif !defined(OMNI_UNDEFINED)
#  error "Unreachable branch"
#else
#  error "Unreachable branch"
#endif

#pragma pack()

/*
 * Section 2: Types, Declarators, Structs, Unions, Enums (C89 Clause 3.5 / ISO 6.5)
 */

enum Status {
    STATUS_INIT = 0,
    STATUS_WORK = 1,
    STATUS_DONE = 2
    /* Note: Trailing comma is forbidden in C89 */
};

/* [!SECURITY-NOTE: SEC-BITFIELD-01] Implementation-defined bitfield packing & signedness */
struct BitFieldUnit {
    unsigned int flag_a : 1;
    unsigned int flag_b : 1;
    unsigned int        : 2; /* Unnamed padding bitfield */
    unsigned int        : 0; /* Force alignment to next storage boundary */
    unsigned int val    : 4;
};

union DataPayload {
    int id;
    float alt_id;
    char raw[sizeof(float)];
};

struct Record {
    struct BitFieldUnit flags;
    union DataPayload payload;
    double precision;
};

/* Pointer to array and complex function pointer types */
static int backing_array[3] = {10, 20, 30};

static int (*array_provider(void))[3] {
    return &backing_array;
}

typedef int (*(*array_provider_fn)(void))[3];
typedef int (*binary_op_fn)(int, int);

static int op_multiply(int a, int b) {
    return a * b;
}

static binary_op_fn dispatch_table[1] = { op_multiply };

/* Variadic function conforming to C89 stdarg.h */
static int sum_variadic(int count, ...) {
    va_list ap;
    int total = 0;
    int i;

    va_start(ap, count);
    for (i = 0; i < count; i++) {
        total += va_arg(ap, int);
    }
    va_end(ap);
    return total;
}

static jmp_buf nonlocal_buf;
extern int external_symbol;
int external_symbol = 42;

static void sigint_handler(int sig) {
    (void)sig;
}

/* [!SECURITY-NOTE: SEC-JMP-01] Non-local jumps bypass stack unwinding and clobber registers */
static int execute_nonlocal_jump(void) {
    volatile int jump_performed;
    jump_performed = 0;
    if (setjmp(nonlocal_buf) == 0) {
        if (!jump_performed) {
            jump_performed = 1;
            longjmp(nonlocal_buf, 1);
        }
    }
    return jump_performed;
}

int main(void) {
    /*
     * In C89, all declarations within any block MUST strictly precede
     * all statements. Mixing declarations and code is forbidden.
     */
    auto int legacy_auto;
    register int fast_counter;
    static unsigned long run_counter;

    const volatile int hw_reg = 0xBEEF;
    const volatile int *ptr_hw;
    int memory_target;
    int *const const_p = &memory_target;

    signed char s_char;
    unsigned char u_char;
    short s_short;
    unsigned short u_short;
    int s_int;
    unsigned int u_int;
    long s_long;
    unsigned long u_long;

    float dec_float;
    double reg_double;
    long double ext_double;

    int octal_literal;
    int hex_literal;

    char c_ascii;
    wchar_t c_wide;
    const char *s_ascii;
    const wchar_t *s_wide;
    char dest_buf[64];

    enum Status current_status;
    struct Record record_inst;
    int static_arr[4];

    int GLUE(symbolic_, var);
    int op_x, op_y;
    int arithmetic, bitwise;
    int logical, ternary, comma_res;

    int jump_result;
    array_provider_fn provider;
    int (*resolved_triplet)[3];
    int triplet_val;
    int dispatch_res;
    int var_sum;
    int i;
    double checksum;

    /* Statements start strictly here */
    legacy_auto = 1;
    fast_counter = 0;
    run_counter = 0;

    memory_target = 10;
    ptr_hw = &hw_reg;

    s_char = -12;
    u_char = 255U;
    s_short = -32767;
    u_short = 65535U;
    s_int = -32767;
    u_int = 65535U;
    s_long = -2147483647L;
    u_long = 4294967295UL;

    dec_float = 1.25e-2f;
    reg_double = 3.1415926535;
    ext_double = 2.718281828L;

    octal_literal = 0755;
    hex_literal = 0xABCD;

    c_ascii = 'A';
    c_wide = L'Z';
    s_ascii = "ANSI C89" " Literal Concatenation";
    s_wide = L"Wide String";

    current_status = STATUS_WORK;

    record_inst.flags.flag_a = 1;
    record_inst.flags.flag_b = 0;
    record_inst.flags.val = 7;
    record_inst.payload.id = 500;
    record_inst.precision = 0.001;

    static_arr[0] = 1;
    static_arr[1] = 2;
    static_arr[2] = 3;
    static_arr[3] = 4;

    symbolic_var = 123;

    op_x = 20;
    op_y = 6;
    arithmetic = ((op_x + op_y) * 2 - (op_x / op_y) + (op_x % op_y));
    bitwise = ((op_x << 2) >> 1) ^ (~op_y & (op_x | 0x0F));
    logical = (op_x > op_y) && (op_x >= 20) && (op_y < 10) && (op_y <= 6) && (op_x != op_y);
    ternary = logical ? (record_inst.flags.flag_a ? 100 : 200) : 300;
    comma_res = (fast_counter++, fast_counter + 5);

    arithmetic += 1; arithmetic -= 1; arithmetic *= 2; arithmetic /= 2; arithmetic %= 100;
    bitwise &= 0xFF; bitwise ^= 0x0F; bitwise |= 0x10; bitwise <<= 1; bitwise >>= 1;

    if (ternary == 100 && current_status == STATUS_WORK) {
        goto target_label;
    } else {
        while (0) {
            /* Empty loop */
        }
    }

target_label:
    do {
        switch (current_status) {
            case STATUS_INIT:
                run_counter++;
                /* Fallthrough */
            case STATUS_WORK:
                for (i = 0; i < 3; i++) {
                    if (i == 0) continue;
                    run_counter++;
                    if (i == 2) break;
                }
                break;
            case STATUS_DONE:
                break;
            default:
                exit(EXIT_FAILURE);
        }
    } while (0);

    if (ternary == 999) {
        goto end_control_label;
    }

    /* In C89, labels require an explicit statement (e.g. null statement ;) */
end_control_label: ;

    /* [!SECURITY-NOTE: SEC-C89-UNBOUNDED-01] Classic buffer overflow via unbounded string copy */
    strcpy(dest_buf, s_ascii);

    jump_result = execute_nonlocal_jump();
    signal(SIGINT, sigint_handler);

    provider = array_provider;
    resolved_triplet = provider();
    triplet_val = (*resolved_triplet)[1];

    dispatch_res = dispatch_table[0](10, 5);
    var_sum = sum_variadic(3, 10, 20, 30);

    printf("File: %s | Line: %d | Symbol: %d\n", __FILE__, __LINE__, symbolic_var);
    printf("C89 check: Sqr=%d | Sum=%d | Triplet=%d | Dispatch=%d | Runs=%lu\n",
           SQR(5), var_sum, triplet_val, dispatch_res, run_counter);

    checksum =
        (double)legacy_auto + fast_counter + run_counter + *ptr_hw + *const_p +
        s_char + u_char + s_short + u_short + s_int + u_int + s_long + u_long +
        dec_float + reg_double + (double)ext_double + octal_literal + hex_literal +
        c_ascii + (int)c_wide + s_ascii[0] + (int)s_wide[0] + dest_buf[0] + current_status +
        record_inst.flags.val + record_inst.payload.id + record_inst.precision +
        static_arr[0] + symbolic_var + arithmetic + bitwise + logical + ternary +
        comma_res + triplet_val + dispatch_res + var_sum + external_symbol +
        CONFIG_FLAG + jump_result;

    if (checksum < 0.0) {
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
omni / c / security.rst Security • Threat Catalog

🛡 C Language Security and Hazardous Feature Matrix

GitLab

The omni C suite intentionally exercises historical, implementation-defined, and memory-hazardous constructs to achieve 100% grammar saturation. This threat model catalogs inline security anchors ([!SECURITY-NOTE: ID]), mapping them to formal CWE classifications and production mitigations.

Anchor Tag Standards Vulnerability & CWE Defensive Mitigation
SEC-VLA-01 C99, C11, C17, C23 Stack exhaustion / Denial of Service via dynamic runtime dimensions
CWE-400, CWE-770
Enforce bounded dynamic allocation (malloc) or fixed buffers with overflow checks
SEC-JMP-01 C89, C99, C11, C17, C23 Stack unwinding bypass, register clobbering, skipped resource cleanup
CWE-398
Replace setjmp/longjmp with structured return codes and explicit status propagation
SEC-C89-UNBOUNDED-01 C89 Classic buffer overflow via unbounded string utilities (strcpy, strcat)
CWE-120
Prohibit unbounded functions; enforce bounded copy or Annex K bounds-checking interfaces
SEC-BITFIELD-01 C89, C99, C11, C17, C23 Implementation-defined bitfield ordering, layout, and signedness ambiguity
CWE-198
Avoid bitfields for IPC/protocols; use explicit bitwise masking over fixed-width types
SEC-ATOMIC-01 C11, C17, C23 Data races and instruction reordering via relaxed memory orders
CWE-662
Default to sequential consistency (memory_order_seq_cst) unless formal models prove safety

Operational threat model and hazard advisory for C language constructs demonstrated in omni.

Executive Summary

The omni C suite (c89.c through c23.c) serves as an exhaustive syntactic reference and compiler saturator. To demonstrate 100% of the language, these files deliberately exercise historical, implementation-defined, and memory-hazardous constructs.

This code is an executable syntax compendium; it is not hardened production software. When using omni for syntax reference, never copy hazardous constructs into production systems without defensive architectural controls.

Threat Model Index

Anchor Tag

Affected Standards

Primary Vulnerability

Defensive Production Recommendation

SEC-VLA-01

C99, C11, C17, C23

Stack exhaustion / denial of service (CWE-400, CWE-770)

Use fixed-size buffers or bounded dynamic allocation (malloc) with integer overflow checks.

SEC-JMP-01

C89, C99, C11, C17, C23

Register clobbering, stack unwinding bypass, resource leakage

Replace setjmp/longjmp with explicit error return codes and structured status propagation.

SEC-C89-UNBOUNDED-01

C89

Classic buffer overflow via unbounded string utilities (CWE-120)

Prohibit strcpy/strcat; enforce bounded alternatives or Annex K bounds-checking interfaces.

SEC-BITFIELD-01

C89, C99, C11, C17, C23

Implementation-defined allocation unit ordering and signedness ambiguity

Avoid bitfields for wire protocols or IPC; use explicit bitwise masking over fixed-width unsigned types.

SEC-ATOMIC-01

C11, C17, C23

Data races and out-of-order execution via relaxed memory ordering

Default to sequential consistency (memory_order_seq_cst) unless formal memory models prove correctness.

Detailed Hazard Analysis

Variable-Length Arrays: SEC-VLA-01

  • Mechanism: Dynamic stack allocation based on runtime dimensions (int arr[n];).

  • Hazard: Stack overflow cannot be intercepted in standard C; supplying an unvalidated or oversized integer triggers immediate segmentation faults or stack clash exploits.

  • Standard Evolution: C99 introduced VLAs as mandatory. C11 and C17 made VLA objects optional (conditional on __STDC_NO_VLA__). C23 preserves variably modified (VM) pointer types (int (*p)[n]) while keeping VLA stack objects optional.

  • Industry Mandates: Fully banned in the Linux Kernel, Google C++ Style Guide, and MISRA C:2023 Rule 18.8.

Non-Local Jumps: SEC-JMP-01

  • Mechanism: Direct context restoration across stack frames using setjmp and longjmp.

  • Hazard: Local non-volatile variables modified between setjmp and longjmp contain indeterminate values upon jump completion. Furthermore, non-local jumps bypass cleanup handlers, mutex unlocking, and file descriptor closure.

  • Remediation: Use structured return values (e.g. error enumeration or status struct) and handle unwind logic explicitly.

Unbounded Buffer Operations: SEC-C89-UNBOUNDED-01

  • Mechanism: Unbounded string copy operations (e.g. strcpy, strcat, sprintf).

  • Hazard: Destination buffer overrun when input lengths exceed fixed capacities.

  • Remediation: In modern C code, enforce strict length validation, size-bounded routines, or dynamic allocation with explicit bounds checks.

Bitfield Portability: SEC-BITFIELD-01

  • Mechanism: Packing multiple logical flags into partial integer storage units.

  • Hazard: The order of bit allocation within storage units (high-to-low or low-to-high) is implementation-defined. Plain int bitfields may be signed or unsigned depending on the compiler ABI.

  • Remediation: For serialization or hardware register mapping, use unsigned fixed-width types (uint32_t) and explicit shift/mask operators.

Relaxed Atomics: SEC-ATOMIC-01

  • Mechanism: Atomic operations using memory_order_relaxed.

  • Hazard: Relaxed ordering provides atomicity but zero synchronization or instruction ordering guarantees across threads.

  • Remediation: Use memory_order_acquire, memory_order_release, or memory_order_seq_cst to enforce memory barriers across concurrent execution contexts.

Production Toolchain Hardening

When compiling C for production deployments, enforce the following baseline compiler hardening flags:

# GCC / Clang hardening baseline
CFLAGS += -fstack-protector-strong -D_FORTIFY_SOURCE=3 -fPIE -Wformat=2 -Wformat-security
LDFLAGS += -Wl,-z,relro -Wl,-z,now -pie

# Dynamic analysis during automated testing
CFLAGS_TEST := -fsanitize=address,undefined -fno-omit-frame-pointer
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
================================================
C Language Security and Hazardous Feature Matrix
================================================

Operational threat model and hazard advisory for C language constructs demonstrated in omni.

Executive Summary
=================

The ``omni`` C suite (``c89.c`` through ``c23.c``) serves as an exhaustive syntactic reference and compiler saturator. To demonstrate 100% of the language, these files deliberately exercise historical, implementation-defined, and memory-hazardous constructs.

This code is an executable syntax compendium; it is not hardened production software. When using ``omni`` for syntax reference, never copy hazardous constructs into production systems without defensive architectural controls.

Threat Model Index
==================

.. list-table::
   :widths: 20 25 25 30
   :header-rows: 1

   * - Anchor Tag
     - Affected Standards
     - Primary Vulnerability
     - Defensive Production Recommendation

   * - ``SEC-VLA-01``
     - C99, C11, C17, C23
     - Stack exhaustion / denial of service (CWE-400, CWE-770)
     - Use fixed-size buffers or bounded dynamic allocation (``malloc``) with integer overflow checks.

   * - ``SEC-JMP-01``
     - C89, C99, C11, C17, C23
     - Register clobbering, stack unwinding bypass, resource leakage
     - Replace ``setjmp``/``longjmp`` with explicit error return codes and structured status propagation.

   * - ``SEC-C89-UNBOUNDED-01``
     - C89
     - Classic buffer overflow via unbounded string utilities (CWE-120)
     - Prohibit ``strcpy``/``strcat``; enforce bounded alternatives or Annex K bounds-checking interfaces.

   * - ``SEC-BITFIELD-01``
     - C89, C99, C11, C17, C23
     - Implementation-defined allocation unit ordering and signedness ambiguity
     - Avoid bitfields for wire protocols or IPC; use explicit bitwise masking over fixed-width unsigned types.

   * - ``SEC-ATOMIC-01``
     - C11, C17, C23
     - Data races and out-of-order execution via relaxed memory ordering
     - Default to sequential consistency (``memory_order_seq_cst``) unless formal memory models prove correctness.

Detailed Hazard Analysis
========================

Variable-Length Arrays: SEC-VLA-01
----------------------------------

* **Mechanism**: Dynamic stack allocation based on runtime dimensions (``int arr[n];``).
* **Hazard**: Stack overflow cannot be intercepted in standard C; supplying an unvalidated or oversized integer triggers immediate segmentation faults or stack clash exploits.
* **Standard Evolution**: C99 introduced VLAs as mandatory. C11 and C17 made VLA objects optional (conditional on ``__STDC_NO_VLA__``). C23 preserves variably modified (VM) pointer types (``int (*p)[n]``) while keeping VLA stack objects optional.
* **Industry Mandates**: Fully banned in the Linux Kernel, Google C++ Style Guide, and MISRA C:2023 Rule 18.8.

Non-Local Jumps: SEC-JMP-01
---------------------------

* **Mechanism**: Direct context restoration across stack frames using ``setjmp`` and ``longjmp``.
* **Hazard**: Local non-volatile variables modified between ``setjmp`` and ``longjmp`` contain indeterminate values upon jump completion. Furthermore, non-local jumps bypass cleanup handlers, mutex unlocking, and file descriptor closure.
* **Remediation**: Use structured return values (e.g. error enumeration or status struct) and handle unwind logic explicitly.

Unbounded Buffer Operations: SEC-C89-UNBOUNDED-01
-------------------------------------------------

* **Mechanism**: Unbounded string copy operations (e.g. ``strcpy``, ``strcat``, ``sprintf``).
* **Hazard**: Destination buffer overrun when input lengths exceed fixed capacities.
* **Remediation**: In modern C code, enforce strict length validation, size-bounded routines, or dynamic allocation with explicit bounds checks.

Bitfield Portability: SEC-BITFIELD-01
-------------------------------------

* **Mechanism**: Packing multiple logical flags into partial integer storage units.
* **Hazard**: The order of bit allocation within storage units (high-to-low or low-to-high) is implementation-defined. Plain ``int`` bitfields may be signed or unsigned depending on the compiler ABI.
* **Remediation**: For serialization or hardware register mapping, use unsigned fixed-width types (``uint32_t``) and explicit shift/mask operators.

Relaxed Atomics: SEC-ATOMIC-01
------------------------------

* **Mechanism**: Atomic operations using ``memory_order_relaxed``.
* **Hazard**: Relaxed ordering provides atomicity but zero synchronization or instruction ordering guarantees across threads.
* **Remediation**: Use ``memory_order_acquire``, ``memory_order_release``, or ``memory_order_seq_cst`` to enforce memory barriers across concurrent execution contexts.

Production Toolchain Hardening
==============================

When compiling C for production deployments, enforce the following baseline compiler hardening flags:

.. code-block:: bash

   # GCC / Clang hardening baseline
   CFLAGS += -fstack-protector-strong -D_FORTIFY_SOURCE=3 -fPIE -Wformat=2 -Wformat-security
   LDFLAGS += -Wl,-z,relro -Wl,-z,now -pie

   # Dynamic analysis during automated testing
   CFLAGS_TEST := -fsanitize=address,undefined -fno-omit-frame-pointer
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
================================================
C Language Security and Hazardous Feature Matrix
================================================

Operational threat model and hazard advisory for C language constructs demonstrated in omni.

Executive Summary
=================

The ``omni`` C suite (``c89.c`` through ``c23.c``) serves as an exhaustive syntactic reference and compiler saturator. To demonstrate 100% of the language, these files deliberately exercise historical, implementation-defined, and memory-hazardous constructs.

This code is an executable syntax compendium; it is not hardened production software. When using ``omni`` for syntax reference, never copy hazardous constructs into production systems without defensive architectural controls.

Threat Model Index
==================

.. list-table::
   :widths: 20 25 25 30
   :header-rows: 1

   * - Anchor Tag
     - Affected Standards
     - Primary Vulnerability
     - Defensive Production Recommendation

   * - ``SEC-VLA-01``
     - C99, C11, C17, C23
     - Stack exhaustion / denial of service (CWE-400, CWE-770)
     - Use fixed-size buffers or bounded dynamic allocation (``malloc``) with integer overflow checks.

   * - ``SEC-JMP-01``
     - C89, C99, C11, C17, C23
     - Register clobbering, stack unwinding bypass, resource leakage
     - Replace ``setjmp``/``longjmp`` with explicit error return codes and structured status propagation.

   * - ``SEC-C89-UNBOUNDED-01``
     - C89
     - Classic buffer overflow via unbounded string utilities (CWE-120)
     - Prohibit ``strcpy``/``strcat``; enforce bounded alternatives or Annex K bounds-checking interfaces.

   * - ``SEC-BITFIELD-01``
     - C89, C99, C11, C17, C23
     - Implementation-defined allocation unit ordering and signedness ambiguity
     - Avoid bitfields for wire protocols or IPC; use explicit bitwise masking over fixed-width unsigned types.

   * - ``SEC-ATOMIC-01``
     - C11, C17, C23
     - Data races and out-of-order execution via relaxed memory ordering
     - Default to sequential consistency (``memory_order_seq_cst``) unless formal memory models prove correctness.

Detailed Hazard Analysis
========================

Variable-Length Arrays: SEC-VLA-01
----------------------------------

* **Mechanism**: Dynamic stack allocation based on runtime dimensions (``int arr[n];``).
* **Hazard**: Stack overflow cannot be intercepted in standard C; supplying an unvalidated or oversized integer triggers immediate segmentation faults or stack clash exploits.
* **Standard Evolution**: C99 introduced VLAs as mandatory. C11 and C17 made VLA objects optional (conditional on ``__STDC_NO_VLA__``). C23 preserves variably modified (VM) pointer types (``int (*p)[n]``) while keeping VLA stack objects optional.
* **Industry Mandates**: Fully banned in the Linux Kernel, Google C++ Style Guide, and MISRA C:2023 Rule 18.8.

Non-Local Jumps: SEC-JMP-01
---------------------------

* **Mechanism**: Direct context restoration across stack frames using ``setjmp`` and ``longjmp``.
* **Hazard**: Local non-volatile variables modified between ``setjmp`` and ``longjmp`` contain indeterminate values upon jump completion. Furthermore, non-local jumps bypass cleanup handlers, mutex unlocking, and file descriptor closure.
* **Remediation**: Use structured return values (e.g. error enumeration or status struct) and handle unwind logic explicitly.

Unbounded Buffer Operations: SEC-C89-UNBOUNDED-01
-------------------------------------------------

* **Mechanism**: Unbounded string copy operations (e.g. ``strcpy``, ``strcat``, ``sprintf``).
* **Hazard**: Destination buffer overrun when input lengths exceed fixed capacities.
* **Remediation**: In modern C code, enforce strict length validation, size-bounded routines, or dynamic allocation with explicit bounds checks.

Bitfield Portability: SEC-BITFIELD-01
-------------------------------------

* **Mechanism**: Packing multiple logical flags into partial integer storage units.
* **Hazard**: The order of bit allocation within storage units (high-to-low or low-to-high) is implementation-defined. Plain ``int`` bitfields may be signed or unsigned depending on the compiler ABI.
* **Remediation**: For serialization or hardware register mapping, use unsigned fixed-width types (``uint32_t``) and explicit shift/mask operators.

Relaxed Atomics: SEC-ATOMIC-01
------------------------------

* **Mechanism**: Atomic operations using ``memory_order_relaxed``.
* **Hazard**: Relaxed ordering provides atomicity but zero synchronization or instruction ordering guarantees across threads.
* **Remediation**: Use ``memory_order_acquire``, ``memory_order_release``, or ``memory_order_seq_cst`` to enforce memory barriers across concurrent execution contexts.

Production Toolchain Hardening
==============================

When compiling C for production deployments, enforce the following baseline compiler hardening flags:

.. code-block:: bash

   # GCC / Clang hardening baseline
   CFLAGS += -fstack-protector-strong -D_FORTIFY_SOURCE=3 -fPIE -Wformat=2 -Wformat-security
   LDFLAGS += -Wl,-z,relro -Wl,-z,now -pie

   # Dynamic analysis during automated testing
   CFLAGS_TEST := -fsanitize=address,undefined -fno-omit-frame-pointer
omni / c / README.rst Language Guide

C Reference Implementations and Standards Matrix

GitLab

C Language reference suite overview, compiler baselines, enforced warning flags, and per-standard distinguishing features.

Canonical, minimal C reference implementations across all standard iterations from C89 to C23.

Executive Summary

The c/ directory provides an exhaustive, self-contained syntax compendium for each ratified edition of the ISO/IEC 9899 standard. Each file exercises 100% of the language features introduced or permitted by its respective standard while strictly omitting constructs from future editions. All implementations compile cleanly under both GCC and Clang with maximum warning enforcement and zero warnings permitted.

Standards Matrix

Standard

Formal Identifier

File

Distinguishing Additions

C89/C90

ANSI X3.159-1989, ISO/IEC 9899:1990

c/c89.c

Declarations strictly before statements, K&R compatibility, no trailing commas in enums, exact 32 keywords.

C99

ISO/IEC 9899:1999

c/c99.c

Mixed declarations, line comments, for loop declarations, long long, _Bool, inline, restrict, VLAs, flexible array members, designated initializers, compound literals, variadic macros, __func__, hex floats.

C11

ISO/IEC 9899:2011

c/c11.c

_Static_assert, _Alignas, _Alignof, _Atomic, _Generic, _Noreturn, _Thread_local, anonymous structs and unions, char16_t and char32_t unicode literals.

C17

ISO/IEC 9899:2018

c/c17.c

Defect-report resolution release; __STDC_VERSION__ = 201710L; deprecation of ATOMIC_VAR_INIT.

C23

ISO/IEC 9899:2024

c/c23.c

Extended #embed, standard attributes ([[nodiscard]], [[reproducible]], etc.), constexpr, nullptr, auto type deduction, typeof, typeof_unqual, _BitInt, binary literals, digit separators, UTF-8 char constants, labels anywhere.

Toolchain Baseline

All implementations are continuously verified against the following toolchains:

Target

Standard Flag

Enforced Compiler Flags

C89

-std=c89

-Wall -Wextra -pedantic -Werror -lm

C99

-std=c99

-Wall -Wextra -pedantic -Werror -lm

C11

-std=c11

-Wall -Wextra -pedantic -Werror -pthread -lm

C17

-std=c17

-Wall -Wextra -pedantic -Werror -pthread -lm

C23

-std=c23

-Wall -Wextra -pedantic -Werror -pthread -lm

Verification and Execution

To build and execute all C standard implementations:

make check-c

To verify an individual standard:

make check-c89
make check-c99
make check-c11
make check-c17
make check-c23

Security and Hazardous Feature Catalog

Omni intentionally exercises historical and memory-hazardous language features (such as Variable-Length Arrays, unbounded operations, and setjmp/longjmp) to achieve complete syntactic coverage. For the corresponding threat model index, CWE mappings, and production hardening guidelines, refer to c/security.rst.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
===========================
C Reference Implementations
===========================

Canonical, minimal C reference implementations across all standard iterations from C89 to C23.

Executive Summary
=================

The ``c/`` directory provides an exhaustive, self-contained syntax compendium for each ratified edition of the ISO/IEC 9899 standard. Each file exercises 100% of the language features introduced or permitted by its respective standard while strictly omitting constructs from future editions. All implementations compile cleanly under both GCC and Clang with maximum warning enforcement and zero warnings permitted.

Standards Matrix
================

.. list-table::
   :widths: 15 25 25 35
   :header-rows: 1

   * - Standard
     - Formal Identifier
     - File
     - Distinguishing Additions

   * - C89/C90
     - ANSI X3.159-1989, ISO/IEC 9899:1990
     - ``c/c89.c``
     - Declarations strictly before statements, K&R compatibility, no trailing commas in enums, exact 32 keywords.

   * - C99
     - ISO/IEC 9899:1999
     - ``c/c99.c``
     - Mixed declarations, line comments, ``for`` loop declarations, ``long long``, ``_Bool``, ``inline``, ``restrict``, VLAs, flexible array members, designated initializers, compound literals, variadic macros, ``__func__``, hex floats.

   * - C11
     - ISO/IEC 9899:2011
     - ``c/c11.c``
     - ``_Static_assert``, ``_Alignas``, ``_Alignof``, ``_Atomic``, ``_Generic``, ``_Noreturn``, ``_Thread_local``, anonymous structs and unions, ``char16_t`` and ``char32_t`` unicode literals.

   * - C17
     - ISO/IEC 9899:2018
     - ``c/c17.c``
     - Defect-report resolution release; ``__STDC_VERSION__ = 201710L``; deprecation of ``ATOMIC_VAR_INIT``.

   * - C23
     - ISO/IEC 9899:2024
     - ``c/c23.c``
     - Extended ``#embed``, standard attributes (``[[nodiscard]]``, ``[[reproducible]]``, etc.), ``constexpr``, ``nullptr``, ``auto`` type deduction, ``typeof``, ``typeof_unqual``, ``_BitInt``, binary literals, digit separators, UTF-8 char constants, labels anywhere.

Toolchain Baseline
==================

All implementations are continuously verified against the following toolchains:

.. list-table::
   :widths: 20 20 60
   :header-rows: 1

   * - Target
     - Standard Flag
     - Enforced Compiler Flags

   * - C89
     - ``-std=c89``
     - ``-Wall -Wextra -pedantic -Werror -lm``

   * - C99
     - ``-std=c99``
     - ``-Wall -Wextra -pedantic -Werror -lm``

   * - C11
     - ``-std=c11``
     - ``-Wall -Wextra -pedantic -Werror -pthread -lm``

   * - C17
     - ``-std=c17``
     - ``-Wall -Wextra -pedantic -Werror -pthread -lm``

   * - C23
     - ``-std=c23``
     - ``-Wall -Wextra -pedantic -Werror -pthread -lm``

Verification and Execution
==========================

To build and execute all C standard implementations:

.. code-block:: bash

   make check-c

To verify an individual standard:

.. code-block:: bash

   make check-c89
   make check-c99
   make check-c11
   make check-c17
   make check-c23

Security and Hazardous Feature Catalog
======================================

Omni intentionally exercises historical and memory-hazardous language features (such as Variable-Length Arrays, unbounded operations, and ``setjmp``/``longjmp``) to achieve complete syntactic coverage. For the corresponding threat model index, CWE mappings, and production hardening guidelines, refer to ``c/security.rst``.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
===========================
C Reference Implementations
===========================

Canonical, minimal C reference implementations across all standard iterations from C89 to C23.

Executive Summary
=================

The ``c/`` directory provides an exhaustive, self-contained syntax compendium for each ratified edition of the ISO/IEC 9899 standard. Each file exercises 100% of the language features introduced or permitted by its respective standard while strictly omitting constructs from future editions. All implementations compile cleanly under both GCC and Clang with maximum warning enforcement and zero warnings permitted.

Standards Matrix
================

.. list-table::
   :widths: 15 25 25 35
   :header-rows: 1

   * - Standard
     - Formal Identifier
     - File
     - Distinguishing Additions

   * - C89/C90
     - ANSI X3.159-1989, ISO/IEC 9899:1990
     - ``c/c89.c``
     - Declarations strictly before statements, K&R compatibility, no trailing commas in enums, exact 32 keywords.

   * - C99
     - ISO/IEC 9899:1999
     - ``c/c99.c``
     - Mixed declarations, line comments, ``for`` loop declarations, ``long long``, ``_Bool``, ``inline``, ``restrict``, VLAs, flexible array members, designated initializers, compound literals, variadic macros, ``__func__``, hex floats.

   * - C11
     - ISO/IEC 9899:2011
     - ``c/c11.c``
     - ``_Static_assert``, ``_Alignas``, ``_Alignof``, ``_Atomic``, ``_Generic``, ``_Noreturn``, ``_Thread_local``, anonymous structs and unions, ``char16_t`` and ``char32_t`` unicode literals.

   * - C17
     - ISO/IEC 9899:2018
     - ``c/c17.c``
     - Defect-report resolution release; ``__STDC_VERSION__ = 201710L``; deprecation of ``ATOMIC_VAR_INIT``.

   * - C23
     - ISO/IEC 9899:2024
     - ``c/c23.c``
     - Extended ``#embed``, standard attributes (``[[nodiscard]]``, ``[[reproducible]]``, etc.), ``constexpr``, ``nullptr``, ``auto`` type deduction, ``typeof``, ``typeof_unqual``, ``_BitInt``, binary literals, digit separators, UTF-8 char constants, labels anywhere.

Toolchain Baseline
==================

All implementations are continuously verified against the following toolchains:

.. list-table::
   :widths: 20 20 60
   :header-rows: 1

   * - Target
     - Standard Flag
     - Enforced Compiler Flags

   * - C89
     - ``-std=c89``
     - ``-Wall -Wextra -pedantic -Werror -lm``

   * - C99
     - ``-std=c99``
     - ``-Wall -Wextra -pedantic -Werror -lm``

   * - C11
     - ``-std=c11``
     - ``-Wall -Wextra -pedantic -Werror -pthread -lm``

   * - C17
     - ``-std=c17``
     - ``-Wall -Wextra -pedantic -Werror -pthread -lm``

   * - C23
     - ``-std=c23``
     - ``-Wall -Wextra -pedantic -Werror -pthread -lm``

Verification and Execution
==========================

To build and execute all C standard implementations:

.. code-block:: bash

   make check-c

To verify an individual standard:

.. code-block:: bash

   make check-c89
   make check-c99
   make check-c11
   make check-c17
   make check-c23

Security and Hazardous Feature Catalog
======================================

Omni intentionally exercises historical and memory-hazardous language features (such as Variable-Length Arrays, unbounded operations, and ``setjmp``/``longjmp``) to achieve complete syntactic coverage. For the corresponding threat model index, CWE mappings, and production hardening guidelines, refer to ``c/security.rst``.
omni / docs / standards.rst Roadmap

Language Standards and Roadmap

GitLab

Comprehensive matrix of verified language editions, toolchain baselines, and prospective target horizons.

File Path docs/standards.rst
Document Size 131 lines

Complete inventory of supported language specifications, reference implementations, and active target horizons.

Overview

Omni provides a single, canonical, self-contained reference file for each language standard edition that captures 100% of its grammar, syntax, type system, attributes, preprocessor facilities, and literal forms.

This document details all verified language editions, toolchain compilation baselines, and upcoming target standards.

Current Supported Standards

The following reference implementations are fully implemented, verified with zero compiler warnings under pedantic enforcement, and tested to exit with status code 0:

Language

Standard

Formal Specification

Reference File

Verification Status

C

C89/C90

ANSI X3.159-1989, ISO/IEC 9899:1990

c/c89.c

Verified (GCC, Clang)

C

C99

ISO/IEC 9899:1999

c/c99.c

Verified (GCC, Clang)

C

C11

ISO/IEC 9899:2011

c/c11.c

Verified (GCC, Clang)

C

C17

ISO/IEC 9899:2018

c/c17.c

Verified (GCC, Clang)

C

C23

ISO/IEC 9899:2024

c/c23.c

Verified (GCC, Clang)

For distinguishing features, compiler flags, and threat modeling for the C family, consult the C Reference Suite and the C Security Threat Model catalog.

Language Horizon and Roadmap

Omni is systematically expanding across systems and modern programming languages. Contributions are actively solicited for the following targets:

C++ Family

ISO/IEC 14882 standard revisions represent major syntactic expansions across decades:

  • C++98/C++03 (cpp/cpp98.cpp): Templates, exceptions, namespaces, runtime type information, standard library streams.

  • C++11 (cpp/cpp11.cpp): Move semantics, rvalue references, lambda expressions, auto type deduction, constexpr, smart pointers, memory model.

  • C++14 (cpp/cpp14.cpp): Generic lambdas, relaxed constexpr, binary literals, variable templates.

  • C++17 (cpp/cpp17.cpp): Structured bindings, if constexpr, fold expressions, class template argument deduction, filesystem, std::string_view.

  • C++20 (cpp/cpp20.cpp): Concepts and constraints, coroutines, modules, three-way comparison operator, ranges.

  • C++23 (cpp/cpp23.cpp): Explicit object parameter (deducing this), multidimensional subscript, standard library modules, expected.

Zig Family

Zig targets explicit memory control, comptime execution, and absence of hidden control flow:

  • Zig 0.13.0 (zig/zig013.zig): Established comptime reification, explicit allocators, tagged unions, error handling.

  • Zig 0.14.0 (zig/zig014.zig): Updated standard library layouts, modified comptime reflection builtins, IO abstractions.

Crystal Family

Crystal blends expressive syntax with compiled type safety, fiber concurrency, and macro metaprogramming:

  • Crystal 1.x (crystal/crystal1.cr): Type unions, fibers, channels, execution contexts, macro expansion, C ABI bindings, nil-safety.

Go Family

Go prioritizes communicative concurrency, interface abstraction, and structural simplicity:

  • Modern Go (go/go122.go): Goroutines, channels, interfaces, type parameters (generics), loop variable semantics, context propagation.

Rust Family

Rust editions define epochal evolution of compiler semantics and borrow checking:

  • Rust 2018 (rust/rust2018.rs): Non-lexical lifetimes, path clarity, trait object syntax.

  • Rust 2021 (rust/rust2021.rs): Disjoint capture in closures, IntoIterator for arrays, panic macro changes.

  • Rust 2024 (rust/rust2024.rs): Return position impl Trait in traits, async closures, revised unsafe attributes.

Python Family

Python provides rich structural grammar and expressive typing within interpreted environments:

  • Python 3.10-3.13 (python/py313.py): Structural pattern matching (match/case), union type operators (|), exception groups, type parameter syntax (PEP 695).

Bash and POSIX Shell Family

Shell scripting standards govern systems orchestration and POSIX compatibility:

  • GNU Bash 5.x (bash/bash5.bash): Associative arrays, parameter transformation, arithmetic evaluation, coprocesses, process substitution.

  • POSIX.1-2024 Shell (sh/sh2024.sh): Pure POSIX command language without non-standard extensions.

Contributing a Language Target

To introduce a new language or standard edition to omni:

  1. Follow the 6-phase engineering lifecycle in process.rst.

  2. Adhere to repository layout conventions in architecture.rst.

  3. Verify requirements and testing checklists in CONTRIBUTING.rst.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
==============================
Language Standards and Roadmap
==============================

Complete inventory of supported language specifications, reference implementations, and active target horizons.

Overview
========

Omni provides a single, canonical, self-contained reference file for each language standard edition that captures 100% of its grammar, syntax, type system, attributes, preprocessor facilities, and literal forms.

This document details all verified language editions, toolchain compilation baselines, and upcoming target standards.

Current Supported Standards
===========================

The following reference implementations are fully implemented, verified with zero compiler warnings under pedantic enforcement, and tested to exit with status code ``0``:

.. list-table::
   :widths: 12 18 32 18 20
   :header-rows: 1

   * - Language
     - Standard
     - Formal Specification
     - Reference File
     - Verification Status

   * - C
     - C89/C90
     - ANSI X3.159-1989, ISO/IEC 9899:1990
     - ``c/c89.c``
     - Verified (GCC, Clang)

   * - C
     - C99
     - ISO/IEC 9899:1999
     - ``c/c99.c``
     - Verified (GCC, Clang)

   * - C
     - C11
     - ISO/IEC 9899:2011
     - ``c/c11.c``
     - Verified (GCC, Clang)

   * - C
     - C17
     - ISO/IEC 9899:2018
     - ``c/c17.c``
     - Verified (GCC, Clang)

   * - C
     - C23
     - ISO/IEC 9899:2024
     - ``c/c23.c``
     - Verified (GCC, Clang)

For distinguishing features, compiler flags, and threat modeling for the C family, consult the `C Reference Suite <../c/README.rst>`_ and the `C Security Threat Model <../c/security.rst>`_ catalog.

Language Horizon and Roadmap
============================

Omni is systematically expanding across systems and modern programming languages. Contributions are actively solicited for the following targets:

C++ Family
----------

ISO/IEC 14882 standard revisions represent major syntactic expansions across decades:

* **C++98/C++03** (``cpp/cpp98.cpp``): Templates, exceptions, namespaces, runtime type information, standard library streams.
* **C++11** (``cpp/cpp11.cpp``): Move semantics, rvalue references, lambda expressions, ``auto`` type deduction, ``constexpr``, smart pointers, memory model.
* **C++14** (``cpp/cpp14.cpp``): Generic lambdas, relaxed ``constexpr``, binary literals, variable templates.
* **C++17** (``cpp/cpp17.cpp``): Structured bindings, ``if constexpr``, fold expressions, class template argument deduction, filesystem, ``std::string_view``.
* **C++20** (``cpp/cpp20.cpp``): Concepts and constraints, coroutines, modules, three-way comparison operator, ranges.
* **C++23** (``cpp/cpp23.cpp``): Explicit object parameter (deducing this), multidimensional subscript, standard library modules, expected.

Zig Family
----------

Zig targets explicit memory control, comptime execution, and absence of hidden control flow:

* **Zig 0.13.0** (``zig/zig013.zig``): Established comptime reification, explicit allocators, tagged unions, error handling.
* **Zig 0.14.0** (``zig/zig014.zig``): Updated standard library layouts, modified comptime reflection builtins, IO abstractions.

Crystal Family
--------------

Crystal blends expressive syntax with compiled type safety, fiber concurrency, and macro metaprogramming:

* **Crystal 1.x** (``crystal/crystal1.cr``): Type unions, fibers, channels, execution contexts, macro expansion, C ABI bindings, nil-safety.

Go Family
---------

Go prioritizes communicative concurrency, interface abstraction, and structural simplicity:

* **Modern Go** (``go/go122.go``): Goroutines, channels, interfaces, type parameters (generics), loop variable semantics, context propagation.

Rust Family
-----------

Rust editions define epochal evolution of compiler semantics and borrow checking:

* **Rust 2018** (``rust/rust2018.rs``): Non-lexical lifetimes, path clarity, trait object syntax.
* **Rust 2021** (``rust/rust2021.rs``): Disjoint capture in closures, IntoIterator for arrays, panic macro changes.
* **Rust 2024** (``rust/rust2024.rs``): Return position impl Trait in traits, async closures, revised unsafe attributes.

Python Family
-------------

Python provides rich structural grammar and expressive typing within interpreted environments:

* **Python 3.10-3.13** (``python/py313.py``): Structural pattern matching (``match``/``case``), union type operators (``|``), exception groups, type parameter syntax (PEP 695).

Bash and POSIX Shell Family
---------------------------

Shell scripting standards govern systems orchestration and POSIX compatibility:

* **GNU Bash 5.x** (``bash/bash5.bash``): Associative arrays, parameter transformation, arithmetic evaluation, coprocesses, process substitution.
* **POSIX.1-2024 Shell** (``sh/sh2024.sh``): Pure POSIX command language without non-standard extensions.

Contributing a Language Target
==============================

To introduce a new language or standard edition to omni:

1. Follow the 6-phase engineering lifecycle in `process.rst <process.rst>`_.
2. Adhere to repository layout conventions in `architecture.rst <architecture.rst>`_.
3. Verify requirements and testing checklists in `CONTRIBUTING.rst <../CONTRIBUTING.rst>`_.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
==============================
Language Standards and Roadmap
==============================

Complete inventory of supported language specifications, reference implementations, and active target horizons.

Overview
========

Omni provides a single, canonical, self-contained reference file for each language standard edition that captures 100% of its grammar, syntax, type system, attributes, preprocessor facilities, and literal forms.

This document details all verified language editions, toolchain compilation baselines, and upcoming target standards.

Current Supported Standards
===========================

The following reference implementations are fully implemented, verified with zero compiler warnings under pedantic enforcement, and tested to exit with status code ``0``:

.. list-table::
   :widths: 12 18 32 18 20
   :header-rows: 1

   * - Language
     - Standard
     - Formal Specification
     - Reference File
     - Verification Status

   * - C
     - C89/C90
     - ANSI X3.159-1989, ISO/IEC 9899:1990
     - ``c/c89.c``
     - Verified (GCC, Clang)

   * - C
     - C99
     - ISO/IEC 9899:1999
     - ``c/c99.c``
     - Verified (GCC, Clang)

   * - C
     - C11
     - ISO/IEC 9899:2011
     - ``c/c11.c``
     - Verified (GCC, Clang)

   * - C
     - C17
     - ISO/IEC 9899:2018
     - ``c/c17.c``
     - Verified (GCC, Clang)

   * - C
     - C23
     - ISO/IEC 9899:2024
     - ``c/c23.c``
     - Verified (GCC, Clang)

For distinguishing features, compiler flags, and threat modeling for the C family, consult the `C Reference Suite <../c/README.rst>`_ and the `C Security Threat Model <../c/security.rst>`_ catalog.

Language Horizon and Roadmap
============================

Omni is systematically expanding across systems and modern programming languages. Contributions are actively solicited for the following targets:

C++ Family
----------

ISO/IEC 14882 standard revisions represent major syntactic expansions across decades:

* **C++98/C++03** (``cpp/cpp98.cpp``): Templates, exceptions, namespaces, runtime type information, standard library streams.
* **C++11** (``cpp/cpp11.cpp``): Move semantics, rvalue references, lambda expressions, ``auto`` type deduction, ``constexpr``, smart pointers, memory model.
* **C++14** (``cpp/cpp14.cpp``): Generic lambdas, relaxed ``constexpr``, binary literals, variable templates.
* **C++17** (``cpp/cpp17.cpp``): Structured bindings, ``if constexpr``, fold expressions, class template argument deduction, filesystem, ``std::string_view``.
* **C++20** (``cpp/cpp20.cpp``): Concepts and constraints, coroutines, modules, three-way comparison operator, ranges.
* **C++23** (``cpp/cpp23.cpp``): Explicit object parameter (deducing this), multidimensional subscript, standard library modules, expected.

Zig Family
----------

Zig targets explicit memory control, comptime execution, and absence of hidden control flow:

* **Zig 0.13.0** (``zig/zig013.zig``): Established comptime reification, explicit allocators, tagged unions, error handling.
* **Zig 0.14.0** (``zig/zig014.zig``): Updated standard library layouts, modified comptime reflection builtins, IO abstractions.

Crystal Family
--------------

Crystal blends expressive syntax with compiled type safety, fiber concurrency, and macro metaprogramming:

* **Crystal 1.x** (``crystal/crystal1.cr``): Type unions, fibers, channels, execution contexts, macro expansion, C ABI bindings, nil-safety.

Go Family
---------

Go prioritizes communicative concurrency, interface abstraction, and structural simplicity:

* **Modern Go** (``go/go122.go``): Goroutines, channels, interfaces, type parameters (generics), loop variable semantics, context propagation.

Rust Family
-----------

Rust editions define epochal evolution of compiler semantics and borrow checking:

* **Rust 2018** (``rust/rust2018.rs``): Non-lexical lifetimes, path clarity, trait object syntax.
* **Rust 2021** (``rust/rust2021.rs``): Disjoint capture in closures, IntoIterator for arrays, panic macro changes.
* **Rust 2024** (``rust/rust2024.rs``): Return position impl Trait in traits, async closures, revised unsafe attributes.

Python Family
-------------

Python provides rich structural grammar and expressive typing within interpreted environments:

* **Python 3.10-3.13** (``python/py313.py``): Structural pattern matching (``match``/``case``), union type operators (``|``), exception groups, type parameter syntax (PEP 695).

Bash and POSIX Shell Family
---------------------------

Shell scripting standards govern systems orchestration and POSIX compatibility:

* **GNU Bash 5.x** (``bash/bash5.bash``): Associative arrays, parameter transformation, arithmetic evaluation, coprocesses, process substitution.
* **POSIX.1-2024 Shell** (``sh/sh2024.sh``): Pure POSIX command language without non-standard extensions.

Contributing a Language Target
==============================

To introduce a new language or standard edition to omni:

1. Follow the 6-phase engineering lifecycle in `process.rst <process.rst>`_.
2. Adhere to repository layout conventions in `architecture.rst <architecture.rst>`_.
3. Verify requirements and testing checklists in `CONTRIBUTING.rst <../CONTRIBUTING.rst>`_.
omni / docs / architecture.rst Architecture

Repository Architecture Guide

GitLab

Structural design, directory layout conventions, and single-file self-containment invariants.

File Path docs/architecture.rst
Document Size 78 lines

Structural design, directory layout, and build harness conventions for omni.

Design Philosophy

Omni is structured as a polyglot language compendium. Each programming language occupies its own isolated subdirectory, maintaining self-contained documentation, security guidelines, and source reference files.

A single root GNUmakefile coordinates detection, compilation, and test execution across all supported toolchains without polluting language directories.

Directory Hierarchy

omni/
├── GNUmakefile
├── README.rst
├── CONTRIBUTING.rst
├── CHANGELOG.rst
├── docs/
│   ├── architecture.rst
│   ├── process.rst
│   └── standards.rst
└── <language>/
    ├── README.rst
    ├── security.rst
    └── <standard>.<ext>

Subdirectory Responsibilities

Language Root Directory

Each language directory is named using the lowercase canonical name of the language (for example, c/, cpp/, zig/, crystal/, go/, rust/, python/).

Reference Source Files

  • Source filenames represent the formal standard edition or language revision (for example, c89.c, c99.c, c11.c, c17.c, c23.c, or cpp20.cpp, cpp23.cpp).

  • If a language does not have formal versioned ISO standards, use major/minor releases (for example, py312.py or zig014.zig).

  • Each source file must be completely self-contained and buildable with standard toolchains.

Language README: README.rst

Every language directory contains a README.rst defining:

  • The standards matrix and formal document identifiers.

  • Distinguishing language features added or removed in each revision.

  • Compiler baseline and mandatory compilation flags.

  • Verification commands specific to that language.

Security Catalog: security.rst

Every language that permits memory manipulation, non-local control flow, or unchecked concurrency must provide a security.rst threat model matrix linking inline source code tags ([!SECURITY-NOTE: ID]) to formal vulnerability analyses and production remediation guidelines.

Build System Invariants

The root GNUmakefile enforces the following requirements across all languages:

  1. Parse-Time Toolchain Inspection: All compiler detection uses Make parse-time evaluation (command -v <tool>). Shell conditional blocks inside recipes must never be used to skip compilation, as missing output binaries break Make target idempotency.

  2. Dynamic Target Generation: Target lists are constructed programmatically using foreach expansions across available toolchains and language standards.

  3. Automatic Error Cleanup: .DELETE_ON_ERROR: is enabled globally to ensure interrupted builds delete partial target artifacts.

  4. Strict Shell Defaults: SHELL is set to /usr/bin/bash with .SHELLFLAGS := -euo pipefail -c to guarantee immediate pipeline failure detection.

  5. Standardized Check Targets: The build harness exposes uniform top-level targets:

    • make all: Default target, runs make check.

    • make check: Builds and executes all verified language implementations across all detected compilers.

    • make check-<language>: Verifies all editions for a specific language (for example, make check-c).

    • make check-<standard>: Verifies a single edition (for example, make check-c23).

    • make clean: Cleans the build/ artifact directory.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
=============================
Repository Architecture Guide
=============================

Structural design, directory layout, and build harness conventions for omni.

Design Philosophy
=================

Omni is structured as a polyglot language compendium. Each programming language occupies its own isolated subdirectory, maintaining self-contained documentation, security guidelines, and source reference files.

A single root ``GNUmakefile`` coordinates detection, compilation, and test execution across all supported toolchains without polluting language directories.

Directory Hierarchy
===================

.. code-block:: text

   omni/
   ├── GNUmakefile
   ├── README.rst
   ├── CONTRIBUTING.rst
   ├── CHANGELOG.rst
   ├── docs/
   │   ├── architecture.rst
   │   ├── process.rst
   │   └── standards.rst
   └── <language>/
       ├── README.rst
       ├── security.rst
       └── <standard>.<ext>

Subdirectory Responsibilities
=============================

Language Root Directory
-----------------------

Each language directory is named using the lowercase canonical name of the language (for example, ``c/``, ``cpp/``, ``zig/``, ``crystal/``, ``go/``, ``rust/``, ``python/``).

Reference Source Files
----------------------

* Source filenames represent the formal standard edition or language revision (for example, ``c89.c``, ``c99.c``, ``c11.c``, ``c17.c``, ``c23.c``, or ``cpp20.cpp``, ``cpp23.cpp``).
* If a language does not have formal versioned ISO standards, use major/minor releases (for example, ``py312.py`` or ``zig014.zig``).
* Each source file must be completely self-contained and buildable with standard toolchains.

Language README: README.rst
---------------------------

Every language directory contains a ``README.rst`` defining:

* The standards matrix and formal document identifiers.
* Distinguishing language features added or removed in each revision.
* Compiler baseline and mandatory compilation flags.
* Verification commands specific to that language.

Security Catalog: security.rst
------------------------------

Every language that permits memory manipulation, non-local control flow, or unchecked concurrency must provide a ``security.rst`` threat model matrix linking inline source code tags (``[!SECURITY-NOTE: ID]``) to formal vulnerability analyses and production remediation guidelines.

Build System Invariants
=======================

The root ``GNUmakefile`` enforces the following requirements across all languages:

1. **Parse-Time Toolchain Inspection**: All compiler detection uses Make parse-time evaluation (``command -v <tool>``). Shell conditional blocks inside recipes must never be used to skip compilation, as missing output binaries break Make target idempotency.
2. **Dynamic Target Generation**: Target lists are constructed programmatically using ``foreach`` expansions across available toolchains and language standards.
3. **Automatic Error Cleanup**: ``.DELETE_ON_ERROR:`` is enabled globally to ensure interrupted builds delete partial target artifacts.
4. **Strict Shell Defaults**: ``SHELL`` is set to ``/usr/bin/bash`` with ``.SHELLFLAGS := -euo pipefail -c`` to guarantee immediate pipeline failure detection.
5. **Standardized Check Targets**: The build harness exposes uniform top-level targets:

   * ``make all``: Default target, runs ``make check``.
   * ``make check``: Builds and executes all verified language implementations across all detected compilers.
   * ``make check-<language>``: Verifies all editions for a specific language (for example, ``make check-c``).
   * ``make check-<standard>``: Verifies a single edition (for example, ``make check-c23``).
   * ``make clean``: Cleans the ``build/`` artifact directory.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
=============================
Repository Architecture Guide
=============================

Structural design, directory layout, and build harness conventions for omni.

Design Philosophy
=================

Omni is structured as a polyglot language compendium. Each programming language occupies its own isolated subdirectory, maintaining self-contained documentation, security guidelines, and source reference files.

A single root ``GNUmakefile`` coordinates detection, compilation, and test execution across all supported toolchains without polluting language directories.

Directory Hierarchy
===================

.. code-block:: text

   omni/
   ├── GNUmakefile
   ├── README.rst
   ├── CONTRIBUTING.rst
   ├── CHANGELOG.rst
   ├── docs/
   │   ├── architecture.rst
   │   ├── process.rst
   │   └── standards.rst
   └── <language>/
       ├── README.rst
       ├── security.rst
       └── <standard>.<ext>

Subdirectory Responsibilities
=============================

Language Root Directory
-----------------------

Each language directory is named using the lowercase canonical name of the language (for example, ``c/``, ``cpp/``, ``zig/``, ``crystal/``, ``go/``, ``rust/``, ``python/``).

Reference Source Files
----------------------

* Source filenames represent the formal standard edition or language revision (for example, ``c89.c``, ``c99.c``, ``c11.c``, ``c17.c``, ``c23.c``, or ``cpp20.cpp``, ``cpp23.cpp``).
* If a language does not have formal versioned ISO standards, use major/minor releases (for example, ``py312.py`` or ``zig014.zig``).
* Each source file must be completely self-contained and buildable with standard toolchains.

Language README: README.rst
---------------------------

Every language directory contains a ``README.rst`` defining:

* The standards matrix and formal document identifiers.
* Distinguishing language features added or removed in each revision.
* Compiler baseline and mandatory compilation flags.
* Verification commands specific to that language.

Security Catalog: security.rst
------------------------------

Every language that permits memory manipulation, non-local control flow, or unchecked concurrency must provide a ``security.rst`` threat model matrix linking inline source code tags (``[!SECURITY-NOTE: ID]``) to formal vulnerability analyses and production remediation guidelines.

Build System Invariants
=======================

The root ``GNUmakefile`` enforces the following requirements across all languages:

1. **Parse-Time Toolchain Inspection**: All compiler detection uses Make parse-time evaluation (``command -v <tool>``). Shell conditional blocks inside recipes must never be used to skip compilation, as missing output binaries break Make target idempotency.
2. **Dynamic Target Generation**: Target lists are constructed programmatically using ``foreach`` expansions across available toolchains and language standards.
3. **Automatic Error Cleanup**: ``.DELETE_ON_ERROR:`` is enabled globally to ensure interrupted builds delete partial target artifacts.
4. **Strict Shell Defaults**: ``SHELL`` is set to ``/usr/bin/bash`` with ``.SHELLFLAGS := -euo pipefail -c`` to guarantee immediate pipeline failure detection.
5. **Standardized Check Targets**: The build harness exposes uniform top-level targets:

   * ``make all``: Default target, runs ``make check``.
   * ``make check``: Builds and executes all verified language implementations across all detected compilers.
   * ``make check-<language>``: Verifies all editions for a specific language (for example, ``make check-c``).
   * ``make check-<standard>``: Verifies a single edition (for example, ``make check-c23``).
   * ``make clean``: Cleans the ``build/`` artifact directory.
omni / docs / process.rst Methodology

Compendium Creation Process

GitLab

The 6-phase engineering lifecycle for authoring, verifying, and maintaining omni language reference files.

File Path docs/process.rst
Document Size 122 lines

Architectural methodology for authoring, validating, and maintaining omni language reference files.

Overview

Creating an omni file is an exercise in dense, exhaustive language synthesis. Unlike conventional tutorials or code samples, an omni compendium captures 100% of a language's normative grammar, keywords, types, attributes, and preprocessor facilities within the smallest possible single, self-contained, executable file.

This document formalizes the 6-phase engineering lifecycle required for any language added to the repository.

Phase 1: Normative Standard Extraction

Every omni implementation must be anchored to an authoritative specification; never rely on colloquial documentation or associative memory.

Research Checklist

  • Lexical Keyword Table: Extract the complete list of reserved words, contextual keywords, and retained backward-compatibility tokens from the formal standard grammar.

  • Type System Catalog: Identify all primitive scalar types, exact-width integers, floating-point formats, pointers, references, composites, and user-defined type declarators.

  • Operators and Precedence: Catalogue every unary, binary, ternary, assignment, and compound operator across all precedence tiers.

  • Literal Grammars: Identify every valid literal form: octal, hexadecimal, binary, digit separators, character sets, wide characters, unicode encodings, and raw strings.

  • Preprocessor and Attributes: List all directives, macro operators, conditional inclusion mechanisms, and standardized attributes.

Phase 2: Single-File Architecture

An omni reference file must remain strictly self-contained. External user-defined headers are prohibited; only standard library interfaces defined by the language specification are permitted.

Structure the implementation into four sequential logical sections:

  • Section 1: Directives and Metaprogramming: Language version assertions, standard library imports, macro definitions, token concatenation, and stringification operators.

  • Section 2: Types, Declarators, and Interfaces: Structs, unions, enums, typedefs, bitfields, function pointer signatures, qualified parameters, and generic interfaces.

  • Section 3: Optional Language Facilities: Dual-path fallbacks for optional standard annexes or compiler-dependent capabilities.

  • Section 4: Execution Driver and State Accumulator: The entrypoint function exercising control flow, literal forms, expressions, jumps, signal handlers, and scalar variable consumption.

Phase 3: Dual-Path Saturation Pattern

Language standards frequently include optional annexes or conditionally supported features (for instance, ISO C Annex G Imaginary types, or Decimal Floating Point in Annex F). Compilers often omit support for these extensions while maintaining general conformance.

To achieve 100% lexical saturation without causing compilation errors on conformant compilers, apply the dual-path pattern:

#ifdef __STDC_IEC_60559_DFP__
static _Decimal32  active_d32  = 1.0DF;
static _Decimal64  active_d64  = 1.0DD;
static _Decimal128 active_d128 = 1.0DL;
#else
#  if 0
typedef _Decimal32  d32_ref;
typedef _Decimal64  d64_ref;
typedef _Decimal128 d128_ref;
#  endif
#endif

When the macro is defined by a supporting toolchain, the tokens participate in runtime execution. When unsupported, the tokens remain lexically present inside an inactive preprocessor branch, fulfilling the lexical saturation requirement while compiling cleanly under -Werror.

Phase 4: Scalar State Accumulator Pattern

Exercising every type, qualifier, and storage class creates dozens of variables. In production-grade compiler configurations with -Wall -Wextra -Werror, unread variables trigger build-breaking unused-variable errors.

Suppressing these warnings with repeated cast expressions (such as (void)var;) clutters the file and inflates line count with non-functional boilerplate.

Instead, consume every declared scalar variable in a single mathematical accumulator expression:

int validate_system_state(int legacy_auto, int fast_counter, double reg_double, char c_ascii) {
    double checksum = (double)legacy_auto + fast_counter + reg_double + c_ascii;
    if (checksum < 0.0) {
        return 1;
    }
    return 0;
}

This technique provides three distinct advantages:

  • Eliminates hundreds of lines of dead cast boilerplate.

  • Mathematically forces the compiler's semantic analyzer and optimizer to evaluate all storage locations.

  • Enables deterministic runtime validation; if any calculation produces invalid floating-point state, the binary exits with non-zero status.

Phase 5: Bidirectional Security Threat Modeling

Because omni demonstrates 100% of a language, it must deliberately include historically hazardous, implementation-defined, or memory-unsafe constructs (such as variable-length arrays, non-local jumps, unbounded buffer copies, and relaxed atomic memory operations).

To ensure these demonstrations never mislead developers into adopting unsafe idioms, every hazardous feature must adhere to the bidirectional threat model:

  1. Inline Source Tag: The construct in code must be annotated immediately with a standardized comment tag:

    void exercise_vla(int vla_len) {
        /* [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object; stack exhaustion hazard */
        int vla_storage[vla_len];
        vla_storage[0] = 42;
    }
  2. Language Security Catalog: The corresponding language directory must contain a security.rst file indexing the tag, detailing:

    • The architectural mechanism.

    • Associated Common Weakness Enumeration identifiers (CWE).

    • Industry standards prohibiting the construct (MISRA, Linux Kernel, CERT).

    • Safe modern production alternatives.

Phase 6: Multi-Toolchain Verification

An omni implementation is complete only after rigorous verification across multiple standard-compliant compilers and operating environments.

Verification Criteria

  • Zero Warnings Under Strict Flags: The code must compile with zero warnings under flags such as -Wall -Wextra -pedantic -Werror.

  • Parse-Time Toolchain Detection: Build rules in GNUmakefile must inspect toolchain availability at parse time to maintain build idempotency.

  • Deterministic Execution: The compiled binary must execute to completion and exit with code 0.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
====================================
Language Compendium Creation Process
====================================

Architectural methodology for authoring, validating, and maintaining omni language reference files.

Overview
========

Creating an omni file is an exercise in dense, exhaustive language synthesis. Unlike conventional tutorials or code samples, an omni compendium captures 100% of a language's normative grammar, keywords, types, attributes, and preprocessor facilities within the smallest possible single, self-contained, executable file.

This document formalizes the 6-phase engineering lifecycle required for any language added to the repository.

Phase 1: Normative Standard Extraction
======================================

Every omni implementation must be anchored to an authoritative specification; never rely on colloquial documentation or associative memory.

Research Checklist
------------------

* **Lexical Keyword Table**: Extract the complete list of reserved words, contextual keywords, and retained backward-compatibility tokens from the formal standard grammar.
* **Type System Catalog**: Identify all primitive scalar types, exact-width integers, floating-point formats, pointers, references, composites, and user-defined type declarators.
* **Operators and Precedence**: Catalogue every unary, binary, ternary, assignment, and compound operator across all precedence tiers.
* **Literal Grammars**: Identify every valid literal form: octal, hexadecimal, binary, digit separators, character sets, wide characters, unicode encodings, and raw strings.
* **Preprocessor and Attributes**: List all directives, macro operators, conditional inclusion mechanisms, and standardized attributes.

Phase 2: Single-File Architecture
=================================

An omni reference file must remain strictly self-contained. External user-defined headers are prohibited; only standard library interfaces defined by the language specification are permitted.

Structure the implementation into four sequential logical sections:

* **Section 1: Directives and Metaprogramming**: Language version assertions, standard library imports, macro definitions, token concatenation, and stringification operators.
* **Section 2: Types, Declarators, and Interfaces**: Structs, unions, enums, typedefs, bitfields, function pointer signatures, qualified parameters, and generic interfaces.
* **Section 3: Optional Language Facilities**: Dual-path fallbacks for optional standard annexes or compiler-dependent capabilities.
* **Section 4: Execution Driver and State Accumulator**: The entrypoint function exercising control flow, literal forms, expressions, jumps, signal handlers, and scalar variable consumption.

Phase 3: Dual-Path Saturation Pattern
=====================================

Language standards frequently include optional annexes or conditionally supported features (for instance, ISO C Annex G Imaginary types, or Decimal Floating Point in Annex F). Compilers often omit support for these extensions while maintaining general conformance.

To achieve 100% lexical saturation without causing compilation errors on conformant compilers, apply the dual-path pattern:

.. code-block:: c

   #ifdef __STDC_IEC_60559_DFP__
   static _Decimal32  active_d32  = 1.0DF;
   static _Decimal64  active_d64  = 1.0DD;
   static _Decimal128 active_d128 = 1.0DL;
   #else
   #  if 0
   typedef _Decimal32  d32_ref;
   typedef _Decimal64  d64_ref;
   typedef _Decimal128 d128_ref;
   #  endif
   #endif

When the macro is defined by a supporting toolchain, the tokens participate in runtime execution. When unsupported, the tokens remain lexically present inside an inactive preprocessor branch, fulfilling the lexical saturation requirement while compiling cleanly under ``-Werror``.

Phase 4: Scalar State Accumulator Pattern
=========================================

Exercising every type, qualifier, and storage class creates dozens of variables. In production-grade compiler configurations with ``-Wall -Wextra -Werror``, unread variables trigger build-breaking ``unused-variable`` errors.

Suppressing these warnings with repeated cast expressions (such as ``(void)var;``) clutters the file and inflates line count with non-functional boilerplate.

Instead, consume every declared scalar variable in a single mathematical accumulator expression:

.. code-block:: c

   int validate_system_state(int legacy_auto, int fast_counter, double reg_double, char c_ascii) {
       double checksum = (double)legacy_auto + fast_counter + reg_double + c_ascii;
       if (checksum < 0.0) {
           return 1;
       }
       return 0;
   }

This technique provides three distinct advantages:

* Eliminates hundreds of lines of dead cast boilerplate.
* Mathematically forces the compiler's semantic analyzer and optimizer to evaluate all storage locations.
* Enables deterministic runtime validation; if any calculation produces invalid floating-point state, the binary exits with non-zero status.

Phase 5: Bidirectional Security Threat Modeling
===============================================

Because omni demonstrates 100% of a language, it must deliberately include historically hazardous, implementation-defined, or memory-unsafe constructs (such as variable-length arrays, non-local jumps, unbounded buffer copies, and relaxed atomic memory operations).

To ensure these demonstrations never mislead developers into adopting unsafe idioms, every hazardous feature must adhere to the bidirectional threat model:

1. **Inline Source Tag**: The construct in code must be annotated immediately with a standardized comment tag:

   .. code-block:: c

      void exercise_vla(int vla_len) {
          /* [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object; stack exhaustion hazard */
          int vla_storage[vla_len];
          vla_storage[0] = 42;
      }

2. **Language Security Catalog**: The corresponding language directory must contain a ``security.rst`` file indexing the tag, detailing:

   * The architectural mechanism.
   * Associated Common Weakness Enumeration identifiers (CWE).
   * Industry standards prohibiting the construct (MISRA, Linux Kernel, CERT).
   * Safe modern production alternatives.

Phase 6: Multi-Toolchain Verification
=====================================

An omni implementation is complete only after rigorous verification across multiple standard-compliant compilers and operating environments.

Verification Criteria
---------------------

* **Zero Warnings Under Strict Flags**: The code must compile with zero warnings under flags such as ``-Wall -Wextra -pedantic -Werror``.
* **Parse-Time Toolchain Detection**: Build rules in ``GNUmakefile`` must inspect toolchain availability at parse time to maintain build idempotency.
* **Deterministic Execution**: The compiled binary must execute to completion and exit with code ``0``.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
====================================
Language Compendium Creation Process
====================================

Architectural methodology for authoring, validating, and maintaining omni language reference files.

Overview
========

Creating an omni file is an exercise in dense, exhaustive language synthesis. Unlike conventional tutorials or code samples, an omni compendium captures 100% of a language's normative grammar, keywords, types, attributes, and preprocessor facilities within the smallest possible single, self-contained, executable file.

This document formalizes the 6-phase engineering lifecycle required for any language added to the repository.

Phase 1: Normative Standard Extraction
======================================

Every omni implementation must be anchored to an authoritative specification; never rely on colloquial documentation or associative memory.

Research Checklist
------------------

* **Lexical Keyword Table**: Extract the complete list of reserved words, contextual keywords, and retained backward-compatibility tokens from the formal standard grammar.
* **Type System Catalog**: Identify all primitive scalar types, exact-width integers, floating-point formats, pointers, references, composites, and user-defined type declarators.
* **Operators and Precedence**: Catalogue every unary, binary, ternary, assignment, and compound operator across all precedence tiers.
* **Literal Grammars**: Identify every valid literal form: octal, hexadecimal, binary, digit separators, character sets, wide characters, unicode encodings, and raw strings.
* **Preprocessor and Attributes**: List all directives, macro operators, conditional inclusion mechanisms, and standardized attributes.

Phase 2: Single-File Architecture
=================================

An omni reference file must remain strictly self-contained. External user-defined headers are prohibited; only standard library interfaces defined by the language specification are permitted.

Structure the implementation into four sequential logical sections:

* **Section 1: Directives and Metaprogramming**: Language version assertions, standard library imports, macro definitions, token concatenation, and stringification operators.
* **Section 2: Types, Declarators, and Interfaces**: Structs, unions, enums, typedefs, bitfields, function pointer signatures, qualified parameters, and generic interfaces.
* **Section 3: Optional Language Facilities**: Dual-path fallbacks for optional standard annexes or compiler-dependent capabilities.
* **Section 4: Execution Driver and State Accumulator**: The entrypoint function exercising control flow, literal forms, expressions, jumps, signal handlers, and scalar variable consumption.

Phase 3: Dual-Path Saturation Pattern
=====================================

Language standards frequently include optional annexes or conditionally supported features (for instance, ISO C Annex G Imaginary types, or Decimal Floating Point in Annex F). Compilers often omit support for these extensions while maintaining general conformance.

To achieve 100% lexical saturation without causing compilation errors on conformant compilers, apply the dual-path pattern:

.. code-block:: c

   #ifdef __STDC_IEC_60559_DFP__
   static _Decimal32  active_d32  = 1.0DF;
   static _Decimal64  active_d64  = 1.0DD;
   static _Decimal128 active_d128 = 1.0DL;
   #else
   #  if 0
   typedef _Decimal32  d32_ref;
   typedef _Decimal64  d64_ref;
   typedef _Decimal128 d128_ref;
   #  endif
   #endif

When the macro is defined by a supporting toolchain, the tokens participate in runtime execution. When unsupported, the tokens remain lexically present inside an inactive preprocessor branch, fulfilling the lexical saturation requirement while compiling cleanly under ``-Werror``.

Phase 4: Scalar State Accumulator Pattern
=========================================

Exercising every type, qualifier, and storage class creates dozens of variables. In production-grade compiler configurations with ``-Wall -Wextra -Werror``, unread variables trigger build-breaking ``unused-variable`` errors.

Suppressing these warnings with repeated cast expressions (such as ``(void)var;``) clutters the file and inflates line count with non-functional boilerplate.

Instead, consume every declared scalar variable in a single mathematical accumulator expression:

.. code-block:: c

   int validate_system_state(int legacy_auto, int fast_counter, double reg_double, char c_ascii) {
       double checksum = (double)legacy_auto + fast_counter + reg_double + c_ascii;
       if (checksum < 0.0) {
           return 1;
       }
       return 0;
   }

This technique provides three distinct advantages:

* Eliminates hundreds of lines of dead cast boilerplate.
* Mathematically forces the compiler's semantic analyzer and optimizer to evaluate all storage locations.
* Enables deterministic runtime validation; if any calculation produces invalid floating-point state, the binary exits with non-zero status.

Phase 5: Bidirectional Security Threat Modeling
===============================================

Because omni demonstrates 100% of a language, it must deliberately include historically hazardous, implementation-defined, or memory-unsafe constructs (such as variable-length arrays, non-local jumps, unbounded buffer copies, and relaxed atomic memory operations).

To ensure these demonstrations never mislead developers into adopting unsafe idioms, every hazardous feature must adhere to the bidirectional threat model:

1. **Inline Source Tag**: The construct in code must be annotated immediately with a standardized comment tag:

   .. code-block:: c

      void exercise_vla(int vla_len) {
          /* [!SECURITY-NOTE: SEC-VLA-01] Block scope VLA object; stack exhaustion hazard */
          int vla_storage[vla_len];
          vla_storage[0] = 42;
      }

2. **Language Security Catalog**: The corresponding language directory must contain a ``security.rst`` file indexing the tag, detailing:

   * The architectural mechanism.
   * Associated Common Weakness Enumeration identifiers (CWE).
   * Industry standards prohibiting the construct (MISRA, Linux Kernel, CERT).
   * Safe modern production alternatives.

Phase 6: Multi-Toolchain Verification
=====================================

An omni implementation is complete only after rigorous verification across multiple standard-compliant compilers and operating environments.

Verification Criteria
---------------------

* **Zero Warnings Under Strict Flags**: The code must compile with zero warnings under flags such as ``-Wall -Wextra -pedantic -Werror``.
* **Parse-Time Toolchain Detection**: Build rules in ``GNUmakefile`` must inspect toolchain availability at parse time to maintain build idempotency.
* **Deterministic Execution**: The compiled binary must execute to completion and exit with code ``0``.
omni / docs / CONTRIBUTING.rst Governance

Contributing Guidelines

GitLab

Contribution requirements, workflow steps, submission checklist, and multi-platform channels.

File Path CONTRIBUTING.rst
Document Size 131 lines

Guidelines for authoring and submitting language reference implementations to omni.

Philosophy and Scope

Omni aims to provide the single smallest, cleanest, self-contained reference file for every major programming language and language standard edition. Each file serves as an executable Rosetta stone, capturing 100% of the grammar, keywords, types, attributes, and directives of the target language.

We welcome contributions of new languages, newer or historical standard editions, and verification improvements.

Core Requirements for Contributions

Every language implementation submitted to omni must satisfy six non-negotiable criteria:

  1. Single Self-Contained Source File: All syntax must reside in a single source file without auxiliary user headers or multi-file dependencies.

  2. Exhaustive Lexical and Grammar Saturation: Every normative keyword, operator, literal representation, type qualifier, and standardized attribute must appear and be functionally or syntactically exercised.

  3. Minimal Footprint: Maximize density and eliminate dead code. Avoid dozens of individual suppression casts; use a single mathematical accumulator or scalar state consumer.

  4. Dual-Path Saturation Pattern: For optional annexes or compiler-dependent extensions, use conditional compilation with an #if 0 or inactive block fallback so the tokens are lexically present without failing builds on standard-compliant compilers.

  5. Zero-Warning Pedantic Compilation: The code must compile cleanly under maximum warning enforcement flags (for example, -Wall -Wextra -pedantic -Werror for C/C++).

  6. Executable Ground Truth: The code must compile to an executable binary that completes successfully and exits with status code 0.

Step-by-Step Submission Process

Step 1: Consult the Creation Process Guide

Before writing code, read Compendium Creation Process to understand the standard extraction methodology, state accumulator design, and dual-path fallback patterns.

Step 2: Create the Language Directory

Create a new directory named after the lowercase canonical language identifier (for example, cpp/, zig/, crystal/, go/, rust/, python/).

Populate the directory with three essential files:

  • <language>/<standard>.<ext>: The canonical reference implementation (for example, cpp23.cpp, zig014.zig).

  • <language>/README.rst: The language-specific matrix, compiler requirements, and test targets.

  • <language>/security.rst: Threat model and hazard catalog for any memory-unsafe or non-local language constructs demonstrated.

Step 3: Integrate with GNUmakefile

Add your language targets into the root GNUmakefile adhering to build invariants:

  • Inspect toolchain availability at Make parse time using command -v <compiler>.

  • Dynamically generate targets using foreach expansions.

  • Provide clean pattern rules for both compilation and execution.

  • Expose check-<language> and check-<standard> targets.

Step 4: Annotate Security Threat Anchors

If your language includes constructs with potential safety hazards (for example, unchecked pointer arithmetic, non-local jumps, memory ordering relaxation, or variable-length stack allocations):

  1. Tag the line in source code:

    /* [!SECURITY-NOTE: SEC-<ID>] Hazard description */
  2. Document the anchor tag in <language>/security.rst with architectural causes, CWE mappings, and safe production alternatives.

Step 5: Verify Locally

Verify your contribution locally against all supported compilers:

make clean
make check
rstcheck --report-level warning README.rst CONTRIBUTING.rst docs/*.rst <language>/*.rst

Both the compiler verification harness and documentation linters must report zero warnings and zero errors.

Step 6: Submit via Your Preferred Platform

Omni accepts contributions on any of our primary and secondary git remotes:

  • GitLab Merge Requests (Canonical): Create a fork and submit an MR on GitLab.

  • GitHub Pull Requests: Create a fork and submit a PR on GitHub.

  • OpenLat Patches: Push branches or submit patches via OpenLat.

Commit and Pull Request Conventions

Commit Messages

Follow the Conventional Commits specification:

feat(<lang>): add <standard> reference implementation
fix(<lang>): correct keyword saturation in <standard>
docs(<lang>): document threat model in security.rst

Sign-Off and Co-Authorship

All commits must include a Developer Certificate of Origin (DCO) sign-off trailer:

Signed-off-by: Your Name <your.email@example.com>

If you paired with an AI assistant or peer developer, include the corresponding co-authorship trailer:

Co-authored-by: Assistant Name <assistant@example.com>

GPG Signing

Cryptographic signing is enabled and encouraged across the repository. Sign all commits using your GPG/SSH key:

git commit -S -m "feat(lang): add reference implementation"

Financial Support and Donations

If you find omni valuable for your compiler engineering, syntax reference, or AI development workflows, financial contributions are gratefully accepted via Liberapay.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
=======================
Contributing Guidelines
=======================

Guidelines for authoring and submitting language reference implementations to omni.

Philosophy and Scope
====================

Omni aims to provide the single smallest, cleanest, self-contained reference file for every major programming language and language standard edition. Each file serves as an executable Rosetta stone, capturing 100% of the grammar, keywords, types, attributes, and directives of the target language.

We welcome contributions of new languages, newer or historical standard editions, and verification improvements.

Core Requirements for Contributions
===================================

Every language implementation submitted to omni must satisfy six non-negotiable criteria:

1. **Single Self-Contained Source File**: All syntax must reside in a single source file without auxiliary user headers or multi-file dependencies.
2. **Exhaustive Lexical and Grammar Saturation**: Every normative keyword, operator, literal representation, type qualifier, and standardized attribute must appear and be functionally or syntactically exercised.
3. **Minimal Footprint**: Maximize density and eliminate dead code. Avoid dozens of individual suppression casts; use a single mathematical accumulator or scalar state consumer.
4. **Dual-Path Saturation Pattern**: For optional annexes or compiler-dependent extensions, use conditional compilation with an `#if 0` or inactive block fallback so the tokens are lexically present without failing builds on standard-compliant compilers.
5. **Zero-Warning Pedantic Compilation**: The code must compile cleanly under maximum warning enforcement flags (for example, ``-Wall -Wextra -pedantic -Werror`` for C/C++).
6. **Executable Ground Truth**: The code must compile to an executable binary that completes successfully and exits with status code ``0``.

Step-by-Step Submission Process
===============================

Step 1: Consult the Creation Process Guide
------------------------------------------

Before writing code, read `Compendium Creation Process <docs/process.rst>`_ to understand the standard extraction methodology, state accumulator design, and dual-path fallback patterns.

Step 2: Create the Language Directory
-------------------------------------

Create a new directory named after the lowercase canonical language identifier (for example, ``cpp/``, ``zig/``, ``crystal/``, ``go/``, ``rust/``, ``python/``).

Populate the directory with three essential files:

* ``<language>/<standard>.<ext>``: The canonical reference implementation (for example, ``cpp23.cpp``, ``zig014.zig``).
* ``<language>/README.rst``: The language-specific matrix, compiler requirements, and test targets.
* ``<language>/security.rst``: Threat model and hazard catalog for any memory-unsafe or non-local language constructs demonstrated.

Step 3: Integrate with GNUmakefile
----------------------------------

Add your language targets into the root ``GNUmakefile`` adhering to build invariants:

* Inspect toolchain availability at Make parse time using ``command -v <compiler>``.
* Dynamically generate targets using ``foreach`` expansions.
* Provide clean pattern rules for both compilation and execution.
* Expose ``check-<language>`` and ``check-<standard>`` targets.

Step 4: Annotate Security Threat Anchors
----------------------------------------

If your language includes constructs with potential safety hazards (for example, unchecked pointer arithmetic, non-local jumps, memory ordering relaxation, or variable-length stack allocations):

1. Tag the line in source code:

   .. code-block:: c

      /* [!SECURITY-NOTE: SEC-<ID>] Hazard description */

2. Document the anchor tag in ``<language>/security.rst`` with architectural causes, CWE mappings, and safe production alternatives.

Step 5: Verify Locally
----------------------

Verify your contribution locally against all supported compilers:

.. code-block:: bash

   make clean
   make check
   rstcheck --report-level warning README.rst CONTRIBUTING.rst docs/*.rst <language>/*.rst

Both the compiler verification harness and documentation linters must report zero warnings and zero errors.

Step 6: Submit via Your Preferred Platform
------------------------------------------

Omni accepts contributions on any of our primary and secondary git remotes:

* **GitLab Merge Requests (Canonical)**: Create a fork and submit an MR on `GitLab <https://gitlab.com/renich/omni/-/merge_requests>`_.
* **GitHub Pull Requests**: Create a fork and submit a PR on `GitHub <https://github.com/renich/omni/pulls>`_.
* **OpenLat Patches**: Push branches or submit patches via `OpenLat <https://git.openlat.dev/renich/omni>`_.

Commit and Pull Request Conventions
===================================

Commit Messages
---------------

Follow the Conventional Commits specification:

.. code-block:: text

   feat(<lang>): add <standard> reference implementation
   fix(<lang>): correct keyword saturation in <standard>
   docs(<lang>): document threat model in security.rst

Sign-Off and Co-Authorship
--------------------------

All commits must include a Developer Certificate of Origin (DCO) sign-off trailer:

.. code-block:: text

   Signed-off-by: Your Name <your.email@example.com>

If you paired with an AI assistant or peer developer, include the corresponding co-authorship trailer:

.. code-block:: text

   Co-authored-by: Assistant Name <assistant@example.com>

GPG Signing
-----------

Cryptographic signing is enabled and encouraged across the repository. Sign all commits using your GPG/SSH key:

.. code-block:: bash

   git commit -S -m "feat(lang): add reference implementation"

Financial Support and Donations
===============================

If you find omni valuable for your compiler engineering, syntax reference, or AI development workflows, financial contributions are gratefully accepted via `Liberapay <https://liberapay.com/Renich/donate>`_.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
=======================
Contributing Guidelines
=======================

Guidelines for authoring and submitting language reference implementations to omni.

Philosophy and Scope
====================

Omni aims to provide the single smallest, cleanest, self-contained reference file for every major programming language and language standard edition. Each file serves as an executable Rosetta stone, capturing 100% of the grammar, keywords, types, attributes, and directives of the target language.

We welcome contributions of new languages, newer or historical standard editions, and verification improvements.

Core Requirements for Contributions
===================================

Every language implementation submitted to omni must satisfy six non-negotiable criteria:

1. **Single Self-Contained Source File**: All syntax must reside in a single source file without auxiliary user headers or multi-file dependencies.
2. **Exhaustive Lexical and Grammar Saturation**: Every normative keyword, operator, literal representation, type qualifier, and standardized attribute must appear and be functionally or syntactically exercised.
3. **Minimal Footprint**: Maximize density and eliminate dead code. Avoid dozens of individual suppression casts; use a single mathematical accumulator or scalar state consumer.
4. **Dual-Path Saturation Pattern**: For optional annexes or compiler-dependent extensions, use conditional compilation with an `#if 0` or inactive block fallback so the tokens are lexically present without failing builds on standard-compliant compilers.
5. **Zero-Warning Pedantic Compilation**: The code must compile cleanly under maximum warning enforcement flags (for example, ``-Wall -Wextra -pedantic -Werror`` for C/C++).
6. **Executable Ground Truth**: The code must compile to an executable binary that completes successfully and exits with status code ``0``.

Step-by-Step Submission Process
===============================

Step 1: Consult the Creation Process Guide
------------------------------------------

Before writing code, read `Compendium Creation Process <docs/process.rst>`_ to understand the standard extraction methodology, state accumulator design, and dual-path fallback patterns.

Step 2: Create the Language Directory
-------------------------------------

Create a new directory named after the lowercase canonical language identifier (for example, ``cpp/``, ``zig/``, ``crystal/``, ``go/``, ``rust/``, ``python/``).

Populate the directory with three essential files:

* ``<language>/<standard>.<ext>``: The canonical reference implementation (for example, ``cpp23.cpp``, ``zig014.zig``).
* ``<language>/README.rst``: The language-specific matrix, compiler requirements, and test targets.
* ``<language>/security.rst``: Threat model and hazard catalog for any memory-unsafe or non-local language constructs demonstrated.

Step 3: Integrate with GNUmakefile
----------------------------------

Add your language targets into the root ``GNUmakefile`` adhering to build invariants:

* Inspect toolchain availability at Make parse time using ``command -v <compiler>``.
* Dynamically generate targets using ``foreach`` expansions.
* Provide clean pattern rules for both compilation and execution.
* Expose ``check-<language>`` and ``check-<standard>`` targets.

Step 4: Annotate Security Threat Anchors
----------------------------------------

If your language includes constructs with potential safety hazards (for example, unchecked pointer arithmetic, non-local jumps, memory ordering relaxation, or variable-length stack allocations):

1. Tag the line in source code:

   .. code-block:: c

      /* [!SECURITY-NOTE: SEC-<ID>] Hazard description */

2. Document the anchor tag in ``<language>/security.rst`` with architectural causes, CWE mappings, and safe production alternatives.

Step 5: Verify Locally
----------------------

Verify your contribution locally against all supported compilers:

.. code-block:: bash

   make clean
   make check
   rstcheck --report-level warning README.rst CONTRIBUTING.rst docs/*.rst <language>/*.rst

Both the compiler verification harness and documentation linters must report zero warnings and zero errors.

Step 6: Submit via Your Preferred Platform
------------------------------------------

Omni accepts contributions on any of our primary and secondary git remotes:

* **GitLab Merge Requests (Canonical)**: Create a fork and submit an MR on `GitLab <https://gitlab.com/renich/omni/-/merge_requests>`_.
* **GitHub Pull Requests**: Create a fork and submit a PR on `GitHub <https://github.com/renich/omni/pulls>`_.
* **OpenLat Patches**: Push branches or submit patches via `OpenLat <https://git.openlat.dev/renich/omni>`_.

Commit and Pull Request Conventions
===================================

Commit Messages
---------------

Follow the Conventional Commits specification:

.. code-block:: text

   feat(<lang>): add <standard> reference implementation
   fix(<lang>): correct keyword saturation in <standard>
   docs(<lang>): document threat model in security.rst

Sign-Off and Co-Authorship
--------------------------

All commits must include a Developer Certificate of Origin (DCO) sign-off trailer:

.. code-block:: text

   Signed-off-by: Your Name <your.email@example.com>

If you paired with an AI assistant or peer developer, include the corresponding co-authorship trailer:

.. code-block:: text

   Co-authored-by: Assistant Name <assistant@example.com>

GPG Signing
-----------

Cryptographic signing is enabled and encouraged across the repository. Sign all commits using your GPG/SSH key:

.. code-block:: bash

   git commit -S -m "feat(lang): add reference implementation"

Financial Support and Donations
===============================

If you find omni valuable for your compiler engineering, syntax reference, or AI development workflows, financial contributions are gratefully accepted via `Liberapay <https://liberapay.com/Renich/donate>`_.
omni / docs / AGENTS.md AI Directives

Omni AI Agent Directive

GitLab

Non-negotiable invariants, scalar accumulator rules, and anti-hallucination guardrails for autonomous AI coding agents.

File Path AGENTS.md
Document Size 64 lines

Omni AI Agent Directive

Attention AI Agents: You are operating in a highly-constrained, maximally-pedantic repository. Read this directive entirely before parsing, editing, or generating any code.

1. Operating Protocol and Mission

You are contributing to omni (canonical upstream: https://gitlab.com/renich/omni, mirrored at https://github.com/renich/omni and https://git.openlat.dev/renich/omni).

Your mission is to maintain the smallest, cleanest, self-contained reference file for each language standard edition that captures 100% of the language features (grammar, keywords, literals, types, qualifiers, attributes, directives) as an executable ground truth.

2. Non-Negotiable Architectural Invariants

  1. Single-File Self-Containment: Every language standard edition (e.g. c/c23.c, cpp/cpp23.cpp, zig/zig014.zig) must reside in exactly one self-contained source file. Auxiliary local headers or multi-file splits are strictly forbidden. Only standard library headers defined by the language specification are permitted.
  2. Pedantic Zero-Warning Compilation: All files must compile cleanly with zero warnings under maximum pedantic warning flags (e.g. -Wall -Wextra -pedantic -Werror for C/C++). Never disable warnings or introduce compiler suppression pragmas.
  3. 100% Lexical and Keyword Saturation: Every standard keyword, primitive type, operator, and standardized attribute must appear and be functionally or syntactically evaluated. Retained keywords (e.g. _Bool in C23) must be present.
  4. Git Object Format: The repository object database is strictly SHA-1 to ensure full GitHub mirror compatibility. Do not attempt to alter or upgrade the repository to SHA-256.
  5. Executable Ground Truth: The code must compile into a standalone binary that executes to completion and exits with code 0.

3. Mandatory Design Patterns

The Scalar State Accumulator Principle

Never use (void)x; or #pragma lines to suppress unused-variable warnings. All declared variables, qualifiers, and function returns must be mathematically consumed in a single unified state accumulator:

  • Prohibited: c int val = 42; (void)val; /* Dead suppression line */
  • Mandatory: c double checksum = (double)legacy_auto + fast_counter + val + s_char; if (checksum < 0.0) { return 1; }

Dual-Path Saturation Pattern

For optional language annexes or conditionally supported extensions (e.g. Annex G _Imaginary or Decimal Floating Point): - If the feature macro is defined, exercise it at runtime. - If unsupported by the compiler, keep declarations inside an #else (or #if 0) block so the tokens remain physically present for lexical saturation scanners without breaking compilation.

Bidirectional Security Anchors

Whenever code demonstrates historically hazardous, implementation-defined, or memory-unsafe features: 1. Annotate inline with: [!SECURITY-NOTE: SEC-<ID>]. 2. Ensure the ID is cataloged in the language directory's security.rst with architectural analysis, CWE mapping, and safe production alternatives.

4. Anti-Hallucination Guardrails

  • Standard Conformance Only: Do not use non-standard vendor extensions (e.g. GNU __attribute__, __builtin_*) unless explicitly standardized in the edition being showcased.
  • Inspect Before Asserting: The GNUmakefile uses parse-time toolchain detection (command -v). Never guess compiler capabilities; inspect the Makefile and verify on disk.
  • Format Preservation: Human-facing documentation (README.rst, docs/*.rst, c/*.rst) is strictly ReStructuredText (.rst), validated via rstcheck. Agent rule files (AGENTS.md, .agents/rules/*.md) are the only Markdown files permitted.

5. Verification Checkpoint

Before presenting any solution or finalizing edits, verify: 1. Did you consume all new variables in the scalar state accumulator? 2. Does make clean && make check pass cleanly across all detected compilers? 3. Does make check-docs report zero errors and zero warnings? 4. Did you preserve single-file self-containment?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Omni AI Agent Directive

> **Attention AI Agents**: You are operating in a highly-constrained, maximally-pedantic repository. Read this directive entirely before parsing, editing, or generating any code.

## 1. Operating Protocol and Mission

You are contributing to **omni** (canonical upstream: https://gitlab.com/renich/omni, mirrored at https://github.com/renich/omni and https://git.openlat.dev/renich/omni).

Your mission is to maintain the smallest, cleanest, self-contained reference file for each language standard edition that captures **100% of the language features** (grammar, keywords, literals, types, qualifiers, attributes, directives) as an executable ground truth.

## 2. Non-Negotiable Architectural Invariants

1. **Single-File Self-Containment**:
   Every language standard edition (e.g. `c/c23.c`, `cpp/cpp23.cpp`, `zig/zig014.zig`) must reside in exactly **one self-contained source file**. Auxiliary local headers or multi-file splits are strictly forbidden. Only standard library headers defined by the language specification are permitted.
2. **Pedantic Zero-Warning Compilation**:
   All files must compile cleanly with zero warnings under maximum pedantic warning flags (e.g. `-Wall -Wextra -pedantic -Werror` for C/C++). Never disable warnings or introduce compiler suppression pragmas.
3. **100% Lexical and Keyword Saturation**:
   Every standard keyword, primitive type, operator, and standardized attribute must appear and be functionally or syntactically evaluated. Retained keywords (e.g. `_Bool` in C23) must be present.
4. **Git Object Format**:
   The repository object database is strictly **SHA-1** to ensure full GitHub mirror compatibility. Do not attempt to alter or upgrade the repository to SHA-256.
5. **Executable Ground Truth**:
   The code must compile into a standalone binary that executes to completion and exits with code `0`.

## 3. Mandatory Design Patterns

### The Scalar State Accumulator Principle
**Never** use `(void)x;` or `#pragma` lines to suppress `unused-variable` warnings. All declared variables, qualifiers, and function returns must be mathematically consumed in a single unified state accumulator:

- **Prohibited**:
  ```c
  int val = 42;
  (void)val; /* Dead suppression line */
  ```
- **Mandatory**:
  ```c
  double checksum = (double)legacy_auto + fast_counter + val + s_char;
  if (checksum < 0.0) {
      return 1;
  }
  ```

### Dual-Path Saturation Pattern
For optional language annexes or conditionally supported extensions (e.g. Annex G `_Imaginary` or Decimal Floating Point):
- If the feature macro is defined, exercise it at runtime.
- If unsupported by the compiler, keep declarations inside an `#else` (or `#if 0`) block so the tokens remain physically present for lexical saturation scanners without breaking compilation.

### Bidirectional Security Anchors
Whenever code demonstrates historically hazardous, implementation-defined, or memory-unsafe features:
1. Annotate inline with: `[!SECURITY-NOTE: SEC-<ID>]`.
2. Ensure the ID is cataloged in the language directory's `security.rst` with architectural analysis, CWE mapping, and safe production alternatives.

## 4. Anti-Hallucination Guardrails

- **Standard Conformance Only**: Do not use non-standard vendor extensions (e.g. GNU `__attribute__`, `__builtin_*`) unless explicitly standardized in the edition being showcased.
- **Inspect Before Asserting**: The `GNUmakefile` uses parse-time toolchain detection (`command -v`). Never guess compiler capabilities; inspect the Makefile and verify on disk.
- **Format Preservation**: Human-facing documentation (`README.rst`, `docs/*.rst`, `c/*.rst`) is strictly ReStructuredText (`.rst`), validated via `rstcheck`. Agent rule files (`AGENTS.md`, `.agents/rules/*.md`) are the only Markdown files permitted.

## 5. Verification Checkpoint

Before presenting any solution or finalizing edits, verify:
1. Did you consume all new variables in the scalar state accumulator?
2. Does `make clean && make check` pass cleanly across all detected compilers?
3. Does `make check-docs` report zero errors and zero warnings?
4. Did you preserve single-file self-containment?
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Omni AI Agent Directive

> **Attention AI Agents**: You are operating in a highly-constrained, maximally-pedantic repository. Read this directive entirely before parsing, editing, or generating any code.

## 1. Operating Protocol and Mission

You are contributing to **omni** (canonical upstream: https://gitlab.com/renich/omni, mirrored at https://github.com/renich/omni and https://git.openlat.dev/renich/omni).

Your mission is to maintain the smallest, cleanest, self-contained reference file for each language standard edition that captures **100% of the language features** (grammar, keywords, literals, types, qualifiers, attributes, directives) as an executable ground truth.

## 2. Non-Negotiable Architectural Invariants

1. **Single-File Self-Containment**:
   Every language standard edition (e.g. `c/c23.c`, `cpp/cpp23.cpp`, `zig/zig014.zig`) must reside in exactly **one self-contained source file**. Auxiliary local headers or multi-file splits are strictly forbidden. Only standard library headers defined by the language specification are permitted.
2. **Pedantic Zero-Warning Compilation**:
   All files must compile cleanly with zero warnings under maximum pedantic warning flags (e.g. `-Wall -Wextra -pedantic -Werror` for C/C++). Never disable warnings or introduce compiler suppression pragmas.
3. **100% Lexical and Keyword Saturation**:
   Every standard keyword, primitive type, operator, and standardized attribute must appear and be functionally or syntactically evaluated. Retained keywords (e.g. `_Bool` in C23) must be present.
4. **Git Object Format**:
   The repository object database is strictly **SHA-1** to ensure full GitHub mirror compatibility. Do not attempt to alter or upgrade the repository to SHA-256.
5. **Executable Ground Truth**:
   The code must compile into a standalone binary that executes to completion and exits with code `0`.

## 3. Mandatory Design Patterns

### The Scalar State Accumulator Principle
**Never** use `(void)x;` or `#pragma` lines to suppress `unused-variable` warnings. All declared variables, qualifiers, and function returns must be mathematically consumed in a single unified state accumulator:

- **Prohibited**:
  ```c
  int val = 42;
  (void)val; /* Dead suppression line */
  ```
- **Mandatory**:
  ```c
  double checksum = (double)legacy_auto + fast_counter + val + s_char;
  if (checksum < 0.0) {
      return 1;
  }
  ```

### Dual-Path Saturation Pattern
For optional language annexes or conditionally supported extensions (e.g. Annex G `_Imaginary` or Decimal Floating Point):
- If the feature macro is defined, exercise it at runtime.
- If unsupported by the compiler, keep declarations inside an `#else` (or `#if 0`) block so the tokens remain physically present for lexical saturation scanners without breaking compilation.

### Bidirectional Security Anchors
Whenever code demonstrates historically hazardous, implementation-defined, or memory-unsafe features:
1. Annotate inline with: `[!SECURITY-NOTE: SEC-<ID>]`.
2. Ensure the ID is cataloged in the language directory's `security.rst` with architectural analysis, CWE mapping, and safe production alternatives.

## 4. Anti-Hallucination Guardrails

- **Standard Conformance Only**: Do not use non-standard vendor extensions (e.g. GNU `__attribute__`, `__builtin_*`) unless explicitly standardized in the edition being showcased.
- **Inspect Before Asserting**: The `GNUmakefile` uses parse-time toolchain detection (`command -v`). Never guess compiler capabilities; inspect the Makefile and verify on disk.
- **Format Preservation**: Human-facing documentation (`README.rst`, `docs/*.rst`, `c/*.rst`) is strictly ReStructuredText (`.rst`), validated via `rstcheck`. Agent rule files (`AGENTS.md`, `.agents/rules/*.md`) are the only Markdown files permitted.

## 5. Verification Checkpoint

Before presenting any solution or finalizing edits, verify:
1. Did you consume all new variables in the scalar state accumulator?
2. Does `make clean && make check` pass cleanly across all detected compilers?
3. Does `make check-docs` report zero errors and zero warnings?
4. Did you preserve single-file self-containment?
omni / horizon / C++ Roadmap Target

◇ C++ Target Specification

Multi-decade syntactic evolution spanning C++98, C++11, C++14, C++17, C++20, C++23, and upcoming C++26.

Standard Body ISO/IEC 14882
Target Compiler Flags -std=c++23 -Wall -Wextra -pedantic -Werror
Required Security Catalog c++/security.rst (Mandatory)

Planned Reference Files

  • cpp/cpp98.cpp
  • cpp/cpp11.cpp
  • cpp/cpp14.cpp
  • cpp/cpp17.cpp
  • cpp/cpp20.cpp
  • cpp/cpp23.cpp
  • cpp/security.rst
  • cpp/README.rst

Language Features to Saturate

  • Templates, concepts, constraints, and compile-time evaluation (constexpr, consteval)
  • Move semantics, smart pointers, RAII, and memory model
  • Coroutines, ranges, modules, and explicit object parameters (deducing this)
  • Required security.rst catalog for pointer arithmetic, reinterpret_cast, and lifetime hazards

Ready to Author the C++ Compendium?

Review the 6-phase engineering lifecycle in the and check out the .

omni / horizon / Zig Roadmap Target

◇ Zig Target Specification

No hidden control flow, compile-time metaprogramming (comptime), explicit memory allocators, and optimal binary sizing.

Standard Body Zig Software Foundation
Target Compiler Flags zig build-exe -O ReleaseSafe
Required Security Catalog zig/security.rst (Mandatory)

Planned Reference Files

  • zig/zig013.zig
  • zig/zig014.zig
  • zig/security.rst
  • zig/README.rst

Language Features to Saturate

  • Explicit allocators (std.mem.Allocator) and absence of global hidden heaps
  • comptime reflection, error unions (!T), and tagged unions
  • Struct-of-Arrays (std.MultiArrayList) and C ABI interoperability
  • Required security.rst catalog for @ptrCast, @alignCast, and unmanaged memory

Ready to Author the Zig Compendium?

Review the 6-phase engineering lifecycle in the and check out the .

omni / horizon / Crystal Roadmap Target

◇ Crystal Target Specification

Ruby-inspired elegance compiled down to native machine code via LLVM. Features static type inference, fibers, channels, and macro metaprogramming.

Standard Body Manas.tech / Crystal Language
Target Compiler Flags crystal build --release --warnings all
Required Security Catalog crystal/security.rst (Mandatory)

Planned Reference Files

  • crystal/crystal1.cr
  • crystal/security.rst
  • crystal/README.rst

Language Features to Saturate

  • Type unions and compile-time nil safety without runtime overhead
  • CSP-style concurrency with light fibers, channels, and execution contexts
  • Powerful compile-time AST macro expansion and native C library bindings (lib)
  • Required security.rst catalog for Pointer(T), LibC unsafe calls, and fiber race conditions

Ready to Author the Crystal Compendium?

Review the 6-phase engineering lifecycle in the and check out the .

omni / horizon / Go Roadmap Target

◇ Go Target Specification

Expressive simplicity, communicative concurrency with channels and goroutines, and first-class type parameters (generics).

Standard Body Google / Go Authors
Target Compiler Flags go build -race
Required Security Catalog go/security.rst (Mandatory)

Planned Reference Files

  • go/go122.go
  • go/security.rst
  • go/README.rst

Language Features to Saturate

  • Goroutines, channels, and select statement concurrency
  • Consumer-side interface contracts and type parameter generics
  • Structured error handling and context propagation (context.Context)
  • Required security.rst catalog for unsafe.Pointer and data race edge cases

Ready to Author the Go Compendium?

Review the 6-phase engineering lifecycle in the and check out the .

omni / horizon / Rust Roadmap Target

◇ Rust Target Specification

Fearless concurrency, zero-cost abstractions, and strict compile-time borrow checker preventing memory safety defects.

Standard Body Rust Foundation
Target Compiler Flags rustc --edition 2024 -D warnings
Required Security Catalog rust/security.rst (Mandatory)

Planned Reference Files

  • rust/rust2018.rs
  • rust/rust2021.rs
  • rust/rust2024.rs
  • rust/security.rst
  • rust/README.rst

Language Features to Saturate

  • Lifetimes, ownership, and borrow checking semantics
  • Pattern matching, algebraic data types (enums), and trait systems
  • Async/await and return position impl Trait in traits
  • Required security.rst catalog for unsafe blocks and raw pointer dereferencing

Ready to Author the Rust Compendium?

Review the 6-phase engineering lifecycle in the and check out the .

omni / horizon / Python Roadmap Target

◇ Python Target Specification

Rich syntactic grammar featuring structural pattern matching, comprehensive type annotations, and asynchronous coroutines.

Standard Body Python Software Foundation
Target Compiler Flags python3 -m py_compile
Required Security Catalog python/security.rst (Mandatory)

Planned Reference Files

  • python/py313.py
  • python/README.rst

Language Features to Saturate

  • Structural pattern matching (match / case) and union type operators (|)
  • Type parameter syntax (PEP 695) and exception groups
  • Async/await coroutines, comprehensions, and generators
  • Scalar state consumer executing all defined functions and expressions

Ready to Author the Python Compendium?

Review the 6-phase engineering lifecycle in the and check out the .

omni / horizon / Bash & POSIX Roadmap Target

◇ Bash & POSIX Target Specification

Pure POSIX shell standards alongside GNU Bash 5.x systems orchestration grammar.

Standard Body IEEE Std 1003.1 / Free Software Foundation
Target Compiler Flags bash -n
Required Security Catalog bash & posix/security.rst (Mandatory)

Planned Reference Files

  • bash/bash5.bash
  • sh/sh2024.sh
  • bash/README.rst

Language Features to Saturate

  • Associative arrays, parameter transformation, and arithmetic evaluation
  • Process substitutions, coprocesses, and safe execution headers (set -euo pipefail)
  • Strict POSIX compliance without non-standard extensions in sh/
  • Required security.rst catalog for word splitting, glob expansion, and eval hazards

Ready to Author the Bash & POSIX Compendium?

Review the 6-phase engineering lifecycle in the and check out the .

The Scalar State Accumulator

Rather than polluting code with dead (void)var; suppression casts, Omni mathematically consumes every declared scalar into a single state hash. This forces the optimizer and semantic analyzer to evaluate all symbols while compiling cleanly under -Wall -Wextra -Werror.

Dual-Path Saturation Pattern

For optional language annexes (such as Decimal Floating Point or Imaginary numbers), Omni employs an active preprocessor branch for supporting compilers and an inactive token-preserving fallback for conformant compilers without DFP runtimes. 100% lexical saturation is achieved without breaking builds.

Bidirectional Threat Modeling

When demonstrating historically hazardous or memory-unsafe constructs (VLAs, non-local jumps, unbounded buffer copies), code is tagged inline with [!SECURITY-NOTE: ID] linked directly to the language's security matrix detailing CWE identifiers and hardened production alternatives.