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) {
979979 return print_error_usage(arg0);
980980 }
981981 } else {
982 // Default cross-compiling glibc version
983 *target.glibc_version = {2, 17, 0};
982 target_init_default_glibc_version(&target);
984983 }
985984 } else if (target_glibc != nullptr) {
986985 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) {
524524 }
525525 if (target_is_glibc(target)) {
526526 target->glibc_version = allocate<ZigGLibCVersion>(1);
527 *target->glibc_version = {2, 17, 0};
527 target_init_default_glibc_version(target);
528528#ifdef ZIG_OS_LINUX
529529 Error err;
530530 if ((err = glibc_detect_native_version(target->glibc_version))) {
......@@ -534,6 +534,10 @@ void get_native_target(ZigTarget *target) {
534534 }
535535}
536536
537void target_init_default_glibc_version(ZigTarget *target) {
538 *target->glibc_version = {2, 17, 0};
539}
540
537541Error target_parse_archsub(ZigLLVM_ArchType *out_arch, ZigLLVM_SubArchType *out_sub,
538542 const char *archsub_ptr, size_t archsub_len)
539543{
src/target.hpp+1
......@@ -114,6 +114,7 @@ Error target_parse_os(Os *os, const char *os_ptr, size_t os_len);
114114Error target_parse_abi(ZigLLVM_EnvironmentType *abi, const char *abi_ptr, size_t abi_len);
115115
116116Error target_parse_glibc_version(ZigGLibCVersion *out, const char *text);
117void target_init_default_glibc_version(ZigTarget *target);
117118
118119size_t target_arch_count(void);
119120ZigLLVM_ArchType target_arch_enum(size_t index);