mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
rename 'environ' to 'env_type'
environ appears to clash with another symbol in mingw land
This commit is contained in:
parent
afa5d1ea12
commit
58c13aa949
@ -3586,7 +3586,7 @@ static void define_builtin_types(CodeGen *g) {
|
||||
type_enum_field->name = buf_create_from_str(ZigLLVMGetEnvironmentTypeName(environ_type));
|
||||
type_enum_field->value = i;
|
||||
|
||||
if (environ_type == g->zig_target.environ) {
|
||||
if (environ_type == g->zig_target.env_type) {
|
||||
g->target_environ_index = i;
|
||||
}
|
||||
}
|
||||
|
||||
12
src/link.cpp
12
src/link.cpp
@ -68,7 +68,7 @@ static Buf *build_o(CodeGen *parent_gen, const char *oname) {
|
||||
}
|
||||
|
||||
static const char *get_o_file_extension(CodeGen *g) {
|
||||
if (g->zig_target.environ == ZigLLVM_MSVC) {
|
||||
if (g->zig_target.env_type == ZigLLVM_MSVC) {
|
||||
return ".obj";
|
||||
} else {
|
||||
return ".o";
|
||||
@ -136,7 +136,7 @@ static const char *getLDMOption(const ZigTarget *t) {
|
||||
case ZigLLVM_systemz:
|
||||
return "elf64_s390";
|
||||
case ZigLLVM_x86_64:
|
||||
if (t->environ == ZigLLVM_GNUX32) {
|
||||
if (t->env_type == ZigLLVM_GNUX32) {
|
||||
return "elf32_x86_64";
|
||||
}
|
||||
return "elf_x86_64";
|
||||
@ -272,8 +272,8 @@ static void construct_linker_job_linux(LinkJob *lj) {
|
||||
}
|
||||
|
||||
static bool is_target_cyg_mingw(const ZigTarget *target) {
|
||||
return (target->os == ZigLLVM_Win32 && target->environ == ZigLLVM_Cygnus) ||
|
||||
(target->os == ZigLLVM_Win32 && target->environ == ZigLLVM_GNU);
|
||||
return (target->os == ZigLLVM_Win32 && target->env_type == ZigLLVM_Cygnus) ||
|
||||
(target->os == ZigLLVM_Win32 && target->env_type == ZigLLVM_GNU);
|
||||
}
|
||||
|
||||
static void construct_linker_job_mingw(LinkJob *lj) {
|
||||
@ -370,7 +370,7 @@ static void construct_linker_job_mingw(LinkJob *lj) {
|
||||
lj->args.append("-lmingw32");
|
||||
|
||||
lj->args.append("-lgcc");
|
||||
bool is_android = (g->zig_target.environ == ZigLLVM_Android);
|
||||
bool is_android = (g->zig_target.env_type == ZigLLVM_Android);
|
||||
bool is_cyg_ming = is_target_cyg_mingw(&g->zig_target);
|
||||
if (!g->is_static && !is_android) {
|
||||
if (!is_cyg_ming) {
|
||||
@ -675,7 +675,7 @@ static void construct_linker_job(LinkJob *lj) {
|
||||
case ZigLLVM_Solaris:
|
||||
zig_panic("TODO construct Solaris linker job");
|
||||
case ZigLLVM_Win32:
|
||||
switch (lj->codegen->zig_target.environ) {
|
||||
switch (lj->codegen->zig_target.env_type) {
|
||||
default:
|
||||
if (lj->codegen->zig_target.oformat == ZigLLVM_ELF) {
|
||||
zig_panic("TODO construct Generic_ELF linker job");
|
||||
|
||||
@ -81,7 +81,7 @@ static int print_target_list(FILE *f) {
|
||||
int environ_count = target_environ_count();
|
||||
for (int i = 0; i < environ_count; i += 1) {
|
||||
ZigLLVM_EnvironmentType environ_type = get_target_environ(i);
|
||||
const char *native_str = (native.environ == environ_type) ? " (native)" : "";
|
||||
const char *native_str = (native.env_type == environ_type) ? " (native)" : "";
|
||||
fprintf(f, " %s%s\n", ZigLLVMGetEnvironmentTypeName(environ_type), native_str);
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
if (target_environ) {
|
||||
if (parse_target_environ(target_environ, &target->environ)) {
|
||||
if (parse_target_environ(target_environ, &target->env_type)) {
|
||||
fprintf(stderr, "invalid --target-environ argument\n");
|
||||
return usage(arg0);
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ void get_native_target(ZigTarget *target) {
|
||||
&target->arch.sub_arch,
|
||||
&target->vendor,
|
||||
&target->os,
|
||||
&target->environ,
|
||||
&target->env_type,
|
||||
&target->oformat);
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ void get_unknown_target(ZigTarget *target) {
|
||||
target->arch.sub_arch = ZigLLVM_NoSubArch;
|
||||
target->vendor = ZigLLVM_UnknownVendor;
|
||||
target->os = ZigLLVM_UnknownOS;
|
||||
target->environ = ZigLLVM_UnknownEnvironment;
|
||||
target->env_type = ZigLLVM_UnknownEnvironment;
|
||||
target->oformat = ZigLLVM_UnknownObjectFormat;
|
||||
}
|
||||
|
||||
@ -217,10 +217,10 @@ int parse_target_os(const char *str, ZigLLVM_OSType *out_os) {
|
||||
|
||||
int parse_target_environ(const char *str, ZigLLVM_EnvironmentType *out_environ) {
|
||||
for (int i = 0; i < array_length(environ_list); i += 1) {
|
||||
ZigLLVM_EnvironmentType environ = environ_list[i];
|
||||
const char *environ_name = ZigLLVMGetEnvironmentTypeName(environ);
|
||||
ZigLLVM_EnvironmentType env_type = environ_list[i];
|
||||
const char *environ_name = ZigLLVMGetEnvironmentTypeName(env_type);
|
||||
if (strcmp(environ_name, str) == 0) {
|
||||
*out_environ = environ;
|
||||
*out_environ = env_type;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -237,7 +237,7 @@ void init_all_targets(void) {
|
||||
|
||||
void get_target_triple(Buf *triple, const ZigTarget *target) {
|
||||
ZigLLVMGetTargetTriple(triple, target->arch.arch, target->arch.sub_arch,
|
||||
target->vendor, target->os, target->environ, target->oformat);
|
||||
target->vendor, target->os, target->env_type, target->oformat);
|
||||
}
|
||||
|
||||
static bool is_os_darwin(ZigTarget *target) {
|
||||
|
||||
@ -21,7 +21,7 @@ struct ZigTarget {
|
||||
ArchType arch;
|
||||
ZigLLVM_VendorType vendor;
|
||||
ZigLLVM_OSType os;
|
||||
ZigLLVM_EnvironmentType environ;
|
||||
ZigLLVM_EnvironmentType env_type;
|
||||
ZigLLVM_ObjectFormatType oformat;
|
||||
};
|
||||
|
||||
@ -57,7 +57,7 @@ void get_unknown_target(ZigTarget *target);
|
||||
|
||||
int parse_target_arch(const char *str, ArchType *arch);
|
||||
int parse_target_os(const char *str, ZigLLVM_OSType *os);
|
||||
int parse_target_environ(const char *str, ZigLLVM_EnvironmentType *environ);
|
||||
int parse_target_environ(const char *str, ZigLLVM_EnvironmentType *env_type);
|
||||
|
||||
void init_all_targets(void);
|
||||
|
||||
|
||||
@ -538,8 +538,8 @@ const char *ZigLLVMGetOSTypeName(ZigLLVM_OSType os) {
|
||||
return Triple::getOSTypeName((Triple::OSType)os);
|
||||
}
|
||||
|
||||
const char *ZigLLVMGetEnvironmentTypeName(ZigLLVM_EnvironmentType environ) {
|
||||
return Triple::getEnvironmentTypeName((Triple::EnvironmentType)environ);
|
||||
const char *ZigLLVMGetEnvironmentTypeName(ZigLLVM_EnvironmentType env_type) {
|
||||
return Triple::getEnvironmentTypeName((Triple::EnvironmentType)env_type);
|
||||
}
|
||||
|
||||
void ZigLLVMGetNativeTarget(ZigLLVM_ArchType *arch_type, ZigLLVM_SubArchType *sub_arch_type,
|
||||
|
||||
@ -291,7 +291,7 @@ const char *ZigLLVMGetArchTypeName(ZigLLVM_ArchType arch);
|
||||
const char *ZigLLVMGetSubArchTypeName(ZigLLVM_SubArchType sub_arch);
|
||||
const char *ZigLLVMGetVendorTypeName(ZigLLVM_VendorType vendor);
|
||||
const char *ZigLLVMGetOSTypeName(ZigLLVM_OSType os);
|
||||
const char *ZigLLVMGetEnvironmentTypeName(ZigLLVM_EnvironmentType environ);
|
||||
const char *ZigLLVMGetEnvironmentTypeName(ZigLLVM_EnvironmentType env_type);
|
||||
|
||||
/*
|
||||
* This stuff is not LLVM API but it depends on the LLVM C++ API so we put it here.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user