authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-27 17:38:37-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-27 17:39:11-04:00
log579301c2afc28137e67d5e6c894fe7970519ed3d
tree080ec18802958543b91bf14db2115b3244004f38
parentdc299166cfb2d9476ce5c86ca361a065935c4e7e
signaturelock-open Commit is signed but in an unrecognized format.

avoid duplicated code of specifying the default glibc version


3 files changed, 7 insertions(+), 3 deletions(-)

src/main.cpp+1-2
...@@ -979,8 +979,7 @@ int main(int argc, char **argv) {...@@ -979,8 +979,7 @@ int main(int argc, char **argv) {
979 return print_error_usage(arg0);979 return print_error_usage(arg0);
980 }980 }
981 } else {981 } else {
982 // Default cross-compiling glibc version982 target_init_default_glibc_version(&target);
983 *target.glibc_version = {2, 17, 0};
984 }983 }
985 } else if (target_glibc != nullptr) {984 } else if (target_glibc != nullptr) {
986 fprintf(stderr, "'%s' is not a glibc-compatible target", target_string);985 fprintf(stderr, "'%s' is not a glibc-compatible target", target_string);
src/target.cpp+5-1
...@@ -524,7 +524,7 @@ void get_native_target(ZigTarget *target) {...@@ -524,7 +524,7 @@ void get_native_target(ZigTarget *target) {
524 }524 }
525 if (target_is_glibc(target)) {525 if (target_is_glibc(target)) {
526 target->glibc_version = allocate<ZigGLibCVersion>(1);526 target->glibc_version = allocate<ZigGLibCVersion>(1);
527 *target->glibc_version = {2, 17, 0};527 target_init_default_glibc_version(target);
528#ifdef ZIG_OS_LINUX528#ifdef ZIG_OS_LINUX
529 Error err;529 Error err;
530 if ((err = glibc_detect_native_version(target->glibc_version))) {530 if ((err = glibc_detect_native_version(target->glibc_version))) {
...@@ -534,6 +534,10 @@ void get_native_target(ZigTarget *target) {...@@ -534,6 +534,10 @@ void get_native_target(ZigTarget *target) {
534 }534 }
535}535}
536536
537void target_init_default_glibc_version(ZigTarget *target) {
538 *target->glibc_version = {2, 17, 0};
539}
540
537Error target_parse_archsub(ZigLLVM_ArchType *out_arch, ZigLLVM_SubArchType *out_sub,541Error target_parse_archsub(ZigLLVM_ArchType *out_arch, ZigLLVM_SubArchType *out_sub,
538 const char *archsub_ptr, size_t archsub_len)542 const char *archsub_ptr, size_t archsub_len)
539{543{
src/target.hpp+1
...@@ -114,6 +114,7 @@ Error target_parse_os(Os *os, const char *os_ptr, size_t os_len);...@@ -114,6 +114,7 @@ Error target_parse_os(Os *os, const char *os_ptr, size_t os_len);
114Error target_parse_abi(ZigLLVM_EnvironmentType *abi, const char *abi_ptr, size_t abi_len);114Error target_parse_abi(ZigLLVM_EnvironmentType *abi, const char *abi_ptr, size_t abi_len);
115115
116Error target_parse_glibc_version(ZigGLibCVersion *out, const char *text);116Error target_parse_glibc_version(ZigGLibCVersion *out, const char *text);
117void target_init_default_glibc_version(ZigTarget *target);
117118
118size_t target_arch_count(void);119size_t target_arch_count(void);
119ZigLLVM_ArchType target_arch_enum(size_t index);120ZigLLVM_ArchType target_arch_enum(size_t index);