mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-15 15:20:02 +00:00
Pay off more technical debt
This makes breaking changes to add underscores to many non-standard function names provided by the c library. MODE=tiny is now tinier and we now use smaller locks that are better for tiny apps in this mode. Some headers have been renamed to be in the same folder as the build package, so it'll be easier to know which build dependency is needed. Certain old misguided interfaces have been removed. Intel intrinsics headers are now listed in libc/isystem (but not in the amalgamation) to help further improve open source compatibility. Header complexity has also been reduced. Lastly, more shell scripts are now available.
This commit is contained in:
parent
b69f3d2488
commit
6f7d0cb1c3
960 changed files with 4072 additions and 4873 deletions
23
third_party/chibicc/as.c
vendored
23
third_party/chibicc/as.c
vendored
|
@ -16,17 +16,17 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/popcnt.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/elf/def.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/bsr.h"
|
||||
#include "libc/intrin/popcnt.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/bsr.h"
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
@ -34,6 +34,7 @@
|
|||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/chibicc/file.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
#include "tool/build/lib/elfwriter.h"
|
||||
|
@ -479,11 +480,11 @@ static void ReadFlags(struct As *a, int argc, char *argv[]) {
|
|||
for (i = 1; i < argc; ++i) {
|
||||
if (!strcmp(argv[i], "-o")) {
|
||||
a->outpath = StrDup(a, argv[++i]);
|
||||
} else if (startswith(argv[i], "-o")) {
|
||||
} else if (_startswith(argv[i], "-o")) {
|
||||
a->outpath = StrDup(a, argv[i] + 2);
|
||||
} else if (!strcmp(argv[i], "-I")) {
|
||||
SaveString(&a->incpaths, strdup(argv[++i]));
|
||||
} else if (startswith(argv[i], "-I")) {
|
||||
} else if (_startswith(argv[i], "-I")) {
|
||||
SaveString(&a->incpaths, strdup(argv[i] + 2));
|
||||
} else if (!strcmp(argv[i], "-Z")) {
|
||||
a->inhibiterr = true;
|
||||
|
@ -1667,13 +1668,13 @@ static int GrabSection(struct As *a, int name, int flags, int type, int group,
|
|||
static void OnSection(struct As *a, struct Slice s) {
|
||||
int name, flags, type, group = -1, comdat = -1;
|
||||
name = SliceDup(a, GetSlice(a));
|
||||
if (startswith(a->strings.p[name], ".text")) {
|
||||
if (_startswith(a->strings.p[name], ".text")) {
|
||||
flags = SHF_ALLOC | SHF_EXECINSTR;
|
||||
type = SHT_PROGBITS;
|
||||
} else if (startswith(a->strings.p[name], ".data")) {
|
||||
} else if (_startswith(a->strings.p[name], ".data")) {
|
||||
flags = SHF_ALLOC | SHF_WRITE;
|
||||
type = SHT_PROGBITS;
|
||||
} else if (startswith(a->strings.p[name], ".bss")) {
|
||||
} else if (_startswith(a->strings.p[name], ".bss")) {
|
||||
flags = SHF_ALLOC | SHF_WRITE;
|
||||
type = SHT_NOBITS;
|
||||
} else {
|
||||
|
@ -2025,7 +2026,7 @@ static int ParseModrm(struct As *a, int *disp) {
|
|||
if (((reg & 070) >> 3) == 2) modrm |= HASASZ; // asz
|
||||
if (IsComma(a)) {
|
||||
++a->i;
|
||||
modrm |= (bsr(GetInt(a)) & 3) << 6;
|
||||
modrm |= (_bsr(GetInt(a)) & 3) << 6;
|
||||
}
|
||||
}
|
||||
ConsumePunct(a, ')');
|
||||
|
@ -2607,8 +2608,8 @@ static bool HasXmmOnLine(struct As *a) {
|
|||
int i;
|
||||
for (i = 0; !IsPunct(a, a->i + i, ';'); ++i) {
|
||||
if (IsSlice(a, a->i + i) && a->slices.p[a->things.p[a->i + i].i].n >= 4 &&
|
||||
(startswith(a->slices.p[a->things.p[a->i + i].i].p, "xmm") ||
|
||||
startswith(a->slices.p[a->things.p[a->i + i].i].p, "%xmm"))) {
|
||||
(_startswith(a->slices.p[a->things.p[a->i + i].i].p, "xmm") ||
|
||||
_startswith(a->slices.p[a->things.p[a->i + i].i].p, "%xmm"))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
20
third_party/chibicc/asm.c
vendored
20
third_party/chibicc/asm.c
vendored
|
@ -16,6 +16,8 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/bsf.h"
|
||||
#include "libc/intrin/bsr.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
|
||||
#define PRECIOUS 0b1111000000101000 // bx,bp,r12-r15
|
||||
|
@ -299,7 +301,7 @@ static void PickAsmRegisters(Asm *a) {
|
|||
if (!(m = a->ops[i].regmask)) break;
|
||||
if (popcnt(m) != j) break;
|
||||
if (!(m &= regset)) CouldNotAllocateRegister(&a->ops[i], "rm");
|
||||
pick = 1 << (a->ops[i].reg = bsf(m));
|
||||
pick = 1 << (a->ops[i].reg = _bsf(m));
|
||||
if (pick & PRECIOUS) a->regclob |= pick;
|
||||
regset &= ~pick;
|
||||
a->ops[i].regmask = 0;
|
||||
|
@ -307,14 +309,14 @@ static void PickAsmRegisters(Asm *a) {
|
|||
case kAsmXmm:
|
||||
if (!(m = a->ops[i].regmask)) break;
|
||||
if (!(m &= xmmset)) CouldNotAllocateRegister(&a->ops[i], "xmm");
|
||||
xmmset &= ~(1 << (a->ops[i].reg = bsf(m)));
|
||||
xmmset &= ~(1 << (a->ops[i].reg = _bsf(m)));
|
||||
a->ops[i].regmask = 0;
|
||||
break;
|
||||
case kAsmFpu:
|
||||
if (!(m = a->ops[i].x87mask)) break;
|
||||
if (popcnt(m) != j) break;
|
||||
if (!(m &= x87sts)) CouldNotAllocateRegister(&a->ops[i], "fpu");
|
||||
x87sts &= ~(1 << (a->ops[i].reg = bsf(m)));
|
||||
x87sts &= ~(1 << (a->ops[i].reg = _bsf(m)));
|
||||
a->ops[i].x87mask = 0;
|
||||
break;
|
||||
default:
|
||||
|
@ -368,7 +370,7 @@ static Token *ParseAsmClobbers(Asm *a, Token *tok) {
|
|||
a->flagclob = true;
|
||||
} else if ((i = GetIndexOfRegisterName(s)) != -1) {
|
||||
a->regclob |= 1 << i;
|
||||
} else if (startswith(s, "xmm") && isdigit(s[3]) &&
|
||||
} else if (_startswith(s, "xmm") && isdigit(s[3]) &&
|
||||
(!s[4] || isdigit(s[4]))) {
|
||||
i = s[3] - '0';
|
||||
if (s[4]) {
|
||||
|
@ -379,7 +381,7 @@ static Token *ParseAsmClobbers(Asm *a, Token *tok) {
|
|||
a->xmmclob |= 1 << i;
|
||||
} else if (!strcmp(s, "st")) {
|
||||
a->x87clob |= 1;
|
||||
} else if (startswith(s, "st(") && isdigit(s[3]) && s[4] == ')') {
|
||||
} else if (_startswith(s, "st(") && isdigit(s[3]) && s[4] == ')') {
|
||||
i = s[3] - '0';
|
||||
i &= 7;
|
||||
a->x87clob |= 1 << i;
|
||||
|
@ -538,7 +540,7 @@ static char *HandleAsmSpecifier(Asm *a, char *p) {
|
|||
if ((i = c - '0') >= a->n) {
|
||||
error_tok(a->tok, "bad asm reference at offset %d", p - a->str);
|
||||
}
|
||||
z = bsr(a->ops[i].node->ty->size);
|
||||
z = _bsr(a->ops[i].node->ty->size);
|
||||
if (z > 3 && a->ops[i].type == kAsmReg) {
|
||||
error_tok(a->tok, "bad asm op size");
|
||||
}
|
||||
|
@ -677,7 +679,7 @@ static void StoreAsmOutputs(Asm *a) {
|
|||
println("\tset%s\t(%%rax)", a->ops[i].str + a->ops[i].predicate);
|
||||
break;
|
||||
case kAsmReg:
|
||||
z = bsr(a->ops[i].node->ty->size);
|
||||
z = _bsr(a->ops[i].node->ty->size);
|
||||
if (a->ops[i].reg) {
|
||||
gen_addr(a->ops[i].node);
|
||||
if (z > 3) error_tok(a->tok, "bad asm out size");
|
||||
|
@ -732,7 +734,7 @@ static void StoreAsmOutputs(Asm *a) {
|
|||
static void PushClobbers(Asm *a) {
|
||||
int i, regs = a->regclob & PRECIOUS;
|
||||
while (regs) {
|
||||
i = bsf(regs);
|
||||
i = _bsf(regs);
|
||||
pushreg(kGreg[3][i]);
|
||||
regs &= ~(1 << i);
|
||||
}
|
||||
|
@ -741,7 +743,7 @@ static void PushClobbers(Asm *a) {
|
|||
static void PopClobbers(Asm *a) {
|
||||
int i, regs = a->regclob & PRECIOUS;
|
||||
while (regs) {
|
||||
i = bsr(regs);
|
||||
i = _bsr(regs);
|
||||
popreg(kGreg[3][i]);
|
||||
regs &= ~(1 << i);
|
||||
}
|
||||
|
|
32
third_party/chibicc/chibicc.c
vendored
32
third_party/chibicc/chibicc.c
vendored
|
@ -1,9 +1,11 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/sigaction.h"
|
||||
#include "libc/calls/struct/siginfo.h"
|
||||
#include "libc/calls/ucontext.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
|
||||
asm(".ident\t\"\\n\\n\
|
||||
|
@ -215,7 +217,7 @@ static void parse_args(int argc, char **argv) {
|
|||
atexit(PrintMemoryUsage);
|
||||
} else if (!strcmp(argv[i], "-o")) {
|
||||
opt_o = argv[++i];
|
||||
} else if (startswith(argv[i], "-o")) {
|
||||
} else if (_startswith(argv[i], "-o")) {
|
||||
opt_o = argv[i] + 2;
|
||||
} else if (!strcmp(argv[i], "-S")) {
|
||||
opt_S = true;
|
||||
|
@ -239,19 +241,19 @@ static void parse_args(int argc, char **argv) {
|
|||
opt_P = true;
|
||||
} else if (!strcmp(argv[i], "-I")) {
|
||||
strarray_push(&include_paths, argv[++i]);
|
||||
} else if (startswith(argv[i], "-I")) {
|
||||
} else if (_startswith(argv[i], "-I")) {
|
||||
strarray_push(&include_paths, argv[i] + 2);
|
||||
} else if (!strcmp(argv[i], "-iquote")) {
|
||||
strarray_push(&include_paths, argv[++i]);
|
||||
} else if (startswith(argv[i], "-iquote")) {
|
||||
} else if (_startswith(argv[i], "-iquote")) {
|
||||
strarray_push(&include_paths, argv[i] + strlen("-iquote"));
|
||||
} else if (!strcmp(argv[i], "-isystem")) {
|
||||
strarray_push(&include_paths, argv[++i]);
|
||||
} else if (startswith(argv[i], "-isystem")) {
|
||||
} else if (_startswith(argv[i], "-isystem")) {
|
||||
strarray_push(&include_paths, argv[i] + strlen("-isystem"));
|
||||
} else if (!strcmp(argv[i], "-D")) {
|
||||
define(argv[++i]);
|
||||
} else if (startswith(argv[i], "-D")) {
|
||||
} else if (_startswith(argv[i], "-D")) {
|
||||
define(argv[i] + 2);
|
||||
} else if (!strcmp(argv[i], "-U")) {
|
||||
undef_macro(argv[++i]);
|
||||
|
@ -263,9 +265,9 @@ static void parse_args(int argc, char **argv) {
|
|||
opt_x = parse_opt_x(argv[++i]);
|
||||
} else if (!strncmp(argv[i], "-x", 2)) {
|
||||
opt_x = parse_opt_x(argv[i] + 2);
|
||||
} else if (startswith(argv[i], "-Wa")) {
|
||||
} else if (_startswith(argv[i], "-Wa")) {
|
||||
strarray_push_comma(&as_extra_args, argv[i] + 3);
|
||||
} else if (startswith(argv[i], "-Wl")) {
|
||||
} else if (_startswith(argv[i], "-Wl")) {
|
||||
strarray_push_comma(&ld_extra_args, argv[i] + 3);
|
||||
} else if (!strcmp(argv[i], "-Xassembler")) {
|
||||
strarray_push(&as_extra_args, argv[++i]);
|
||||
|
@ -333,7 +335,7 @@ static void parse_args(int argc, char **argv) {
|
|||
} else if (!strcmp(argv[i], "-L")) {
|
||||
strarray_push(&ld_extra_args, "-L");
|
||||
strarray_push(&ld_extra_args, argv[++i]);
|
||||
} else if (startswith(argv[i], "-L")) {
|
||||
} else if (_startswith(argv[i], "-L")) {
|
||||
strarray_push(&ld_extra_args, "-L");
|
||||
strarray_push(&ld_extra_args, argv[i] + 2);
|
||||
} else {
|
||||
|
@ -560,11 +562,11 @@ static Token *append_tokens(Token *tok1, Token *tok2) {
|
|||
|
||||
static FileType get_file_type(const char *filename) {
|
||||
if (opt_x != FILE_NONE) return opt_x;
|
||||
if (endswith(filename, ".a")) return FILE_AR;
|
||||
if (endswith(filename, ".o")) return FILE_OBJ;
|
||||
if (endswith(filename, ".c")) return FILE_C;
|
||||
if (endswith(filename, ".s")) return FILE_ASM;
|
||||
if (endswith(filename, ".S")) return FILE_ASM_CPP;
|
||||
if (_endswith(filename, ".a")) return FILE_AR;
|
||||
if (_endswith(filename, ".o")) return FILE_OBJ;
|
||||
if (_endswith(filename, ".c")) return FILE_C;
|
||||
if (_endswith(filename, ".s")) return FILE_ASM;
|
||||
if (_endswith(filename, ".S")) return FILE_ASM_CPP;
|
||||
error("<command line>: unknown file extension: %s", filename);
|
||||
}
|
||||
|
||||
|
|
6
third_party/chibicc/chibicc.h
vendored
6
third_party/chibicc/chibicc.h
vendored
|
@ -1,7 +1,6 @@
|
|||
#ifndef COSMOPOLITAN_THIRD_PARTY_CHIBICC_CHIBICC_H_
|
||||
#define COSMOPOLITAN_THIRD_PARTY_CHIBICC_CHIBICC_H_
|
||||
#include "libc/assert.h"
|
||||
#include "libc/intrin/popcnt.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
|
@ -9,21 +8,20 @@
|
|||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/intrin/popcnt.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/bsf.h"
|
||||
#include "libc/nexgen32e/bsr.h"
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/stdio/temp.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/str/unicode.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/str/unicode.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
#include "tool/build/lib/javadown.h"
|
||||
|
|
5
third_party/chibicc/codegen.c
vendored
5
third_party/chibicc/codegen.c
vendored
|
@ -1,3 +1,4 @@
|
|||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
|
||||
#define GP_MAX 6
|
||||
|
@ -984,7 +985,7 @@ static bool gen_builtin_funcall(Node *node, const char *name) {
|
|||
char regprefix;
|
||||
gen_expr(node->args);
|
||||
emitlin("\tor\t$-1,%edi");
|
||||
regprefix = endswith(name, "l") ? 'r' : 'e';
|
||||
regprefix = _endswith(name, "l") ? 'r' : 'e';
|
||||
println("\tbsf\t%%%cax,%%%cax", regprefix, regprefix);
|
||||
emitlin("\tcmovz\t%edi,%eax");
|
||||
emitlin("\tinc\t%eax");
|
||||
|
@ -1432,7 +1433,7 @@ void gen_expr(Node *node) {
|
|||
case ND_FUNCALL: {
|
||||
const char *funcname = NULL;
|
||||
if (node->lhs->kind == ND_VAR) {
|
||||
if (startswith(nameof(node->lhs->var), "__builtin_")) {
|
||||
if (_startswith(nameof(node->lhs->var), "__builtin_")) {
|
||||
funcname = nameof(node->lhs->var) + 10;
|
||||
if (gen_builtin_funcall(node, funcname)) {
|
||||
return;
|
||||
|
|
13
third_party/chibicc/dox1.c
vendored
13
third_party/chibicc/dox1.c
vendored
|
@ -16,10 +16,11 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/mem/gc.h"
|
||||
#include "libc/sysv/consts/map.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
#include "tool/build/lib/asmdown.h"
|
||||
|
||||
|
@ -107,15 +108,15 @@ static char *DescribeType(struct Type *ty) {
|
|||
case TY_LDOUBLE:
|
||||
return DescribeScalar(ty, "long double");
|
||||
case TY_FUNC:
|
||||
return xasprintf("%s(*)()", gc(DescribeType(ty->return_ty)));
|
||||
return xasprintf("%s(*)()", _gc(DescribeType(ty->return_ty)));
|
||||
case TY_PTR:
|
||||
if (ty->base->kind == TY_FUNC) {
|
||||
return DescribeType(ty->base);
|
||||
} else {
|
||||
return xasprintf("%s*", gc(DescribeType(ty->base)));
|
||||
return xasprintf("%s*", _gc(DescribeType(ty->base)));
|
||||
}
|
||||
case TY_ARRAY:
|
||||
return xasprintf("%s[%d]", gc(DescribeType(ty->base)), ty->array_len);
|
||||
return xasprintf("%s[%d]", _gc(DescribeType(ty->base)), ty->array_len);
|
||||
case TY_ENUM:
|
||||
if (ty->name) {
|
||||
return xasprintf("enum %.*s", ty->name->len, ty->name->loc);
|
||||
|
@ -283,7 +284,7 @@ static void LoadPublicDefinitions(struct DoxWriter *dox, Obj *prog) {
|
|||
if (!obj->javadown) {
|
||||
if (*obj->name == '_') continue;
|
||||
if (strchr(obj->name, '$')) continue;
|
||||
if (startswith(obj->name, "__gdtoa_")) continue;
|
||||
if (_startswith(obj->name, "__gdtoa_")) continue;
|
||||
if (obj->visibility && !strcmp(obj->visibility, "hidden")) continue;
|
||||
if (!obj->is_definition && (!obj->is_function || !obj->params ||
|
||||
!obj->params->name || !*obj->params->name)) {
|
||||
|
@ -292,7 +293,7 @@ static void LoadPublicDefinitions(struct DoxWriter *dox, Obj *prog) {
|
|||
}
|
||||
if (obj->is_static) continue;
|
||||
if (obj->is_string_literal) continue;
|
||||
if (obj->section && startswith(obj->section, ".init_array")) continue;
|
||||
if (obj->section && _startswith(obj->section, ".init_array")) continue;
|
||||
APPEND(dox->objects);
|
||||
dox->objects.p[dox->objects.n - 1] = obj;
|
||||
}
|
||||
|
|
9
third_party/chibicc/dox2.c
vendored
9
third_party/chibicc/dox2.c
vendored
|
@ -16,11 +16,12 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/mem/alg.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/mem/alg.h"
|
||||
#include "libc/sysv/consts/map.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
|
||||
#define APPEND(L) L.p = realloc(L.p, ++L.n * sizeof(*L.p))
|
||||
|
@ -282,7 +283,7 @@ static int CompareDoxIndexEntry(const void *p1, const void *p2, void *arg) {
|
|||
|
||||
static void IndexDox(struct Dox *dox) {
|
||||
size_t i, j, n;
|
||||
dox->names.n = roundup2pow(dox->objects.n + dox->macros.n) << 1;
|
||||
dox->names.n = _roundup2pow(dox->objects.n + dox->macros.n) << 1;
|
||||
dox->names.p = calloc(dox->names.n, sizeof(*dox->names.p));
|
||||
n = 0;
|
||||
for (i = 0; i < dox->objects.n; ++i) {
|
||||
|
@ -773,7 +774,7 @@ document.addEventListener('DOMContentLoaded', function () {\n\
|
|||
prefix = xasprintf("%s ", o->params.p[j].name);
|
||||
for (k = 0; k < o->javadown->tags.n; ++k) {
|
||||
if (!strcmp(o->javadown->tags.p[k].tag, "param") &&
|
||||
startswith(o->javadown->tags.p[k].text, prefix)) {
|
||||
_startswith(o->javadown->tags.p[k].text, prefix)) {
|
||||
fprintf(f, "<dd>");
|
||||
PrintText(f, o->javadown->tags.p[k].text + strlen(prefix));
|
||||
fprintf(f, "\n");
|
||||
|
@ -907,7 +908,7 @@ document.addEventListener('DOMContentLoaded', function () {\n\
|
|||
prefix = xasprintf("%s ", m->params.p[j].name);
|
||||
for (k = 0; k < m->javadown->tags.n; ++k) {
|
||||
if (!strcmp(m->javadown->tags.p[k].tag, "param") &&
|
||||
startswith(m->javadown->tags.p[k].text, prefix)) {
|
||||
_startswith(m->javadown->tags.p[k].text, prefix)) {
|
||||
fprintf(f, "<dd>");
|
||||
PrintText(f, m->javadown->tags.p[k].text + strlen(prefix));
|
||||
fprintf(f, "\n");
|
||||
|
|
5
third_party/chibicc/file.c
vendored
5
third_party/chibicc/file.c
vendored
|
@ -1,3 +1,4 @@
|
|||
#include "libc/intrin/bsf.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
|
||||
// Slurps contents of file.
|
||||
|
@ -66,7 +67,7 @@ void canonicalize_newline(char *p) {
|
|||
p += 16;
|
||||
q += 16;
|
||||
} else {
|
||||
m = bsf(m);
|
||||
m = _bsf(m);
|
||||
memmove(q, p, m);
|
||||
p += m;
|
||||
q += m;
|
||||
|
@ -125,7 +126,7 @@ void remove_backslash_newline(char *p) {
|
|||
i += 16;
|
||||
j += 16;
|
||||
} else {
|
||||
m = bsf(m);
|
||||
m = _bsf(m);
|
||||
memmove(p + j, p + i, m);
|
||||
i += m;
|
||||
j += m;
|
||||
|
|
1
third_party/chibicc/parse.c
vendored
1
third_party/chibicc/parse.c
vendored
|
@ -23,6 +23,7 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/ffs.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
#include "third_party/chibicc/kw.h"
|
||||
|
||||
|
|
1
third_party/chibicc/preprocess.c
vendored
1
third_party/chibicc/preprocess.c
vendored
|
@ -26,6 +26,7 @@
|
|||
#include "libc/mem/arena.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
#include "third_party/chibicc/kw.h"
|
||||
|
||||
|
|
10
third_party/chibicc/pybind.c
vendored
10
third_party/chibicc/pybind.c
vendored
|
@ -16,14 +16,14 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
#include "libc/mem/gc.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/stdio/append.internal.h"
|
||||
#include "libc/stdio/append.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
|
||||
static void AppendStringLiteral(char **b, const char *s, const char *indent) {
|
||||
|
@ -537,7 +537,7 @@ const struct _inittab _PyImport_Inittab_%s = {\n\
|
|||
};\n\
|
||||
",
|
||||
module, module,
|
||||
tok->file->javadown ? gc(xasprintf("pb_%s_doc", module)) : "0",
|
||||
tok->file->javadown ? _gc(xasprintf("pb_%s_doc", module)) : "0",
|
||||
module, module, module, module, module, module);
|
||||
CHECK_NE(-1, (fd = creat(path, 0644)));
|
||||
CHECK_NE(-1, xwrite(fd, b, appendz(b).i));
|
||||
|
|
4
third_party/chibicc/tokenize.c
vendored
4
third_party/chibicc/tokenize.c
vendored
|
@ -1,5 +1,5 @@
|
|||
#include "libc/intrin/bsf.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/nexgen32e/bsf.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/chibicc/chibicc.h"
|
||||
|
@ -679,7 +679,7 @@ static void convert_universal_chars(char *p) {
|
|||
p += 16;
|
||||
q += 16;
|
||||
} else {
|
||||
m = bsf(m);
|
||||
m = _bsf(m);
|
||||
memmove(q, p, m);
|
||||
p += m;
|
||||
q += m;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue