authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-01-03 20:53:53-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-01-03 20:53:53-05:00
log8eae4a096752b7e477d16ee0c5fd40d8871e973a
tree3cdbfaeb3c53eaf551ab59bd508edbb4c2bddc5d
parent1d77f8db289e6eefce827fe37d27e72b68362943
parent5a800db48cde943a7fd80fdbfb42bc69a325ca76

Merge branch 'master' into llvm6


16 files changed, 376 insertions(+), 360 deletions(-)

CMakeLists.txt+225-211
...@@ -353,6 +353,223 @@ set(ZIG_CPP_SOURCES...@@ -353,6 +353,223 @@ set(ZIG_CPP_SOURCES
353 "${CMAKE_SOURCE_DIR}/src/zig_llvm.cpp"353 "${CMAKE_SOURCE_DIR}/src/zig_llvm.cpp"
354)354)
355355
356set(ZIG_STD_FILES
357 "array_list.zig"
358 "base64.zig"
359 "buf_map.zig"
360 "buf_set.zig"
361 "buffer.zig"
362 "build.zig"
363 "c/darwin.zig"
364 "c/index.zig"
365 "c/linux.zig"
366 "c/windows.zig"
367 "cstr.zig"
368 "debug/failing_allocator.zig"
369 "debug/index.zig"
370 "dwarf.zig"
371 "elf.zig"
372 "empty.zig"
373 "endian.zig"
374 "fmt/errol/enum3.zig"
375 "fmt/errol/index.zig"
376 "fmt/errol/lookup.zig"
377 "fmt/index.zig"
378 "hash_map.zig"
379 "heap.zig"
380 "index.zig"
381 "io.zig"
382 "linked_list.zig"
383 "math/acos.zig"
384 "math/acosh.zig"
385 "math/asin.zig"
386 "math/asinh.zig"
387 "math/atan.zig"
388 "math/atan2.zig"
389 "math/atanh.zig"
390 "math/cbrt.zig"
391 "math/ceil.zig"
392 "math/copysign.zig"
393 "math/cos.zig"
394 "math/cosh.zig"
395 "math/exp.zig"
396 "math/exp2.zig"
397 "math/expm1.zig"
398 "math/expo2.zig"
399 "math/fabs.zig"
400 "math/floor.zig"
401 "math/fma.zig"
402 "math/frexp.zig"
403 "math/hypot.zig"
404 "math/ilogb.zig"
405 "math/index.zig"
406 "math/inf.zig"
407 "math/isfinite.zig"
408 "math/isinf.zig"
409 "math/isnan.zig"
410 "math/isnormal.zig"
411 "math/ln.zig"
412 "math/log.zig"
413 "math/log10.zig"
414 "math/log1p.zig"
415 "math/log2.zig"
416 "math/modf.zig"
417 "math/nan.zig"
418 "math/pow.zig"
419 "math/round.zig"
420 "math/scalbn.zig"
421 "math/signbit.zig"
422 "math/sin.zig"
423 "math/sinh.zig"
424 "math/sqrt.zig"
425 "math/tan.zig"
426 "math/tanh.zig"
427 "math/trunc.zig"
428 "mem.zig"
429 "net.zig"
430 "os/child_process.zig"
431 "os/darwin.zig"
432 "os/darwin_errno.zig"
433 "os/get_user_id.zig"
434 "os/index.zig"
435 "os/linux.zig"
436 "os/linux_errno.zig"
437 "os/linux_i386.zig"
438 "os/linux_x86_64.zig"
439 "os/path.zig"
440 "os/windows/error.zig"
441 "os/windows/index.zig"
442 "os/windows/util.zig"
443 "rand.zig"
444 "sort.zig"
445 "special/bootstrap.zig"
446 "special/bootstrap_lib.zig"
447 "special/build_file_template.zig"
448 "special/build_runner.zig"
449 "special/builtin.zig"
450 "special/compiler_rt/aulldiv.zig"
451 "special/compiler_rt/aullrem.zig"
452 "special/compiler_rt/comparetf2.zig"
453 "special/compiler_rt/fixuint.zig"
454 "special/compiler_rt/fixunsdfdi.zig"
455 "special/compiler_rt/fixunsdfsi.zig"
456 "special/compiler_rt/fixunsdfti.zig"
457 "special/compiler_rt/fixunssfdi.zig"
458 "special/compiler_rt/fixunssfsi.zig"
459 "special/compiler_rt/fixunssfti.zig"
460 "special/compiler_rt/fixunstfdi.zig"
461 "special/compiler_rt/fixunstfsi.zig"
462 "special/compiler_rt/fixunstfti.zig"
463 "special/compiler_rt/index.zig"
464 "special/compiler_rt/udivmod.zig"
465 "special/compiler_rt/udivmoddi4.zig"
466 "special/compiler_rt/udivmodti4.zig"
467 "special/compiler_rt/udivti3.zig"
468 "special/compiler_rt/umodti3.zig"
469 "special/panic.zig"
470 "special/test_runner.zig"
471 "unicode.zig"
472)
473
474set(ZIG_C_HEADER_FILES
475 "__clang_cuda_builtin_vars.h"
476 "__clang_cuda_cmath.h"
477 "__clang_cuda_complex_builtins.h"
478 "__clang_cuda_intrinsics.h"
479 "__clang_cuda_math_forward_declares.h"
480 "__clang_cuda_runtime_wrapper.h"
481 "__stddef_max_align_t.h"
482 "__wmmintrin_aes.h"
483 "__wmmintrin_pclmul.h"
484 "adxintrin.h"
485 "altivec.h"
486 "ammintrin.h"
487 "arm_acle.h"
488 "arm_neon.h"
489 "armintr.h"
490 "avx2intrin.h"
491 "avx512bwintrin.h"
492 "avx512cdintrin.h"
493 "avx512dqintrin.h"
494 "avx512erintrin.h"
495 "avx512fintrin.h"
496 "avx512ifmaintrin.h"
497 "avx512ifmavlintrin.h"
498 "avx512pfintrin.h"
499 "avx512vbmiintrin.h"
500 "avx512vbmivlintrin.h"
501 "avx512vlbwintrin.h"
502 "avx512vlcdintrin.h"
503 "avx512vldqintrin.h"
504 "avx512vlintrin.h"
505 "avx512vpopcntdqintrin.h"
506 "avxintrin.h"
507 "bmi2intrin.h"
508 "bmiintrin.h"
509 "clflushoptintrin.h"
510 "clzerointrin.h"
511 "cpuid.h"
512 "cuda_wrappers/algorithm"
513 "cuda_wrappers/complex"
514 "cuda_wrappers/new"
515 "emmintrin.h"
516 "f16cintrin.h"
517 "float.h"
518 "fma4intrin.h"
519 "fmaintrin.h"
520 "fxsrintrin.h"
521 "htmintrin.h"
522 "htmxlintrin.h"
523 "ia32intrin.h"
524 "immintrin.h"
525 "intrin.h"
526 "inttypes.h"
527 "iso646.h"
528 "limits.h"
529 "lwpintrin.h"
530 "lzcntintrin.h"
531 "mm3dnow.h"
532 "mm_malloc.h"
533 "mmintrin.h"
534 "module.modulemap"
535 "msa.h"
536 "mwaitxintrin.h"
537 "nmmintrin.h"
538 "opencl-c.h"
539 "pkuintrin.h"
540 "pmmintrin.h"
541 "popcntintrin.h"
542 "prfchwintrin.h"
543 "rdseedintrin.h"
544 "rtmintrin.h"
545 "s390intrin.h"
546 "shaintrin.h"
547 "smmintrin.h"
548 "stdalign.h"
549 "stdarg.h"
550 "stdatomic.h"
551 "stdbool.h"
552 "stddef.h"
553 "stdint.h"
554 "stdnoreturn.h"
555 "tbmintrin.h"
556 "tgmath.h"
557 "tmmintrin.h"
558 "unwind.h"
559 "vadefs.h"
560 "varargs.h"
561 "vecintrin.h"
562 "wmmintrin.h"
563 "x86intrin.h"
564 "xmmintrin.h"
565 "xopintrin.h"
566 "xsavecintrin.h"
567 "xsaveintrin.h"
568 "xsaveoptintrin.h"
569 "xsavesintrin.h"
570 "xtestintrin.h"
571)
572
356set(ZIG_LIB_DIR "lib/zig")573set(ZIG_LIB_DIR "lib/zig")
357set(C_HEADERS_DEST "${ZIG_LIB_DIR}/include")574set(C_HEADERS_DEST "${ZIG_LIB_DIR}/include")
358set(ZIG_STD_DEST "${ZIG_LIB_DIR}/std")575set(ZIG_STD_DEST "${ZIG_LIB_DIR}/std")
...@@ -420,215 +637,12 @@ endif()...@@ -420,215 +637,12 @@ endif()
420install(TARGETS zig DESTINATION bin)637install(TARGETS zig DESTINATION bin)
421install(TARGETS zig_cpp DESTINATION "${ZIG_CPP_LIB_DIR}")638install(TARGETS zig_cpp DESTINATION "${ZIG_CPP_LIB_DIR}")
422639
423install(FILES "${CMAKE_SOURCE_DIR}/c_headers/__clang_cuda_builtin_vars.h" DESTINATION "${C_HEADERS_DEST}")640foreach(file ${ZIG_C_HEADER_FILES})
424install(FILES "${CMAKE_SOURCE_DIR}/c_headers/__clang_cuda_cmath.h" DESTINATION "${C_HEADERS_DEST}")641 get_filename_component(file_dir "${C_HEADERS_DEST}/${file}" DIRECTORY)
425install(FILES "${CMAKE_SOURCE_DIR}/c_headers/__clang_cuda_complex_builtins.h" DESTINATION "${C_HEADERS_DEST}")642 install(FILES "${CMAKE_SOURCE_DIR}/c_headers/${file}" DESTINATION "${file_dir}")
426install(FILES "${CMAKE_SOURCE_DIR}/c_headers/__clang_cuda_intrinsics.h" DESTINATION "${C_HEADERS_DEST}")643endforeach()
427install(FILES "${CMAKE_SOURCE_DIR}/c_headers/__clang_cuda_math_forward_declares.h" DESTINATION "${C_HEADERS_DEST}")
428install(FILES "${CMAKE_SOURCE_DIR}/c_headers/__clang_cuda_runtime_wrapper.h" DESTINATION "${C_HEADERS_DEST}")
429install(FILES "${CMAKE_SOURCE_DIR}/c_headers/__stddef_max_align_t.h" DESTINATION "${C_HEADERS_DEST}")
430install(FILES "${CMAKE_SOURCE_DIR}/c_headers/__wmmintrin_aes.h" DESTINATION "${C_HEADERS_DEST}")
431install(FILES "${CMAKE_SOURCE_DIR}/c_headers/__wmmintrin_pclmul.h" DESTINATION "${C_HEADERS_DEST}")
432install(FILES "${CMAKE_SOURCE_DIR}/c_headers/adxintrin.h" DESTINATION "${C_HEADERS_DEST}")
433install(FILES "${CMAKE_SOURCE_DIR}/c_headers/altivec.h" DESTINATION "${C_HEADERS_DEST}")
434install(FILES "${CMAKE_SOURCE_DIR}/c_headers/ammintrin.h" DESTINATION "${C_HEADERS_DEST}")
435install(FILES "${CMAKE_SOURCE_DIR}/c_headers/arm_acle.h" DESTINATION "${C_HEADERS_DEST}")
436install(FILES "${CMAKE_SOURCE_DIR}/c_headers/arm_neon.h" DESTINATION "${C_HEADERS_DEST}")
437install(FILES "${CMAKE_SOURCE_DIR}/c_headers/armintr.h" DESTINATION "${C_HEADERS_DEST}")
438install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx2intrin.h" DESTINATION "${C_HEADERS_DEST}")
439install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512bwintrin.h" DESTINATION "${C_HEADERS_DEST}")
440install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512cdintrin.h" DESTINATION "${C_HEADERS_DEST}")
441install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512dqintrin.h" DESTINATION "${C_HEADERS_DEST}")
442install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512erintrin.h" DESTINATION "${C_HEADERS_DEST}")
443install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512fintrin.h" DESTINATION "${C_HEADERS_DEST}")
444install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512ifmaintrin.h" DESTINATION "${C_HEADERS_DEST}")
445install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512ifmavlintrin.h" DESTINATION "${C_HEADERS_DEST}")
446install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512pfintrin.h" DESTINATION "${C_HEADERS_DEST}")
447install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512vbmiintrin.h" DESTINATION "${C_HEADERS_DEST}")
448install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512vbmivlintrin.h" DESTINATION "${C_HEADERS_DEST}")
449install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512vlbwintrin.h" DESTINATION "${C_HEADERS_DEST}")
450install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512vlcdintrin.h" DESTINATION "${C_HEADERS_DEST}")
451install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512vldqintrin.h" DESTINATION "${C_HEADERS_DEST}")
452install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512vlintrin.h" DESTINATION "${C_HEADERS_DEST}")
453install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avx512vpopcntdqintrin.h" DESTINATION "${C_HEADERS_DEST}")
454install(FILES "${CMAKE_SOURCE_DIR}/c_headers/avxintrin.h" DESTINATION "${C_HEADERS_DEST}")
455install(FILES "${CMAKE_SOURCE_DIR}/c_headers/bmi2intrin.h" DESTINATION "${C_HEADERS_DEST}")
456install(FILES "${CMAKE_SOURCE_DIR}/c_headers/bmiintrin.h" DESTINATION "${C_HEADERS_DEST}")
457install(FILES "${CMAKE_SOURCE_DIR}/c_headers/clflushoptintrin.h" DESTINATION "${C_HEADERS_DEST}")
458install(FILES "${CMAKE_SOURCE_DIR}/c_headers/clzerointrin.h" DESTINATION "${C_HEADERS_DEST}")
459install(FILES "${CMAKE_SOURCE_DIR}/c_headers/cpuid.h" DESTINATION "${C_HEADERS_DEST}")
460install(FILES "${CMAKE_SOURCE_DIR}/c_headers/cuda_wrappers/algorithm" DESTINATION "${C_HEADERS_DEST}/cuda_wrappers")
461install(FILES "${CMAKE_SOURCE_DIR}/c_headers/cuda_wrappers/complex" DESTINATION "${C_HEADERS_DEST}/cuda_wrappers")
462install(FILES "${CMAKE_SOURCE_DIR}/c_headers/cuda_wrappers/new" DESTINATION "${C_HEADERS_DEST}/cuda_wrappers")
463install(FILES "${CMAKE_SOURCE_DIR}/c_headers/emmintrin.h" DESTINATION "${C_HEADERS_DEST}")
464install(FILES "${CMAKE_SOURCE_DIR}/c_headers/f16cintrin.h" DESTINATION "${C_HEADERS_DEST}")
465install(FILES "${CMAKE_SOURCE_DIR}/c_headers/float.h" DESTINATION "${C_HEADERS_DEST}")
466install(FILES "${CMAKE_SOURCE_DIR}/c_headers/fma4intrin.h" DESTINATION "${C_HEADERS_DEST}")
467install(FILES "${CMAKE_SOURCE_DIR}/c_headers/fmaintrin.h" DESTINATION "${C_HEADERS_DEST}")
468install(FILES "${CMAKE_SOURCE_DIR}/c_headers/fxsrintrin.h" DESTINATION "${C_HEADERS_DEST}")
469install(FILES "${CMAKE_SOURCE_DIR}/c_headers/htmintrin.h" DESTINATION "${C_HEADERS_DEST}")
470install(FILES "${CMAKE_SOURCE_DIR}/c_headers/htmxlintrin.h" DESTINATION "${C_HEADERS_DEST}")
471install(FILES "${CMAKE_SOURCE_DIR}/c_headers/ia32intrin.h" DESTINATION "${C_HEADERS_DEST}")
472install(FILES "${CMAKE_SOURCE_DIR}/c_headers/immintrin.h" DESTINATION "${C_HEADERS_DEST}")
473install(FILES "${CMAKE_SOURCE_DIR}/c_headers/intrin.h" DESTINATION "${C_HEADERS_DEST}")
474install(FILES "${CMAKE_SOURCE_DIR}/c_headers/inttypes.h" DESTINATION "${C_HEADERS_DEST}")
475install(FILES "${CMAKE_SOURCE_DIR}/c_headers/iso646.h" DESTINATION "${C_HEADERS_DEST}")
476install(FILES "${CMAKE_SOURCE_DIR}/c_headers/limits.h" DESTINATION "${C_HEADERS_DEST}")
477install(FILES "${CMAKE_SOURCE_DIR}/c_headers/lwpintrin.h" DESTINATION "${C_HEADERS_DEST}")
478install(FILES "${CMAKE_SOURCE_DIR}/c_headers/lzcntintrin.h" DESTINATION "${C_HEADERS_DEST}")
479install(FILES "${CMAKE_SOURCE_DIR}/c_headers/mm3dnow.h" DESTINATION "${C_HEADERS_DEST}")
480install(FILES "${CMAKE_SOURCE_DIR}/c_headers/mm_malloc.h" DESTINATION "${C_HEADERS_DEST}")
481install(FILES "${CMAKE_SOURCE_DIR}/c_headers/mmintrin.h" DESTINATION "${C_HEADERS_DEST}")
482install(FILES "${CMAKE_SOURCE_DIR}/c_headers/module.modulemap" DESTINATION "${C_HEADERS_DEST}")
483install(FILES "${CMAKE_SOURCE_DIR}/c_headers/msa.h" DESTINATION "${C_HEADERS_DEST}")
484install(FILES "${CMAKE_SOURCE_DIR}/c_headers/mwaitxintrin.h" DESTINATION "${C_HEADERS_DEST}")
485install(FILES "${CMAKE_SOURCE_DIR}/c_headers/nmmintrin.h" DESTINATION "${C_HEADERS_DEST}")
486install(FILES "${CMAKE_SOURCE_DIR}/c_headers/opencl-c.h" DESTINATION "${C_HEADERS_DEST}")
487install(FILES "${CMAKE_SOURCE_DIR}/c_headers/pkuintrin.h" DESTINATION "${C_HEADERS_DEST}")
488install(FILES "${CMAKE_SOURCE_DIR}/c_headers/pmmintrin.h" DESTINATION "${C_HEADERS_DEST}")
489install(FILES "${CMAKE_SOURCE_DIR}/c_headers/popcntintrin.h" DESTINATION "${C_HEADERS_DEST}")
490install(FILES "${CMAKE_SOURCE_DIR}/c_headers/prfchwintrin.h" DESTINATION "${C_HEADERS_DEST}")
491install(FILES "${CMAKE_SOURCE_DIR}/c_headers/rdseedintrin.h" DESTINATION "${C_HEADERS_DEST}")
492install(FILES "${CMAKE_SOURCE_DIR}/c_headers/rtmintrin.h" DESTINATION "${C_HEADERS_DEST}")
493install(FILES "${CMAKE_SOURCE_DIR}/c_headers/s390intrin.h" DESTINATION "${C_HEADERS_DEST}")
494install(FILES "${CMAKE_SOURCE_DIR}/c_headers/shaintrin.h" DESTINATION "${C_HEADERS_DEST}")
495install(FILES "${CMAKE_SOURCE_DIR}/c_headers/smmintrin.h" DESTINATION "${C_HEADERS_DEST}")
496install(FILES "${CMAKE_SOURCE_DIR}/c_headers/stdalign.h" DESTINATION "${C_HEADERS_DEST}")
497install(FILES "${CMAKE_SOURCE_DIR}/c_headers/stdarg.h" DESTINATION "${C_HEADERS_DEST}")
498install(FILES "${CMAKE_SOURCE_DIR}/c_headers/stdatomic.h" DESTINATION "${C_HEADERS_DEST}")
499install(FILES "${CMAKE_SOURCE_DIR}/c_headers/stdbool.h" DESTINATION "${C_HEADERS_DEST}")
500install(FILES "${CMAKE_SOURCE_DIR}/c_headers/stddef.h" DESTINATION "${C_HEADERS_DEST}")
501install(FILES "${CMAKE_SOURCE_DIR}/c_headers/stdint.h" DESTINATION "${C_HEADERS_DEST}")
502install(FILES "${CMAKE_SOURCE_DIR}/c_headers/stdnoreturn.h" DESTINATION "${C_HEADERS_DEST}")
503install(FILES "${CMAKE_SOURCE_DIR}/c_headers/tbmintrin.h" DESTINATION "${C_HEADERS_DEST}")
504install(FILES "${CMAKE_SOURCE_DIR}/c_headers/tgmath.h" DESTINATION "${C_HEADERS_DEST}")
505install(FILES "${CMAKE_SOURCE_DIR}/c_headers/tmmintrin.h" DESTINATION "${C_HEADERS_DEST}")
506install(FILES "${CMAKE_SOURCE_DIR}/c_headers/unwind.h" DESTINATION "${C_HEADERS_DEST}")
507install(FILES "${CMAKE_SOURCE_DIR}/c_headers/vadefs.h" DESTINATION "${C_HEADERS_DEST}")
508install(FILES "${CMAKE_SOURCE_DIR}/c_headers/varargs.h" DESTINATION "${C_HEADERS_DEST}")
509install(FILES "${CMAKE_SOURCE_DIR}/c_headers/vecintrin.h" DESTINATION "${C_HEADERS_DEST}")
510install(FILES "${CMAKE_SOURCE_DIR}/c_headers/wmmintrin.h" DESTINATION "${C_HEADERS_DEST}")
511install(FILES "${CMAKE_SOURCE_DIR}/c_headers/x86intrin.h" DESTINATION "${C_HEADERS_DEST}")
512install(FILES "${CMAKE_SOURCE_DIR}/c_headers/xmmintrin.h" DESTINATION "${C_HEADERS_DEST}")
513install(FILES "${CMAKE_SOURCE_DIR}/c_headers/xopintrin.h" DESTINATION "${C_HEADERS_DEST}")
514install(FILES "${CMAKE_SOURCE_DIR}/c_headers/xsavecintrin.h" DESTINATION "${C_HEADERS_DEST}")
515install(FILES "${CMAKE_SOURCE_DIR}/c_headers/xsaveintrin.h" DESTINATION "${C_HEADERS_DEST}")
516install(FILES "${CMAKE_SOURCE_DIR}/c_headers/xsaveoptintrin.h" DESTINATION "${C_HEADERS_DEST}")
517install(FILES "${CMAKE_SOURCE_DIR}/c_headers/xsavesintrin.h" DESTINATION "${C_HEADERS_DEST}")
518install(FILES "${CMAKE_SOURCE_DIR}/c_headers/xtestintrin.h" DESTINATION "${C_HEADERS_DEST}")
519644
520install(FILES "${CMAKE_SOURCE_DIR}/std/array_list.zig" DESTINATION "${ZIG_STD_DEST}")645foreach(file ${ZIG_STD_FILES})
521install(FILES "${CMAKE_SOURCE_DIR}/std/base64.zig" DESTINATION "${ZIG_STD_DEST}")646 get_filename_component(file_dir "${ZIG_STD_DEST}/${file}" DIRECTORY)
522install(FILES "${CMAKE_SOURCE_DIR}/std/buf_map.zig" DESTINATION "${ZIG_STD_DEST}")647 install(FILES "${CMAKE_SOURCE_DIR}/std/${file}" DESTINATION "${file_dir}")
523install(FILES "${CMAKE_SOURCE_DIR}/std/buf_set.zig" DESTINATION "${ZIG_STD_DEST}")648endforeach()
524install(FILES "${CMAKE_SOURCE_DIR}/std/buffer.zig" DESTINATION "${ZIG_STD_DEST}")
525install(FILES "${CMAKE_SOURCE_DIR}/std/build.zig" DESTINATION "${ZIG_STD_DEST}")
526install(FILES "${CMAKE_SOURCE_DIR}/std/c/darwin.zig" DESTINATION "${ZIG_STD_DEST}/c")
527install(FILES "${CMAKE_SOURCE_DIR}/std/c/index.zig" DESTINATION "${ZIG_STD_DEST}/c")
528install(FILES "${CMAKE_SOURCE_DIR}/std/c/linux.zig" DESTINATION "${ZIG_STD_DEST}/c")
529install(FILES "${CMAKE_SOURCE_DIR}/std/c/windows.zig" DESTINATION "${ZIG_STD_DEST}/c")
530install(FILES "${CMAKE_SOURCE_DIR}/std/cstr.zig" DESTINATION "${ZIG_STD_DEST}")
531install(FILES "${CMAKE_SOURCE_DIR}/std/debug/index.zig" DESTINATION "${ZIG_STD_DEST}/debug")
532install(FILES "${CMAKE_SOURCE_DIR}/std/debug/failing_allocator.zig" DESTINATION "${ZIG_STD_DEST}/debug")
533install(FILES "${CMAKE_SOURCE_DIR}/std/dwarf.zig" DESTINATION "${ZIG_STD_DEST}")
534install(FILES "${CMAKE_SOURCE_DIR}/std/elf.zig" DESTINATION "${ZIG_STD_DEST}")
535install(FILES "${CMAKE_SOURCE_DIR}/std/empty.zig" DESTINATION "${ZIG_STD_DEST}")
536install(FILES "${CMAKE_SOURCE_DIR}/std/endian.zig" DESTINATION "${ZIG_STD_DEST}")
537install(FILES "${CMAKE_SOURCE_DIR}/std/fmt/errol/enum3.zig" DESTINATION "${ZIG_STD_DEST}/fmt/errol")
538install(FILES "${CMAKE_SOURCE_DIR}/std/fmt/errol/index.zig" DESTINATION "${ZIG_STD_DEST}/fmt/errol")
539install(FILES "${CMAKE_SOURCE_DIR}/std/fmt/errol/lookup.zig" DESTINATION "${ZIG_STD_DEST}/fmt/errol")
540install(FILES "${CMAKE_SOURCE_DIR}/std/fmt/index.zig" DESTINATION "${ZIG_STD_DEST}/fmt")
541install(FILES "${CMAKE_SOURCE_DIR}/std/hash_map.zig" DESTINATION "${ZIG_STD_DEST}")
542install(FILES "${CMAKE_SOURCE_DIR}/std/heap.zig" DESTINATION "${ZIG_STD_DEST}")
543install(FILES "${CMAKE_SOURCE_DIR}/std/index.zig" DESTINATION "${ZIG_STD_DEST}")
544install(FILES "${CMAKE_SOURCE_DIR}/std/io.zig" DESTINATION "${ZIG_STD_DEST}")
545install(FILES "${CMAKE_SOURCE_DIR}/std/linked_list.zig" DESTINATION "${ZIG_STD_DEST}")
546install(FILES "${CMAKE_SOURCE_DIR}/std/math/acos.zig" DESTINATION "${ZIG_STD_DEST}/math")
547install(FILES "${CMAKE_SOURCE_DIR}/std/math/acosh.zig" DESTINATION "${ZIG_STD_DEST}/math")
548install(FILES "${CMAKE_SOURCE_DIR}/std/math/asin.zig" DESTINATION "${ZIG_STD_DEST}/math")
549install(FILES "${CMAKE_SOURCE_DIR}/std/math/asinh.zig" DESTINATION "${ZIG_STD_DEST}/math")
550install(FILES "${CMAKE_SOURCE_DIR}/std/math/atan.zig" DESTINATION "${ZIG_STD_DEST}/math")
551install(FILES "${CMAKE_SOURCE_DIR}/std/math/atan2.zig" DESTINATION "${ZIG_STD_DEST}/math")
552install(FILES "${CMAKE_SOURCE_DIR}/std/math/atanh.zig" DESTINATION "${ZIG_STD_DEST}/math")
553install(FILES "${CMAKE_SOURCE_DIR}/std/math/cbrt.zig" DESTINATION "${ZIG_STD_DEST}/math")
554install(FILES "${CMAKE_SOURCE_DIR}/std/math/ceil.zig" DESTINATION "${ZIG_STD_DEST}/math")
555install(FILES "${CMAKE_SOURCE_DIR}/std/math/copysign.zig" DESTINATION "${ZIG_STD_DEST}/math")
556install(FILES "${CMAKE_SOURCE_DIR}/std/math/cos.zig" DESTINATION "${ZIG_STD_DEST}/math")
557install(FILES "${CMAKE_SOURCE_DIR}/std/math/cosh.zig" DESTINATION "${ZIG_STD_DEST}/math")
558install(FILES "${CMAKE_SOURCE_DIR}/std/math/exp.zig" DESTINATION "${ZIG_STD_DEST}/math")
559install(FILES "${CMAKE_SOURCE_DIR}/std/math/exp2.zig" DESTINATION "${ZIG_STD_DEST}/math")
560install(FILES "${CMAKE_SOURCE_DIR}/std/math/expm1.zig" DESTINATION "${ZIG_STD_DEST}/math")
561install(FILES "${CMAKE_SOURCE_DIR}/std/math/expo2.zig" DESTINATION "${ZIG_STD_DEST}/math")
562install(FILES "${CMAKE_SOURCE_DIR}/std/math/fabs.zig" DESTINATION "${ZIG_STD_DEST}/math")
563install(FILES "${CMAKE_SOURCE_DIR}/std/math/floor.zig" DESTINATION "${ZIG_STD_DEST}/math")
564install(FILES "${CMAKE_SOURCE_DIR}/std/math/fma.zig" DESTINATION "${ZIG_STD_DEST}/math")
565install(FILES "${CMAKE_SOURCE_DIR}/std/math/frexp.zig" DESTINATION "${ZIG_STD_DEST}/math")
566install(FILES "${CMAKE_SOURCE_DIR}/std/math/hypot.zig" DESTINATION "${ZIG_STD_DEST}/math")
567install(FILES "${CMAKE_SOURCE_DIR}/std/math/ilogb.zig" DESTINATION "${ZIG_STD_DEST}/math")
568install(FILES "${CMAKE_SOURCE_DIR}/std/math/index.zig" DESTINATION "${ZIG_STD_DEST}/math")
569install(FILES "${CMAKE_SOURCE_DIR}/std/math/inf.zig" DESTINATION "${ZIG_STD_DEST}/math")
570install(FILES "${CMAKE_SOURCE_DIR}/std/math/isfinite.zig" DESTINATION "${ZIG_STD_DEST}/math")
571install(FILES "${CMAKE_SOURCE_DIR}/std/math/isinf.zig" DESTINATION "${ZIG_STD_DEST}/math")
572install(FILES "${CMAKE_SOURCE_DIR}/std/math/isnan.zig" DESTINATION "${ZIG_STD_DEST}/math")
573install(FILES "${CMAKE_SOURCE_DIR}/std/math/isnormal.zig" DESTINATION "${ZIG_STD_DEST}/math")
574install(FILES "${CMAKE_SOURCE_DIR}/std/math/ln.zig" DESTINATION "${ZIG_STD_DEST}/math")
575install(FILES "${CMAKE_SOURCE_DIR}/std/math/log.zig" DESTINATION "${ZIG_STD_DEST}/math")
576install(FILES "${CMAKE_SOURCE_DIR}/std/math/log10.zig" DESTINATION "${ZIG_STD_DEST}/math")
577install(FILES "${CMAKE_SOURCE_DIR}/std/math/log1p.zig" DESTINATION "${ZIG_STD_DEST}/math")
578install(FILES "${CMAKE_SOURCE_DIR}/std/math/log2.zig" DESTINATION "${ZIG_STD_DEST}/math")
579install(FILES "${CMAKE_SOURCE_DIR}/std/math/modf.zig" DESTINATION "${ZIG_STD_DEST}/math")
580install(FILES "${CMAKE_SOURCE_DIR}/std/math/nan.zig" DESTINATION "${ZIG_STD_DEST}/math")
581install(FILES "${CMAKE_SOURCE_DIR}/std/math/pow.zig" DESTINATION "${ZIG_STD_DEST}/math")
582install(FILES "${CMAKE_SOURCE_DIR}/std/math/round.zig" DESTINATION "${ZIG_STD_DEST}/math")
583install(FILES "${CMAKE_SOURCE_DIR}/std/math/scalbn.zig" DESTINATION "${ZIG_STD_DEST}/math")
584install(FILES "${CMAKE_SOURCE_DIR}/std/math/signbit.zig" DESTINATION "${ZIG_STD_DEST}/math")
585install(FILES "${CMAKE_SOURCE_DIR}/std/math/sin.zig" DESTINATION "${ZIG_STD_DEST}/math")
586install(FILES "${CMAKE_SOURCE_DIR}/std/math/sinh.zig" DESTINATION "${ZIG_STD_DEST}/math")
587install(FILES "${CMAKE_SOURCE_DIR}/std/math/sqrt.zig" DESTINATION "${ZIG_STD_DEST}/math")
588install(FILES "${CMAKE_SOURCE_DIR}/std/math/tan.zig" DESTINATION "${ZIG_STD_DEST}/math")
589install(FILES "${CMAKE_SOURCE_DIR}/std/math/tanh.zig" DESTINATION "${ZIG_STD_DEST}/math")
590install(FILES "${CMAKE_SOURCE_DIR}/std/math/trunc.zig" DESTINATION "${ZIG_STD_DEST}/math")
591install(FILES "${CMAKE_SOURCE_DIR}/std/mem.zig" DESTINATION "${ZIG_STD_DEST}")
592install(FILES "${CMAKE_SOURCE_DIR}/std/net.zig" DESTINATION "${ZIG_STD_DEST}")
593install(FILES "${CMAKE_SOURCE_DIR}/std/os/child_process.zig" DESTINATION "${ZIG_STD_DEST}/os")
594install(FILES "${CMAKE_SOURCE_DIR}/std/os/darwin.zig" DESTINATION "${ZIG_STD_DEST}/os")
595install(FILES "${CMAKE_SOURCE_DIR}/std/os/darwin_errno.zig" DESTINATION "${ZIG_STD_DEST}/os")
596install(FILES "${CMAKE_SOURCE_DIR}/std/os/get_user_id.zig" DESTINATION "${ZIG_STD_DEST}/os")
597install(FILES "${CMAKE_SOURCE_DIR}/std/os/index.zig" DESTINATION "${ZIG_STD_DEST}/os")
598install(FILES "${CMAKE_SOURCE_DIR}/std/os/linux.zig" DESTINATION "${ZIG_STD_DEST}/os")
599install(FILES "${CMAKE_SOURCE_DIR}/std/os/linux_errno.zig" DESTINATION "${ZIG_STD_DEST}/os")
600install(FILES "${CMAKE_SOURCE_DIR}/std/os/linux_i386.zig" DESTINATION "${ZIG_STD_DEST}/os")
601install(FILES "${CMAKE_SOURCE_DIR}/std/os/linux_x86_64.zig" DESTINATION "${ZIG_STD_DEST}/os")
602install(FILES "${CMAKE_SOURCE_DIR}/std/os/path.zig" DESTINATION "${ZIG_STD_DEST}/os")
603install(FILES "${CMAKE_SOURCE_DIR}/std/os/windows/error.zig" DESTINATION "${ZIG_STD_DEST}/os/windows")
604install(FILES "${CMAKE_SOURCE_DIR}/std/os/windows/index.zig" DESTINATION "${ZIG_STD_DEST}/os/windows")
605install(FILES "${CMAKE_SOURCE_DIR}/std/os/windows/util.zig" DESTINATION "${ZIG_STD_DEST}/os/windows")
606install(FILES "${CMAKE_SOURCE_DIR}/std/rand.zig" DESTINATION "${ZIG_STD_DEST}")
607install(FILES "${CMAKE_SOURCE_DIR}/std/sort.zig" DESTINATION "${ZIG_STD_DEST}")
608install(FILES "${CMAKE_SOURCE_DIR}/std/unicode.zig" DESTINATION "${ZIG_STD_DEST}")
609install(FILES "${CMAKE_SOURCE_DIR}/std/special/bootstrap.zig" DESTINATION "${ZIG_STD_DEST}/special")
610install(FILES "${CMAKE_SOURCE_DIR}/std/special/bootstrap_lib.zig" DESTINATION "${ZIG_STD_DEST}/special")
611install(FILES "${CMAKE_SOURCE_DIR}/std/special/build_file_template.zig" DESTINATION "${ZIG_STD_DEST}/special")
612install(FILES "${CMAKE_SOURCE_DIR}/std/special/build_runner.zig" DESTINATION "${ZIG_STD_DEST}/special")
613install(FILES "${CMAKE_SOURCE_DIR}/std/special/builtin.zig" DESTINATION "${ZIG_STD_DEST}/special")
614install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/aulldiv.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
615install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/aullrem.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
616install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/comparetf2.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
617install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixuint.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
618install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixunsdfdi.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
619install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixunsdfsi.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
620install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixunsdfti.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
621install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixunssfdi.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
622install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixunssfsi.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
623install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixunssfti.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
624install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixunstfdi.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
625install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixunstfsi.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
626install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/fixunstfti.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
627install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/index.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
628install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/udivmod.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
629install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/udivmoddi4.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
630install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/udivmodti4.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
631install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/udivti3.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
632install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/umodti3.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
633install(FILES "${CMAKE_SOURCE_DIR}/std/special/panic.zig" DESTINATION "${ZIG_STD_DEST}/special")
634install(FILES "${CMAKE_SOURCE_DIR}/std/special/test_runner.zig" DESTINATION "${ZIG_STD_DEST}/special")
README.md+1
...@@ -154,6 +154,7 @@ make install...@@ -154,6 +154,7 @@ make install
154`ZIG_LIBC_LIB_DIR` and `ZIG_LIBC_STATIC_LIB_DIR` are unused.154`ZIG_LIBC_LIB_DIR` and `ZIG_LIBC_STATIC_LIB_DIR` are unused.
155155
156```156```
157brew install cmake
157brew install llvm@6158brew install llvm@6
158brew outdated llvm@6 || brew upgrade llvm@6159brew outdated llvm@6 || brew upgrade llvm@6
159mkdir build160mkdir build
build.zig+51-133
...@@ -33,26 +33,40 @@ pub fn build(b: &Builder) {...@@ -33,26 +33,40 @@ pub fn build(b: &Builder) {
33 docs_step.dependOn(&docgen_cmd.step);33 docs_step.dependOn(&docgen_cmd.step);
34 docs_step.dependOn(&docgen_home_cmd.step);34 docs_step.dependOn(&docgen_home_cmd.step);
3535
36 const test_step = b.step("test", "Run all the tests");
37
36 if (findLLVM(b)) |llvm| {38 if (findLLVM(b)) |llvm| {
37 // find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library39 // find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library
38 const build_info = b.exec([][]const u8{b.zig_exe, "BUILD_INFO"});40 const build_info = b.exec([][]const u8{b.zig_exe, "BUILD_INFO"});
39 var build_info_it = mem.split(build_info, "\n");41 var index: usize = 0;
40 const cmake_binary_dir = ??build_info_it.next();42 const cmake_binary_dir = nextValue(&index, build_info);
41 const cxx_compiler = ??build_info_it.next();43 const cxx_compiler = nextValue(&index, build_info);
44 const lld_include_dir = nextValue(&index, build_info);
45 const lld_libraries = nextValue(&index, build_info);
46 const std_files = nextValue(&index, build_info);
47 const c_header_files = nextValue(&index, build_info);
4248
43 var exe = b.addExecutable("zig", "src-self-hosted/main.zig");49 var exe = b.addExecutable("zig", "src-self-hosted/main.zig");
44 exe.setBuildMode(mode);50 exe.setBuildMode(mode);
45 exe.addIncludeDir("src");51 exe.addIncludeDir("src");
46 exe.addIncludeDir(cmake_binary_dir);52 exe.addIncludeDir(cmake_binary_dir);
47 addCppLib(b, exe, cmake_binary_dir, "libzig_cpp");53 addCppLib(b, exe, cmake_binary_dir, "zig_cpp");
48 addCppLib(b, exe, cmake_binary_dir, "libembedded_lld_elf");54 if (lld_include_dir.len != 0) {
49 addCppLib(b, exe, cmake_binary_dir, "libembedded_lld_coff");55 exe.addIncludeDir(lld_include_dir);
50 addCppLib(b, exe, cmake_binary_dir, "libembedded_lld_lib");56 var it = mem.split(lld_libraries, ";");
57 while (it.next()) |lib| {
58 exe.addObjectFile(lib);
59 }
60 } else {
61 addCppLib(b, exe, cmake_binary_dir, "embedded_lld_elf");
62 addCppLib(b, exe, cmake_binary_dir, "embedded_lld_coff");
63 addCppLib(b, exe, cmake_binary_dir, "embedded_lld_lib");
64 }
51 dependOnLib(exe, llvm);65 dependOnLib(exe, llvm);
5266
53 if (!exe.target.isWindows()) {67 if (!exe.target.isWindows()) {
54 const libstdcxx_path_padded = b.exec([][]const u8{cxx_compiler, "-print-file-name=libstdc++.a"});68 const libstdcxx_path_padded = b.exec([][]const u8{cxx_compiler, "-print-file-name=libstdc++.a"});
55 const libstdcxx_path = ??mem.split(libstdcxx_path_padded, "\n").next();69 const libstdcxx_path = ??mem.split(libstdcxx_path_padded, "\r\n").next();
56 exe.addObjectFile(libstdcxx_path);70 exe.addObjectFile(libstdcxx_path);
5771
58 exe.linkSystemLibrary("pthread");72 exe.linkSystemLibrary("pthread");
...@@ -62,15 +76,17 @@ pub fn build(b: &Builder) {...@@ -62,15 +76,17 @@ pub fn build(b: &Builder) {
6276
63 b.default_step.dependOn(&exe.step);77 b.default_step.dependOn(&exe.step);
64 b.default_step.dependOn(docs_step);78 b.default_step.dependOn(docs_step);
79 test_step.dependOn(&exe.step);
6580
66 b.installArtifact(exe);81 b.installArtifact(exe);
67 installStdLib(b);82 installStdLib(b, std_files);
83 installCHeaders(b, c_header_files);
84
68 }85 }
6986
7087
71 const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");88 const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");
72 const with_lldb = b.option(bool, "with-lldb", "Run tests in LLDB to get a backtrace if one fails") ?? false;89 const with_lldb = b.option(bool, "with-lldb", "Run tests in LLDB to get a backtrace if one fails") ?? false;
73 const test_step = b.step("test", "Run all the tests");
7490
75 test_step.dependOn(docs_step);91 test_step.dependOn(docs_step);
7692
...@@ -114,8 +130,9 @@ fn dependOnLib(lib_exe_obj: &std.build.LibExeObjStep, dep: &const LibraryDep) {...@@ -114,8 +130,9 @@ fn dependOnLib(lib_exe_obj: &std.build.LibExeObjStep, dep: &const LibraryDep) {
114}130}
115131
116fn addCppLib(b: &Builder, lib_exe_obj: &std.build.LibExeObjStep, cmake_binary_dir: []const u8, lib_name: []const u8) {132fn addCppLib(b: &Builder, lib_exe_obj: &std.build.LibExeObjStep, cmake_binary_dir: []const u8, lib_name: []const u8) {
133 const lib_prefix = if (lib_exe_obj.target.isWindows()) "" else "lib";
117 lib_exe_obj.addObjectFile(%%os.path.join(b.allocator, cmake_binary_dir, "zig_cpp",134 lib_exe_obj.addObjectFile(%%os.path.join(b.allocator, cmake_binary_dir, "zig_cpp",
118 b.fmt("{}{}", lib_name, lib_exe_obj.target.libFileExt())));135 b.fmt("{}{}{}", lib_prefix, lib_name, lib_exe_obj.target.libFileExt())));
119}136}
120137
121const LibraryDep = struct {138const LibraryDep = struct {
...@@ -150,7 +167,7 @@ fn findLLVM(b: &Builder) -> ?LibraryDep {...@@ -150,7 +167,7 @@ fn findLLVM(b: &Builder) -> ?LibraryDep {
150 .libdirs = ArrayList([]const u8).init(b.allocator),167 .libdirs = ArrayList([]const u8).init(b.allocator),
151 };168 };
152 {169 {
153 var it = mem.split(libs_output, " \n");170 var it = mem.split(libs_output, " \r\n");
154 while (it.next()) |lib_arg| {171 while (it.next()) |lib_arg| {
155 if (mem.startsWith(u8, lib_arg, "-l")) {172 if (mem.startsWith(u8, lib_arg, "-l")) {
156 %%result.system_libs.append(lib_arg[2..]);173 %%result.system_libs.append(lib_arg[2..]);
...@@ -164,7 +181,7 @@ fn findLLVM(b: &Builder) -> ?LibraryDep {...@@ -164,7 +181,7 @@ fn findLLVM(b: &Builder) -> ?LibraryDep {
164 }181 }
165 }182 }
166 {183 {
167 var it = mem.split(includes_output, " \n");184 var it = mem.split(includes_output, " \r\n");
168 while (it.next()) |include_arg| {185 while (it.next()) |include_arg| {
169 if (mem.startsWith(u8, include_arg, "-I")) {186 if (mem.startsWith(u8, include_arg, "-I")) {
170 %%result.includes.append(include_arg[2..]);187 %%result.includes.append(include_arg[2..]);
...@@ -174,7 +191,7 @@ fn findLLVM(b: &Builder) -> ?LibraryDep {...@@ -174,7 +191,7 @@ fn findLLVM(b: &Builder) -> ?LibraryDep {
174 }191 }
175 }192 }
176 {193 {
177 var it = mem.split(libdir_output, " \n");194 var it = mem.split(libdir_output, " \r\n");
178 while (it.next()) |libdir| {195 while (it.next()) |libdir| {
179 if (mem.startsWith(u8, libdir, "-L")) {196 if (mem.startsWith(u8, libdir, "-L")) {
180 %%result.libdirs.append(libdir[2..]);197 %%result.libdirs.append(libdir[2..]);
...@@ -186,127 +203,28 @@ fn findLLVM(b: &Builder) -> ?LibraryDep {...@@ -186,127 +203,28 @@ fn findLLVM(b: &Builder) -> ?LibraryDep {
186 return result;203 return result;
187}204}
188205
189pub fn installStdLib(b: &Builder) {206pub fn installStdLib(b: &Builder, stdlib_files: []const u8) {
190 const stdlib_files = []const []const u8 {207 var it = mem.split(stdlib_files, ";");
191 "array_list.zig",208 while (it.next()) |stdlib_file| {
192 "base64.zig",
193 "buf_map.zig",
194 "buf_set.zig",
195 "buffer.zig",
196 "build.zig",
197 "c/darwin.zig",
198 "c/index.zig",
199 "c/linux.zig",
200 "c/windows.zig",
201 "cstr.zig",
202 "debug/failing_allocator.zig",
203 "debug/index.zig",
204 "dwarf.zig",
205 "elf.zig",
206 "empty.zig",
207 "endian.zig",
208 "fmt/errol/enum3.zig",
209 "fmt/errol/index.zig",
210 "fmt/errol/lookup.zig",
211 "fmt/index.zig",
212 "hash_map.zig",
213 "heap.zig",
214 "index.zig",
215 "io.zig",
216 "linked_list.zig",
217 "math/acos.zig",
218 "math/acosh.zig",
219 "math/asin.zig",
220 "math/asinh.zig",
221 "math/atan.zig",
222 "math/atan2.zig",
223 "math/atanh.zig",
224 "math/cbrt.zig",
225 "math/ceil.zig",
226 "math/copysign.zig",
227 "math/cos.zig",
228 "math/cosh.zig",
229 "math/exp.zig",
230 "math/exp2.zig",
231 "math/expm1.zig",
232 "math/expo2.zig",
233 "math/fabs.zig",
234 "math/floor.zig",
235 "math/fma.zig",
236 "math/frexp.zig",
237 "math/hypot.zig",
238 "math/ilogb.zig",
239 "math/index.zig",
240 "math/inf.zig",
241 "math/isfinite.zig",
242 "math/isinf.zig",
243 "math/isnan.zig",
244 "math/isnormal.zig",
245 "math/ln.zig",
246 "math/log.zig",
247 "math/log10.zig",
248 "math/log1p.zig",
249 "math/log2.zig",
250 "math/modf.zig",
251 "math/nan.zig",
252 "math/pow.zig",
253 "math/round.zig",
254 "math/scalbn.zig",
255 "math/signbit.zig",
256 "math/sin.zig",
257 "math/sinh.zig",
258 "math/sqrt.zig",
259 "math/tan.zig",
260 "math/tanh.zig",
261 "math/trunc.zig",
262 "mem.zig",
263 "net.zig",
264 "os/child_process.zig",
265 "os/darwin.zig",
266 "os/darwin_errno.zig",
267 "os/get_user_id.zig",
268 "os/index.zig",
269 "os/linux.zig",
270 "os/linux_errno.zig",
271 "os/linux_i386.zig",
272 "os/linux_x86_64.zig",
273 "os/path.zig",
274 "os/windows/error.zig",
275 "os/windows/index.zig",
276 "os/windows/util.zig",
277 "rand.zig",
278 "sort.zig",
279 "unicode.zig",
280 "special/bootstrap.zig",
281 "special/bootstrap_lib.zig",
282 "special/build_file_template.zig",
283 "special/build_runner.zig",
284 "special/builtin.zig",
285 "special/compiler_rt/aulldiv.zig",
286 "special/compiler_rt/aullrem.zig",
287 "special/compiler_rt/comparetf2.zig",
288 "special/compiler_rt/fixuint.zig",
289 "special/compiler_rt/fixunsdfdi.zig",
290 "special/compiler_rt/fixunsdfsi.zig",
291 "special/compiler_rt/fixunsdfti.zig",
292 "special/compiler_rt/fixunssfdi.zig",
293 "special/compiler_rt/fixunssfsi.zig",
294 "special/compiler_rt/fixunssfti.zig",
295 "special/compiler_rt/fixunstfdi.zig",
296 "special/compiler_rt/fixunstfsi.zig",
297 "special/compiler_rt/fixunstfti.zig",
298 "special/compiler_rt/index.zig",
299 "special/compiler_rt/udivmod.zig",
300 "special/compiler_rt/udivmoddi4.zig",
301 "special/compiler_rt/udivmodti4.zig",
302 "special/compiler_rt/udivti3.zig",
303 "special/compiler_rt/umodti3.zig",
304 "special/panic.zig",
305 "special/test_runner.zig",
306 };
307 for (stdlib_files) |stdlib_file| {
308 const src_path = %%os.path.join(b.allocator, "std", stdlib_file);209 const src_path = %%os.path.join(b.allocator, "std", stdlib_file);
309 const dest_path = %%os.path.join(b.allocator, "lib", "zig", "std", stdlib_file);210 const dest_path = %%os.path.join(b.allocator, "lib", "zig", "std", stdlib_file);
310 b.installFile(src_path, dest_path);211 b.installFile(src_path, dest_path);
311 }212 }
312}213}
214
215pub fn installCHeaders(b: &Builder, c_header_files: []const u8) {
216 var it = mem.split(c_header_files, ";");
217 while (it.next()) |c_header_file| {
218 const src_path = %%os.path.join(b.allocator, "c_headers", c_header_file);
219 const dest_path = %%os.path.join(b.allocator, "lib", "zig", "include", c_header_file);
220 b.installFile(src_path, dest_path);
221 }
222}
223
224fn nextValue(index: &usize, build_info: []const u8) -> []const u8 {
225 const start = *index;
226 while (build_info[*index] != '\n' and build_info[*index] != '\r') : (*index += 1) { }
227 const result = build_info[start..*index];
228 *index += 1;
229 return result;
230}
doc/langref.html.in+33-4
...@@ -34,6 +34,7 @@...@@ -34,6 +34,7 @@
34 <ul>34 <ul>
35 <li><a href="#introduction">Introduction</a></li>35 <li><a href="#introduction">Introduction</a></li>
36 <li><a href="#hello-world">Hello World</a></li>36 <li><a href="#hello-world">Hello World</a></li>
37 <li><a href="#source-encoding">Source Encoding</a></li>
37 <li><a href="#values">Values</a></li>38 <li><a href="#values">Values</a></li>
38 <ul>39 <ul>
39 <li><a href="#primitive-types">Primitive Types</a></li>40 <li><a href="#primitive-types">Primitive Types</a></li>
...@@ -138,6 +139,7 @@...@@ -138,6 +139,7 @@
138 <li><a href="#builtin-embedFile">@embedFile</a></li>139 <li><a href="#builtin-embedFile">@embedFile</a></li>
139 <li><a href="#builtin-export">@export</a></li>140 <li><a href="#builtin-export">@export</a></li>
140 <li><a href="#builtin-tagName">@tagName</a></li>141 <li><a href="#builtin-tagName">@tagName</a></li>
142 <li><a href="#builtin-TagType">@TagType</a></li>
141 <li><a href="#builtin-EnumTagType">@EnumTagType</a></li>143 <li><a href="#builtin-EnumTagType">@EnumTagType</a></li>
142 <li><a href="#builtin-errorName">@errorName</a></li>144 <li><a href="#builtin-errorName">@errorName</a></li>
143 <li><a href="#builtin-fence">@fence</a></li>145 <li><a href="#builtin-fence">@fence</a></li>
...@@ -156,6 +158,7 @@...@@ -156,6 +158,7 @@
156 <li><a href="#builtin-minValue">@minValue</a></li>158 <li><a href="#builtin-minValue">@minValue</a></li>
157 <li><a href="#builtin-mod">@mod</a></li>159 <li><a href="#builtin-mod">@mod</a></li>
158 <li><a href="#builtin-mulWithOverflow">@mulWithOverflow</a></li>160 <li><a href="#builtin-mulWithOverflow">@mulWithOverflow</a></li>
161 <li><a href="#builtin-noInlineCall">@noInlineCall</a></li>
159 <li><a href="#builtin-offsetOf">@offsetOf</a></li>162 <li><a href="#builtin-offsetOf">@offsetOf</a></li>
160 <li><a href="#builtin-OpaqueType">@OpaqueType</a></li>163 <li><a href="#builtin-OpaqueType">@OpaqueType</a></li>
161 <li><a href="#builtin-panic">@panic</a></li>164 <li><a href="#builtin-panic">@panic</a></li>
...@@ -291,7 +294,7 @@ pub fn main() -&gt; %void {...@@ -291,7 +294,7 @@ pub fn main() -&gt; %void {
291 <li><a href="#errors">Errors</a></li>294 <li><a href="#errors">Errors</a></li>
292 <li><a href="#root-source-file">Root Source File</a></li>295 <li><a href="#root-source-file">Root Source File</a></li>
293 </ul>296 </ul>
294 <h2 id="values">Source encoding</h2>297 <h2 id="source-encoding">Source Encoding</h2>
295 <p>Zig source code is encoded in UTF-8. An invalid UTF-8 byte sequence results in a compile error.</p>298 <p>Zig source code is encoded in UTF-8. An invalid UTF-8 byte sequence results in a compile error.</p>
296 <p>Throughout all zig source code (including in comments), some codepoints are never allowed:</p>299 <p>Throughout all zig source code (including in comments), some codepoints are never allowed:</p>
297 <ul>300 <ul>
...@@ -4387,10 +4390,13 @@ test.zig:6:2: error: found compile log statement...@@ -4387,10 +4390,13 @@ test.zig:6:2: error: found compile log statement
4387 <p>4390 <p>
4388 Converts an enum value or union value to a slice of bytes representing the name.4391 Converts an enum value or union value to a slice of bytes representing the name.
4389 </p>4392 </p>
4390 <h3 id="builtin-EnumTagType">@EnumTagType</h3>4393 <h3 id="builtin-TagType">@TagType</h3>
4391 <pre><code class="zig">@EnumTagType(T: type) -&gt; type</code></pre>4394 <pre><code class="zig">@TagType(T: type) -&gt; type</code></pre>
4392 <p>4395 <p>
4393 Returns the integer type that is used to store the enumeration value.4396 For an enum, returns the integer type that is used to store the enumeration value.
4397 </p>
4398 <p>
4399 For a union, returns the enum type that is used to store the tag value.
4394 </p>4400 </p>
4395 <h3 id="builtin-errorName">@errorName</h3>4401 <h3 id="builtin-errorName">@errorName</h3>
4396 <pre><code class="zig">@errorName(err: error) -&gt; []u8</code></pre>4402 <pre><code class="zig">@errorName(err: error) -&gt; []u8</code></pre>
...@@ -4476,6 +4482,10 @@ fn add(a: i32, b: i32) -&gt; i32 { a + b }</code></pre>...@@ -4476,6 +4482,10 @@ fn add(a: i32, b: i32) -&gt; i32 { a + b }</code></pre>
4476 Unlike a normal function call, however, <code>@inlineCall</code> guarantees that the call4482 Unlike a normal function call, however, <code>@inlineCall</code> guarantees that the call
4477 will be inlined. If the call cannot be inlined, a compile error is emitted.4483 will be inlined. If the call cannot be inlined, a compile error is emitted.
4478 </p>4484 </p>
4485 <p>See also:</p>
4486 <ul>
4487 <li><a href="#builtin-noInlineCall">@noInlineCall</a></li>
4488 </ul>
4479 <h3 id="builtin-intToPtr">@intToPtr</h3>4489 <h3 id="builtin-intToPtr">@intToPtr</h3>
4480 <pre><code class="zig">@intToPtr(comptime DestType: type, int: usize) -&gt; DestType</code></pre>4490 <pre><code class="zig">@intToPtr(comptime DestType: type, int: usize) -&gt; DestType</code></pre>
4481 <p>4491 <p>
...@@ -4569,6 +4579,25 @@ mem.set(u8, dest, c);</code></pre>...@@ -4569,6 +4579,25 @@ mem.set(u8, dest, c);</code></pre>
4569 stores the overflowed bits in <code>result</code> and returns <code>true</code>.4579 stores the overflowed bits in <code>result</code> and returns <code>true</code>.
4570 If no overflow or underflow occurs, returns <code>false</code>.4580 If no overflow or underflow occurs, returns <code>false</code>.
4571 </p>4581 </p>
4582 <h3 id="builtin-noInlineCall">@noInlineCall</h3>
4583 <pre><code class="zig">@noInlineCall(function: var, args: ...) -&gt; var</code></pre>
4584 <p>
4585 This calls a function, in the same way that invoking an expression with parentheses does:
4586 </p>
4587 <pre><code class="zig">const assert = @import("std").debug.assert;
4588test "noinline function call" {
4589 assert(@noInlineCall(add, 3, 9) == 12);
4590}
4591
4592fn add(a: i32, b: i32) -&gt; i32 { a + b }</code></pre>
4593 <p>
4594 Unlike a normal function call, however, <code>@noInlineCall</code> guarantees that the call
4595 will not be inlined. If the call must be inlined, a compile error is emitted.
4596 </p>
4597 <p>See also:</p>
4598 <ul>
4599 <li><a href="#builtin-inlineCall">@inlineCall</a></li>
4600 </ul>
4572 <h3 id="builtin-offsetOf">@offsetOf</h3>4601 <h3 id="builtin-offsetOf">@offsetOf</h3>
4573 <pre><code class="zig">@offsetOf(comptime T: type, comptime field_name: [] const u8) -&gt; (number literal)</code></pre>4602 <pre><code class="zig">@offsetOf(comptime T: type, comptime field_name: [] const u8) -&gt; (number literal)</code></pre>
4574 <p>4603 <p>
src-self-hosted/c.zig+1
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1pub use @cImport({1pub use @cImport({
2 @cInclude("inttypes.h");
2 @cInclude("config.h");3 @cInclude("config.h");
3 @cInclude("zig_llvm.h");4 @cInclude("zig_llvm.h");
4});5});
src-self-hosted/main.zig+5
...@@ -626,3 +626,8 @@ fn findZigLibDir(allocator: &mem.Allocator) -> %[]u8 {...@@ -626,3 +626,8 @@ fn findZigLibDir(allocator: &mem.Allocator) -> %[]u8 {
626626
627 return error.FileNotFound;627 return error.FileNotFound;
628}628}
629
630test "import tests" {
631 _ = @import("tokenizer.zig");
632 _ = @import("parser.zig");
633}
src-self-hosted/tokenizer.zig+13-2
...@@ -204,6 +204,7 @@ pub const Tokenizer = struct {...@@ -204,6 +204,7 @@ pub const Tokenizer = struct {
204 LineComment,204 LineComment,
205 Zero,205 Zero,
206 IntegerLiteral,206 IntegerLiteral,
207 IntegerLiteralWithRadix,
207 NumberDot,208 NumberDot,
208 FloatFraction,209 FloatFraction,
209 FloatExponentUnsigned,210 FloatExponentUnsigned,
...@@ -454,7 +455,7 @@ pub const Tokenizer = struct {...@@ -454,7 +455,7 @@ pub const Tokenizer = struct {
454 },455 },
455 State.Zero => switch (c) {456 State.Zero => switch (c) {
456 'b', 'o', 'x' => {457 'b', 'o', 'x' => {
457 state = State.IntegerLiteral;458 state = State.IntegerLiteralWithRadix;
458 },459 },
459 else => {460 else => {
460 // reinterpret as a normal number461 // reinterpret as a normal number
...@@ -469,6 +470,16 @@ pub const Tokenizer = struct {...@@ -469,6 +470,16 @@ pub const Tokenizer = struct {
469 'p', 'P', 'e', 'E' => {470 'p', 'P', 'e', 'E' => {
470 state = State.FloatExponentUnsigned;471 state = State.FloatExponentUnsigned;
471 },472 },
473 '0'...'9' => {},
474 else => break,
475 },
476 State.IntegerLiteralWithRadix => switch (c) {
477 '.' => {
478 state = State.NumberDot;
479 },
480 'p', 'P' => {
481 state = State.FloatExponentUnsigned;
482 },
472 '0'...'9', 'a'...'f', 'A'...'F' => {},483 '0'...'9', 'a'...'f', 'A'...'F' => {},
473 else => break,484 else => break,
474 },485 },
...@@ -485,7 +496,7 @@ pub const Tokenizer = struct {...@@ -485,7 +496,7 @@ pub const Tokenizer = struct {
485 },496 },
486 },497 },
487 State.FloatFraction => switch (c) {498 State.FloatFraction => switch (c) {
488 'p', 'P', 'e', 'E' => {499 'p', 'P' => {
489 state = State.FloatExponentUnsigned;500 state = State.FloatExponentUnsigned;
490 },501 },
491 '0'...'9', 'a'...'f', 'A'...'F' => {},502 '0'...'9', 'a'...'f', 'A'...'F' => {},
src/config.h.in+4
...@@ -27,5 +27,9 @@...@@ -27,5 +27,9 @@
27// Used for communicating build information to self hosted build.27// Used for communicating build information to self hosted build.
28#define ZIG_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@"28#define ZIG_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@"
29#define ZIG_CXX_COMPILER "@CMAKE_CXX_COMPILER@"29#define ZIG_CXX_COMPILER "@CMAKE_CXX_COMPILER@"
30#define ZIG_LLD_INCLUDE_PATH "@LLD_INCLUDE_DIRS@"
31#define ZIG_LLD_LIBRARIES "@LLD_LIBRARIES@"
32#define ZIG_STD_FILES "@ZIG_STD_FILES@"
33#define ZIG_C_HEADER_FILES "@ZIG_C_HEADER_FILES@"
3034
31#endif35#endif
src/link.cpp+4-2
...@@ -426,8 +426,7 @@ static void construct_linker_job_coff(LinkJob *lj) {...@@ -426,8 +426,7 @@ static void construct_linker_job_coff(LinkJob *lj) {
426 if (g->is_static) {426 if (g->is_static) {
427 Buf *cmt_lib_name = buf_sprintf("libcmt%s.lib", d_str);427 Buf *cmt_lib_name = buf_sprintf("libcmt%s.lib", d_str);
428 lj->args.append(buf_ptr(cmt_lib_name));428 lj->args.append(buf_ptr(cmt_lib_name));
429 }429 } else {
430 else {
431 Buf *msvcrt_lib_name = buf_sprintf("msvcrt%s.lib", d_str);430 Buf *msvcrt_lib_name = buf_sprintf("msvcrt%s.lib", d_str);
432 lj->args.append(buf_ptr(msvcrt_lib_name));431 lj->args.append(buf_ptr(msvcrt_lib_name));
433 }432 }
...@@ -452,6 +451,9 @@ static void construct_linker_job_coff(LinkJob *lj) {...@@ -452,6 +451,9 @@ static void construct_linker_job_coff(LinkJob *lj) {
452 // }451 // }
453 //}452 //}
454 //lj->args.append(get_libc_static_file(g, "crtbegin.o"));453 //lj->args.append(get_libc_static_file(g, "crtbegin.o"));
454
455 // msvcrt depends on kernel32
456 lj->args.append("kernel32.lib");
455 } else {457 } else {
456 lj->args.append("-NODEFAULTLIB");458 lj->args.append("-NODEFAULTLIB");
457 if (!is_library) {459 if (!is_library) {
src/main.cpp+7-1
...@@ -267,7 +267,13 @@ static void add_package(CodeGen *g, CliPkg *cli_pkg, PackageTableEntry *pkg) {...@@ -267,7 +267,13 @@ static void add_package(CodeGen *g, CliPkg *cli_pkg, PackageTableEntry *pkg) {
267267
268int main(int argc, char **argv) {268int main(int argc, char **argv) {
269 if (argc == 2 && strcmp(argv[1], "BUILD_INFO") == 0) {269 if (argc == 2 && strcmp(argv[1], "BUILD_INFO") == 0) {
270 printf("%s\n%s\n", ZIG_CMAKE_BINARY_DIR, ZIG_CXX_COMPILER);270 printf("%s\n%s\n%s\n%s\n%s\n%s\n",
271 ZIG_CMAKE_BINARY_DIR,
272 ZIG_CXX_COMPILER,
273 ZIG_LLD_INCLUDE_PATH,
274 ZIG_LLD_LIBRARIES,
275 ZIG_STD_FILES,
276 ZIG_C_HEADER_FILES);
271 return 0;277 return 0;
272 }278 }
273279
src/parser.cpp+1-1
...@@ -2552,7 +2552,7 @@ static AstNode *ast_parse_container_decl(ParseContext *pc, size_t *token_index,...@@ -2552,7 +2552,7 @@ static AstNode *ast_parse_container_decl(ParseContext *pc, size_t *token_index,
2552 Token *eq_token = &pc->tokens->at(*token_index);2552 Token *eq_token = &pc->tokens->at(*token_index);
2553 if (eq_token->id == TokenIdEq) {2553 if (eq_token->id == TokenIdEq) {
2554 *token_index += 1;2554 *token_index += 1;
2555 field_node->data.struct_field.value = ast_parse_prefix_op_expr(pc, token_index, true);2555 field_node->data.struct_field.value = ast_parse_expression(pc, token_index, true);
2556 }2556 }
25572557
2558 Token *next_token = &pc->tokens->at(*token_index);2558 Token *next_token = &pc->tokens->at(*token_index);
std/buffer.zig+5-4
...@@ -112,11 +112,12 @@ pub const Buffer = struct {...@@ -112,11 +112,12 @@ pub const Buffer = struct {
112 // TODO: remove, use OutStream for this112 // TODO: remove, use OutStream for this
113 pub fn appendByteNTimes(self: &Buffer, byte: u8, count: usize) -> %void {113 pub fn appendByteNTimes(self: &Buffer, byte: u8, count: usize) -> %void {
114 var prev_size: usize = self.len();114 var prev_size: usize = self.len();
115 %return self.resize(prev_size + count);115 const new_size = prev_size + count;
116 %return self.resize(new_size);
116117
117 var i: usize = 0;118 var i: usize = prev_size;
118 while (i < count) : (i += 1) {119 while (i < new_size) : (i += 1) {
119 self.list.items[prev_size + i] = byte;120 self.list.items[i] = byte;
120 }121 }
121 }122 }
122123
std/os/index.zig+2-2
...@@ -851,7 +851,7 @@ pub fn makePath(allocator: &Allocator, full_path: []const u8) -> %void {...@@ -851,7 +851,7 @@ pub fn makePath(allocator: &Allocator, full_path: []const u8) -> %void {
851 // march end_index backward until next path component851 // march end_index backward until next path component
852 while (true) {852 while (true) {
853 end_index -= 1;853 end_index -= 1;
854 if (resolved_path[end_index] == '/')854 if (os.path.isSep(resolved_path[end_index]))
855 break;855 break;
856 }856 }
857 continue;857 continue;
...@@ -864,7 +864,7 @@ pub fn makePath(allocator: &Allocator, full_path: []const u8) -> %void {...@@ -864,7 +864,7 @@ pub fn makePath(allocator: &Allocator, full_path: []const u8) -> %void {
864 // march end_index forward until next path component864 // march end_index forward until next path component
865 while (true) {865 while (true) {
866 end_index += 1;866 end_index += 1;
867 if (end_index == resolved_path.len or resolved_path[end_index] == '/')867 if (end_index == resolved_path.len or os.path.isSep(resolved_path[end_index]))
868 break;868 break;
869 }869 }
870 }870 }
std/os/path.zig+8
...@@ -22,6 +22,14 @@ pub const delimiter = if (is_windows) delimiter_windows else delimiter_posix;...@@ -22,6 +22,14 @@ pub const delimiter = if (is_windows) delimiter_windows else delimiter_posix;
2222
23const is_windows = builtin.os == builtin.Os.windows;23const is_windows = builtin.os == builtin.Os.windows;
2424
25pub fn isSep(byte: u8) -> bool {
26 if (is_windows) {
27 return byte == '/' or byte == '\\';
28 } else {
29 return byte == '/';
30 }
31}
32
25/// Naively combines a series of paths with the native path seperator.33/// Naively combines a series of paths with the native path seperator.
26/// Allocates memory for the result, which must be freed by the caller.34/// Allocates memory for the result, which must be freed by the caller.
27pub fn join(allocator: &Allocator, paths: ...) -> %[]u8 {35pub fn join(allocator: &Allocator, paths: ...) -> %[]u8 {
test/cases/enum.zig+10
...@@ -377,3 +377,13 @@ test "switch on enum with one member is comptime known" {...@@ -377,3 +377,13 @@ test "switch on enum with one member is comptime known" {
377 }377 }
378 @compileError("analysis should not reach here");378 @compileError("analysis should not reach here");
379}379}
380
381const EnumWithTagValues = enum(u4) {
382 A = 1 << 0,
383 B = 1 << 1,
384 C = 1 << 2,
385 D = 1 << 3,
386};
387test "enum with tag values don't require parens" {
388 assert(u4(EnumWithTagValues.C) == 0b0100);
389}
test/cases/misc.zig+6
...@@ -571,3 +571,9 @@ fn testComptimeIfInsideRuntimeWhileWhichUnconditionallyBreaks(cond: bool) {...@@ -571,3 +571,9 @@ fn testComptimeIfInsideRuntimeWhileWhichUnconditionallyBreaks(cond: bool) {
571 break;571 break;
572 }572 }
573}573}
574
575test "implicit comptime while" {
576 while (false) {
577 @compileError("bad");
578 }
579}