Replace COSMO define with _COSMO_SOURCE

This change might cause ABI breakages for /opt/cosmos. It's needed to
help us better conform to header declaration practices.
This commit is contained in:
Justine Tunney 2023-08-13 20:31:27 -07:00
parent a033b65a33
commit c776a32f75
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
238 changed files with 858 additions and 1069 deletions

View file

@ -218,7 +218,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;
@ -242,19 +242,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]);
@ -266,9 +266,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]);
@ -336,7 +336,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 {
@ -563,11 +563,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);
}