path
stringlengths
14
112
content
stringlengths
0
6.32M
size
int64
0
6.32M
max_lines
int64
1
100k
repo_name
stringclasses
2 values
autogenerated
bool
1 class
cosmopolitan/third_party/chibicc/as.main.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
1,974
26
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/file.c
#include "libc/intrin/bsf.h" #include "third_party/chibicc/chibicc.h" // Slurps contents of file. char *read_file(const char *path) { char *p; FILE *fp; int buflen, nread, end, n; if (!strcmp(path, "-")) { fp = stdin; } else { fp = fopen(path, "r"); if (!fp) return NULL; } buflen = 4096; nr...
4,880
177
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/chibicc.mk
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ #───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ # # SYNOPSIS # # C Compiler # # OVERVIEW # # This makefile compiles and runs each test twice. The first with # GCC...
4,092
123
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/kw.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
2,192
34
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/README.cosmo
chibicc is the simplest/tiniest/hackable/readable c11 compiler in the world that can build projects like python but goes 2x slower than gcc with 2x the code size, because it doesn't optimize or color registers although it can compile code at 5x the speed and could be even faster which is great, considering it's a 220kb...
2,085
50
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/kw.inc
/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf kw.gperf */ /* Computed positions: -k'1,4,11,14,17,$' */ // clang-format off #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) ...
16,035
436
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/chibicc.h
#ifndef COSMOPOLITAN_THIRD_PARTY_CHIBICC_CHIBICC_H_ #define COSMOPOLITAN_THIRD_PARTY_CHIBICC_CHIBICC_H_ #include "libc/assert.h" #include "libc/calls/calls.h" #include "libc/calls/struct/stat.h" #include "libc/calls/weirdtypes.h" #include "libc/errno.h" #include "libc/fmt/conv.h" #include "libc/fmt/fmt.h" #include "lib...
15,152
672
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/dox1.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
13,280
378
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/help.txt
SYNOPSIS chibicc.com [FLAGS] INPUTS DESCRIPTION chibicc - A Small GNU-Style ISO/IEC 9899:2011 Standard Compiler OVERVIEW chibicc is the simplest/tiniest/hackable/readable c11 compiler in the world that can compile code quickly and consistently across platforms FLAGS -o PATH Specifies path of out...
19,190
667
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/alloc.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
2,598
58
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/dox2.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
28,828
968
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/chibicc.c
#include "libc/calls/calls.h" #include "libc/calls/struct/sigaction.h" #include "libc/calls/struct/siginfo.h" #include "libc/calls/ucontext.h" #include "libc/mem/gc.internal.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/sig.h" #include "libc/x/xasprintf.h" #include "third_party/chibicc/chibicc.h" asm...
23,000
805
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/type.c
#include "libc/assert.h" #include "third_party/chibicc/chibicc.h" /* TODO(jart): Why can't these be const? */ Type ty_void[1] = {{TY_VOID, 1, 1}}; Type ty_bool[1] = {{TY_BOOL, 1, 1}}; Type ty_char[1] = {{TY_CHAR, 1, 1}}; Type ty_short[1] = {{TY_SHORT, 2, 2}}; Type ty_int[1] = {{TY_INT, 4, 4}}; Type ty_long[1] = {{TY_L...
8,746
311
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/strarray.c
#include "third_party/chibicc/chibicc.h" void strarray_push(StringArray *arr, char *s) { size_t i; if (!arr->data) { arr->data = calloc(8, sizeof(char *)); arr->capacity = 8; } if (arr->len + 1 == arr->capacity) { arr->capacity += arr->capacity >> 1; arr->data = realloc(arr->data, arr->capacity...
458
18
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/parse.c
// This file contains a recursive descent parser for C. // // Most functions in this file are named after the symbols they are // supposed to read from an input token list. For example, stmt() is // responsible for reading a statement from a token list. The function // then construct an AST node representing a statemen...
122,621
3,924
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/preprocess.c
// This file implements the C preprocessor. // // The preprocessor takes a list of tokens as an input and returns a // new list of tokens as an output. // // The preprocessing language is designed in such a way that that's // guaranteed to stop even if there is a recursive macro. // Informally speaking, a macro is appl...
39,157
1,420
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/printast.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
10,890
258
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/file.h
#ifndef COSMOPOLITAN_THIRD_PARTY_CHIBICC_FILE_H_ #define COSMOPOLITAN_THIRD_PARTY_CHIBICC_FILE_H_ #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ char *skip_bom(char *); char *read_file(const char *); void remove_backslash_newline(char *); void canonicalize_newline(char *); COSMOPOLITAN_C_END_ #endif /* !...
410
14
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/as.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
138,290
4,105
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/README.md
# chibicc: A Small C Compiler (The old master has moved to [historical/old](https://github.com/rui314/chibicc/tree/historical/old) branch. This is a new one uploaded in September 2020.) chibicc is yet another small C compiler that implements most C11 features. Even though it still probably falls into the "toy compile...
5,972
135
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/hashmap.c
// This is an implementation of the open-addressing hash table. #include "libc/nexgen32e/crc32.h" #include "third_party/chibicc/chibicc.h" #define INIT_SIZE 16 // initial hash bucket size #define LOW_WATERMARK 20 // keep usage below 50% after rehashing #define HIGH_WATERMARK 40 ...
3,712
128
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/cast.c
#include "third_party/chibicc/chibicc.h" #define REDZONE(X) \ "sub\t$16,%rsp\n" \ "\t" X "\n" \ "\tadd\t$16,%rsp" #define PUSHPOPRAX(X) \ "push\t%rax\n" \ "\t" X "\n" \ "\tpop\t%rax" #ifdef __SSE3__ #define FIST(X) REDZONE("fistt" X) #else #define FIST(X) \ REDZ...
7,553
181
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/kw.h
#ifndef COSMOPOLITAN_THIRD_PARTY_CHIBICC_KW_H_ #define COSMOPOLITAN_THIRD_PARTY_CHIBICC_KW_H_ #define KW_STRUCT 1 /* keyword typename */ #define KW_STATIC 2 /* keyword typename */ #define KW_VOID 3 /* keyword typename */ #define KW_CHAR ...
6,344
132
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/tokenize.c
#include "libc/intrin/bsf.h" #include "libc/log/log.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" #include "libc/str/tab.internal.h" #include "third_party/chibicc/chibicc.h" #include "third_party/chibicc/file.h" #include "third_party/chibicc/kw.h" // Input file static File *current_file; // A list of...
19,674
736
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/unicode.c
#include "third_party/chibicc/chibicc.h" // Encode a given character in UTF-8. int encode_utf8(char *buf, uint32_t c) { if (c <= 0x7F) { buf[0] = c; return 1; } if (c <= 0x7FF) { buf[0] = 0b11000000 | (c >> 6); buf[1] = 0b10000000 | (c & 0b00111111); return 2; } if (c <= 0xFFFF) { buf...
4,160
131
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/kw.gperf
%{ #include "libc/str/str.h" #include "third_party/chibicc/kw.h" %} %compare-strncmp %language=ANSI-C %readonly-tables %struct-type %define lookup-function-name LookupKw struct thatispacked KwSlot { char *name; unsigned char code; }; %% if, KW_IF struct, KW_STRUCT...
6,186
136
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/fpclassify.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
4,413
146
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/asm.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
23,035
762
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/control_test.c
#include "third_party/chibicc/test/test.h" /* * This is a block comment. */ int main() { ASSERT(3, ({ int x; if (0) x = 2; else x = 3; x; })); ASSERT(3, ({ int x; if (1 - 1) x = 2; else ...
9,978
543
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/generic_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(1, _Generic(100.0, double : 1, int * : 2, int : 3, float : 4)); ASSERT(2, _Generic((int *)0, double : 1, int * : 2, int : 3, float : 4)); ASSERT(2, _Generic((int[3]){}, double : 1, int * : 2, int : 3, float : 4)); ASSERT(3, _Generic(100, double : 1...
441
11
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/common.c
#include "third_party/chibicc/test/test.h" void Assert(long expected, long actual, char *code) { if (expected != actual) { fprintf(stderr, "%s => %ld expected but got %ld\n", code, expected, actual); exit(1); } } void Assert2(long expected, long actual, char *code, char *func, int line) { if (expected !...
3,304
196
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/string_test.c
#include "third_party/chibicc/test/test.h" int main() { typeof("str") StringInitParen1 = ("str"); char StringInitParen2[] = ("str"); ASSERT(0, ""[0]); ASSERT(1, sizeof("")); ASSERT(97, "abc"[0]); ASSERT(98, "abc"[1]); ASSERT(99, "abc"[2]); ASSERT(0, "abc"[3]); ASSERT(4, sizeof("abc")); ASSERT(7,...
2,371
109
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/arith_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(0, 0); ASSERT(42, 42); ASSERT(21, 5 + 20 - 4); ASSERT(41, 12 + 34 - 5); ASSERT(47, 5 + 6 * 7); ASSERT(15, 5 * (9 - 6)); ASSERT(4, (3 + 5) / 2); ASSERT(10, -10 + 20); ASSERT(0, 0 == 1); ASSERT(1, 42 == 42); ASSERT(1, 0 != 1); ASSERT...
6,301
342
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/include2.h
int include2 = 7;
18
2
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/const_test.c
#include "third_party/chibicc/test/test.h" int main() { { const x; } { int const x; } { const int x; } { const int const const x; } ASSERT(5, ({ const x = 5; x; })); ASSERT(8, ({ const x = 8; int *const y = &x; *y; })); ASSERT(6, ({...
406
24
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/msabi_test.c
#include "third_party/chibicc/test/test.h" int (*__attribute__((__ms_abi__)) NtFoo)(int x, int y); int main() { }
116
7
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/union_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(8, ({ union { int a; char b[6]; } x; sizeof(x); })); ASSERT(3, ({ union { int a; char b[4]; } x; x.a = 515; x.b[0]...
2,475
133
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/offsetof_test.c
#include "third_party/chibicc/test/test.h" typedef struct { int a; char b; int c; double d; } T; int main() { ASSERT(0, offsetof(T, a)); ASSERT(4, offsetof(T, b)); ASSERT(8, offsetof(T, c)); ASSERT(16, offsetof(T, d)); return 0; }
252
18
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/struct_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(1, ({ struct { int a; int b; } x; x.a = 1; x.b = 2; x.a; })); ASSERT(2, ({ struct { int a; int b; } x; ...
7,704
416
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/include1.h
#include "third_party/chibicc/test/include2.h" char *include1_filename = __FILE__; int include1_line = __LINE__; int include1 = 5;
132
6
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/compat_test.c
#include "third_party/chibicc/test/test.h" _Noreturn noreturn_fn(int restrict x) { exit(0); } void funcy_type(int arg[restrict static 3]) { } int main() { { volatile x; } { int volatile x; } { volatile int x; } { volatile int volatile volatile x; } { int volatile *volatile volatile x; } { auto **restri...
382
19
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/attribute_test.c
#include "third_party/chibicc/test/test.h" void doge() __attribute__((__nonnull__)); void cate(char *) __attribute__((__nonnull__(1))); int var __attribute__((__section__(".data.var"))); int ar[4] __attribute__((__section__(".data.var"))); typedef int int2[2] __attribute__((__aligned__(64))); typedef int int4[4] __att...
4,529
177
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/extern_test.c
#include "third_party/chibicc/test/test.h" extern int ext1; extern int *ext2; inline int inline_fn(void) { return 3; } int main() { ASSERT(5, ext1); ASSERT(5, *ext2); extern int ext3; ASSERT(7, ext3); int ext_fn1(int x); ASSERT(5, ext_fn1(5)); extern int ext_fn2(int x); ASSERT(8, ext_fn2(8)); ...
333
25
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/variable_test.c
#include "third_party/chibicc/test/test.h" int g1, g2[4]; static int g3 = 3; int main() { ASSERT(3, ({ int a; a = 3; a; })); ASSERT(3, ({ int a = 3; a; })); ASSERT(8, ({ int a = 3; int z = 5; a + z; ...
4,244
245
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/enum_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(0, ({ enum { zero, one, two }; zero; })); ASSERT(1, ({ enum { zero, one, two }; one; })); ASSERT(2, ({ enum { zero, one, two }; two; })); ASSERT(5, ({ ...
1,086
51
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/cast_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(131585, (int)8590066177); ASSERT(513, (short)8590066177); ASSERT(1, (char)8590066177); ASSERT(1, (long)1); ASSERT(0, (long)&*(int *)0); ASSERT(513, ({ int x = 512; *(char *)&x = 1; x; })); ASSERT(5, (...
1,910
81
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/test.h
#include "libc/fmt/fmt.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" STATIC_YOINK("sys_mmap"); /* asan needs it */ STATIC_YOINK("TrackMemoryInterval"); /* asan needs it */ #define ASSERT(x, y) Assert2(x, y, #y, __FILE__, __LINE__) #define ASSERT128(x, y) As...
496
15
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/dce_test.c
#include "third_party/chibicc/test/test.h" #define CRASH \ ({ \ asm(".err"); \ 666; \ }) int main(void) { if (0) { return CRASH; } if (1) { } else { return CRASH; } ASSERT(777, 777 ?: CRASH); ASSERT(777, 1 ? 777 : CRASH); ASSERT(777, 0 ? CRASH : 777); AS...
522
27
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/spinlock_test.c
#include "third_party/chibicc/test/test.h" #define SPINLOCK(lock) \ do { \ for (;;) { \ typeof(*(lock)) x; \ __atomic_load(lock, &x, __ATOMIC_RELAXED); ...
2,364
81
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/initializer_test.c
#include "third_party/chibicc/test/test.h" char g3 = 3; short g4 = 4; int g5 = 5; long g6 = 6; int g9[3] = {0, 1, 2}; struct { char a; int b; } g11[2] = {{1, 2}, {3, 4}}; struct { int a[2]; } g12[2] = {{{1, 2}}}; union { int a; char b[8]; } g13[2] = {0x01020304, 0x05060708}; char g17[] = "foobar"; char g18[1...
16,331
803
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/macro_test.c
#include "third_party/chibicc/test/include1.h" #include "third_party/chibicc/test/test.h" /* clang-format off */ char *main_filename1 = __FILE__; int main_line1 = __LINE__; #define LINE() __LINE__ int main_line2 = LINE(); #define add2 add2 #define add6(a, b, c, d, e, f) add6(a, b, c, d, e, f) # /* */ # int ret3(void...
6,540
417
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/sizeof_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(1, sizeof(char)); ASSERT(2, sizeof(short)); ASSERT(2, sizeof(short int)); ASSERT(2, sizeof(int short)); ASSERT(4, sizeof(int)); ASSERT(8, sizeof(long)); ASSERT(8, sizeof(long int)); ASSERT(8, sizeof(long int)); ASSERT(8, sizeof(char *)); ...
3,057
118
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/literal_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(97, 'a'); ASSERT(10, '\n'); ASSERT(-128, '\x80'); ASSERT(511, 0777); ASSERT(0, 0x0); ASSERT(10, 0xa); ASSERT(10, 0XA); ASSERT(48879, 0xbeef); ASSERT(48879, 0xBEEF); ASSERT(48879, 0XBEEF); ASSERT(0, 0b0); ASSERT(1, 0b1); ASSERT(47...
2,567
109
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/typeof_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(3, ({ typeof(int) x = 3; x; })); ASSERT(3, ({ typeof(1) x = 3; x; })); ASSERT(4, ({ int x; typeof(x) y; sizeof(y); })); ASSERT(8, ({ ...
662
36
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/bitfield_test.c
#include "third_party/chibicc/test/test.h" #define TYPE_SIGNED(type) (((type)-1) < 0) struct { char a; int b : 5; int c : 10; } g45 = {1, 2, 3}, g46 = {}; int main() { /* NOTE: Consistent w/ GCC (but MSVC would fail this) */ ASSERT(1, 2 == ({ struct { enum { a, b, c } e : 2; ...
2,814
152
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/include3.h
#define foo 3
14
2
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/complit_test.c
#include "third_party/chibicc/test/test.h" typedef struct Tree { int val; struct Tree *lhs; struct Tree *rhs; } Tree; Tree *tree = &(Tree){1, &(Tree){2, &(Tree){3, 0, 0}, &(Tree){4, 0, 0}}, 0}; int main() { ASSERT(1, (int){1}); ASSERT(2, ((int[]){0, 1, 2})[2]); ASSERT('a', ((struct { char...
621
32
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/include4.h
#define foo 4
14
2
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/builtin_test.c
#include "libc/math.h" #include "third_party/chibicc/test/test.h" #define FPNAN 0 #define FPINFINITE 1 #define FPZERO 2 #define FPSUBNORMAL 3 #define FPNORMAL 4 #define FPCLASSIFY(x) \ __builtin_fpclassify(FPNAN, FPINFINITE, FPNORMAL, FPSUBNORMAL, FPZERO, x) #define conceal(x) \ ({ ...
12,844
447
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/pragma-once_test.c
#include "third_party/chibicc/test/test.h" #pragma once #include "third_party/chibicc/test/pragma-once_test.c" int main() { return 0; }
141
10
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/atomic_test.c
#include "third_party/chibicc/test/test.h" _Atomic(int) lock; main() { int x; ASSERT(0, __atomic_exchange_n(&lock, 1, __ATOMIC_SEQ_CST)); __atomic_load(&lock, &x, __ATOMIC_SEQ_CST); ASSERT(1, x); ASSERT(1, __atomic_exchange_n(&lock, 2, __ATOMIC_SEQ_CST)); ASSERT(2, __atomic_exchange_n(&lock, 3, __ATOMIC_...
1,616
55
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/usualconv_test.c
#include "third_party/chibicc/test/test.h" static int ret10(void) { return 10; } int main() { ASSERT((long)-5, -10 + (long)5); ASSERT((long)-15, -10 - (long)5); ASSERT((long)-50, -10 * (long)5); ASSERT((long)-2, -10 / (long)5); ASSERT(1, -2 < (long)-1); ASSERT(1, -2 <= (long)-1); ASSERT(0, -2 > (long...
1,123
59
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/constexpr_test.c
#include "third_party/chibicc/test/test.h" float g40 = 1.5; double g41 = 0.0 ? 55 : (0, 1 + 1 * 5.0 / 2 * (double)2 * (int)2.0); int main(int argc, char *argv[]) { ASSERT(10, ({ enum { ten = 1 + 2 + 3 + 4 }; ten; })); ASSERT(1, ({ int i = 0; switch (3) { ...
3,812
180
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/assert_test.c
#include "third_party/chibicc/test/test.h" _Static_assert(1); _Static_assert(1, "hey"); main() { _Static_assert(sizeof(int) == 4, "wut"); }
144
9
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/vector_test.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
3,353
73
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/vla_test.c
#include "libc/macros.internal.h" #include "third_party/chibicc/test/test.h" int index1d(int xn, int p[xn], int x) { return p[x]; } int index2d(int yn, int xn, int (*p)[yn][xn], int y, int x) { return (*p)[y][x]; } int main() { ASSERT(30, ({ int a[5] = {00, 10, 20, 30, 40, 50}; index1d(5...
2,422
116
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/unicode_test.c
#include "third_party/chibicc/test/test.h" /* TODO(jart): shl overflow in read_escaped_char */ #define STR(x) #x typedef unsigned short char16_t; typedef unsigned int char32_t; typedef int wchar_t; int π = 3; int main() { ASSERT(4, sizeof(L'\0')); ASSERT(97, L'a'); ASSERT(0, strcmp("αβγ", "\u03B1\u03B2\...
3,374
139
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/alignof_test.c
#include "third_party/chibicc/test/test.h" # int _Alignas(512) g1; int _Alignas(512) g2; char g3; int g4; long g5; char g6; int main() { ASSERT(1, _Alignof(char)); ASSERT(2, _Alignof(short)); ASSERT(4, _Alignof(int)); ASSERT(8, _Alignof(long)); ASSERT(8, _Alignof(long long)); ASSERT(1, _Alignof(char[3]));...
2,109
105
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/pointer_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(3, ({ int x = 3; *&x; })); ASSERT(3, ({ int x = 3; int *y = &x; int **z = &y; **z; })); ASSERT(5, ({ int x = 3; int y = 5; *(&x + 1);...
3,764
203
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/function_test.c
#include "third_party/chibicc/test/test.h" int ret3(void) { return 3; return 5; } int add2(int x, int y) { return x + y; } int sub2(int x, int y) { return x - y; } int add6(int a, int b, int c, int d, int e, int f) { return a + b + c + d + e + f; } int addx(int *x, int y) { return *x + y; } int sub_ch...
10,876
517
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/alloca_test.c
#include "libc/mem/alloca.h" #include "third_party/chibicc/test/test.h" void *fn(int x, void *p, int y) { return p; } int main() { int i = 0; char *p1 = alloca(16); char *p2 = alloca(16); char *p3 = 1 + (char *)alloca(3) + 1; p3 -= 2; char *p4 = fn(1, __builtin_alloca(16), 3); ASSERT(16, p1 - p2); ...
615
31
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/decl_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(1, ({ char x; sizeof(x); })); ASSERT(2, ({ short int x; sizeof(x); })); ASSERT(2, ({ int short x; sizeof(x); })); ASSERT(4, ({ int x; ...
864
52
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/test.mk
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ #───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ # # SYNOPSIS # # C Compiler Unit Tests # # OVERVIEW # # This makefile compiles and runs each test twice. The first w...
2,815
86
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/int128_test.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
213,489
8,222
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/varargs_test.c
#include "third_party/chibicc/test/test.h" int sum1(int x, ...) { va_list ap; va_start(ap, x); for (;;) { int y = va_arg(ap, int); if (y == 0) return x; x += y; } } int sum2(int x, ...) { va_list ap; va_start(ap, x); for (;;) { double y = va_arg(ap, double); x += y; int z = va...
997
53
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/asm_test.c
asm(".ident\t\"hello\""); /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════...
5,066
161
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/line_test.c
#include "third_party/chibicc/test/test.h" int main() { #line 500 "foo" ASSERT(501, __LINE__); ASSERT(0, strcmp(__FILE__, "foo")); #line 800 "bar" ASSERT(801, __LINE__); ASSERT(0, strcmp(__FILE__, "bar")); #line 1 ASSERT(2, __LINE__); # 200 "xyz" 2 3 ASSERT(201, __LINE__); ASSERT(0, strcmp(__FILE__, "...
343
21
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/tls_test.c.todo
#include "third_party/chibicc/test/test.h" _Thread_local int x; void add(void) { x += 3; } _Noreturn int test(void) { x = 7; add(); ASSERT(10, x); exit(0); } int main(void) { test(); }
201
19
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/typedef_test.c
#include "third_party/chibicc/test/test.h" typedef int MyInt, MyInt2[4]; typedef int; int main() { ASSERT(1, ({ typedef int t; t x = 1; x; })); ASSERT(1, ({ typedef struct { int a; } t; t x; x.a = 1; x.a;...
843
50
jart/cosmopolitan
false
cosmopolitan/third_party/chibicc/test/float_test.c
#include "third_party/chibicc/test/test.h" int main() { ASSERT(35, (float)(char)35); ASSERT(35, (float)(short)35); ASSERT(35, (float)(int)35); ASSERT(35, (float)(long)35); ASSERT(35, (float)(unsigned char)35); ASSERT(35, (float)(unsigned short)35); ASSERT(35, (float)(unsigned int)35); ASSERT(35, (float...
2,297
93
jart/cosmopolitan
false
cosmopolitan/third_party/awk/LICENSE
/**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copi...
1,161
24
jart/cosmopolitan
false
cosmopolitan/third_party/awk/lex.c
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
15,076
609
jart/cosmopolitan
false
cosmopolitan/third_party/awk/lib.c
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
22,140
847
jart/cosmopolitan
false
cosmopolitan/third_party/awk/proctab.c
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
6,941
240
jart/cosmopolitan
false
cosmopolitan/third_party/awk/README.cosmo
DESCRIPTION The One True Awk This is the version of awk described in The AWK Programming Language, by Al Aho, Brian Kernighan, and Peter Weinberger (Addison-Wesley, 1988, ISBN 0-201-07981-X). SOURCE https://github.com/onetrueawk/awk commit b92d8cecd132ce8e02a373e28dd42e6be34d3d59 Author: ozan yigit <...
421
18
jart/cosmopolitan
false
cosmopolitan/third_party/awk/README
AWK(1) General Commands Manual AWK(1) 𝐍𝐀𝐌𝐄 awk - pattern-directed scanning and processing language 𝐒𝐘𝐍𝐎𝐏𝐒𝐈𝐒 𝗮𝘄𝗸 [ -𝐅 f̲s̲ ] [ -𝘃 v̲a̲r̲=̲v̲a̲l̲u̲e̲ ] [ '̲p̲r̲o̲g̲'̲ | -𝗳 p̲r̲o̲g̲f̲i̲...
16,524
275
jart/cosmopolitan
false
cosmopolitan/third_party/awk/awk.mk
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ #───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ PKGS += THIRD_PARTY_AWK THIRD_PARTY_AWK_ARTIFACTS += THIRD_PARTY_AWK_A THIRD_PARTY_AWK = $(THIRD_PARTY_AWK_A_DEPS) $(T...
2,048
67
jart/cosmopolitan
false
cosmopolitan/third_party/awk/main.c
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
9,295
272
jart/cosmopolitan
false
cosmopolitan/third_party/awk/run.c
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
50,184
2,126
jart/cosmopolitan
false
cosmopolitan/third_party/awk/awk.1
.de EX .nf .ft CW .. .de EE .br .fi .ft 1 .. .de TF .IP "" "\w'\fB\\$1\ \ \fP'u" .PD 0 .. .TH AWK 1 .CT 1 files prog_other .SH NAME awk \- pattern-directed scanning and processing language .SH SYNOPSIS .B awk [ .BI \-F .I fs ] [ .BI \-v .I var=value ] [ .I 'prog' | .BI \-f .I progfile ] [ .I file ... ] .SH DESCRIPTION ...
12,680
633
jart/cosmopolitan
false
cosmopolitan/third_party/awk/maketab.c
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
7,623
203
jart/cosmopolitan
false
cosmopolitan/third_party/awk/awkgram.tab.c
// clang-format off #include "libc/mem/mem.h" #include "libc/str/str.h" #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 #define YYLEX yylex() #define YYEMPTY -1 #define yyclearin (yychar=(YYEMPTY)) #define yyerrok (yyerrflag=0) #define YYRECOVERING() (yyerrflag!=0) #define YYPREFIX "yy" #line 26 "awkgram.y" #incl...
158,127
3,378
jart/cosmopolitan
false
cosmopolitan/third_party/awk/tran.c
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
18,760
650
jart/cosmopolitan
false
cosmopolitan/third_party/awk/awkgram.y
/**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copi...
14,253
498
jart/cosmopolitan
false
cosmopolitan/third_party/awk/reflow.awk
# fmt - format # input: text # output: text formatted into lines of <= 72 characters BEGIN { maxlen = 72 } /^[ \t]/ { printline(); print; next } # verbatim ###/^ +/ { printline(); } # whitespace == break /./ { for (i = 1; i <= NF; i++) addword($i); next } /^$/ { printline(); print "" } END ...
797
34
jart/cosmopolitan
false
cosmopolitan/third_party/awk/parse.c
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
6,670
280
jart/cosmopolitan
false
cosmopolitan/third_party/awk/cmd.h
#ifndef COSMOPOLITAN_THIRD_PARTY_AWK_CMD_H_ #define COSMOPOLITAN_THIRD_PARTY_AWK_CMD_H_ #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ int _awk(int, char *[]); COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* COSMOPOLITAN_THIRD_PARTY_AWK_CMD_H_ */
291
11
jart/cosmopolitan
false
cosmopolitan/third_party/awk/b.c
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
32,988
1,320
jart/cosmopolitan
false
cosmopolitan/third_party/awk/cmd.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
1,991
26
jart/cosmopolitan
false
cosmopolitan/third_party/awk/awk.h
#ifndef COSMOPOLITAN_THIRD_PARTY_AWK_AWK_H_ #define COSMOPOLITAN_THIRD_PARTY_AWK_AWK_H_ #include "libc/assert.h" #include "libc/limits.h" #include "libc/literal.h" #include "libc/stdio/stdio.h" #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ /* clang-format off */ typedef double Awkfloat; /* unsigned char...
12,441
417
jart/cosmopolitan
false