mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 11:48:30 +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
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue