aboutsummaryrefslogtreecommitdiff
path: root/src/error.cpp
AgeCommit message (Collapse)Author
2020-02-19remove the concept of "sub-architecture"Andrew Kelley
in favor of CPU features. Also rearrange the `std.Target` data structure. * note: `@import("builtin")` was already deprecated in favor of `@import("std").builtin`. * `std.builtin.arch` is now deprecated in favor of `std.builtin.cpu.arch`. * `std.Target.CpuFeatures.Cpu` is now `std.Target.Cpu.Model`. * `std.Target.CpuFeatures` is now `std.Target.Cpu`. * `std.Target` no longer has an `arch` field. Instead it has a `cpu` field, which has `arch`, `model`, and `features`. * `std.Target` no longer has a `cpu_features` field. * `std.Target.Arch` is moved to `std.Target.Cpu.Arch` and it is an enum instead of a tagged union. * `std.Target.parseOs` is moved to `std.Target.Os.parse`. * `std.Target.parseAbi` is moved to `std.Target.Abi.parse`. * `std.Target.parseArchSub` is only for arch now and moved to `std.Target.Cpu.Arch.parse`. * `std.Target.parse` is improved to accept CPU name and features. * `std.Target.Arch.getBaselineCpuFeatures` is moved to `std.Target.Cpu.baseline`. * `std.Target.allCpus` is renamed to `std.Target.allCpuModels`. * `std.Target.defaultAbi` is moved to `std.Target.Abi.default`. * Significant cleanup of aarch64 and arm CPU features, resulting in the needed bit count for cpu feature set going from 174 to 138. * Add `std.Target.Cpu.Feature.Set.addFeatureSet` for merging feature sets together. `-target-feature` and `-target-cpu` are removed in favor of `-mcpu`, to conform to established conventions, and it gains additional power to support cpu features. The syntax is: -mcpu=name+on1+on2-off1-off2 closes #4261
2020-02-17support the concept of a target not having a dynamic linkerAndrew Kelley
2020-02-17self-host dynamic linker detectionAndrew Kelley
2020-02-16add missing implementations of libc installation to detect msvc pathsAndrew Kelley
2020-02-16self-hosted libc detectionAndrew Kelley
* libc_installation.cpp is deleted. src-self-hosted/libc_installation.zig is now used for both stage1 and stage2 compilers. * (breaking) move `std.fs.File.access` to `std.fs.Dir.access`. The API now encourages use with an open directory handle. * Add `std.os.faccessat` and related functions. * Deprecate the "C" suffix naming convention for null-terminated parameters. "C" should be used when it is related to libc. However null-terminated parameters often have to do with the native system ABI rather than libc. "Z" suffix is the new convention. For example, `std.os.openC` is deprecated in favor of `std.os.openZ`. * Add `std.mem.dupeZ` for using an allocator to copy memory and add a null terminator. * Remove dead struct field `std.ChildProcess.llnode`. * Introduce `std.event.Batch`. This API allows expressing concurrency without forcing code to be async. It requires no Allocator and does not introduce any failure conditions. However it is not thread-safe. * There is now an ongoing experiment to transition away from `std.event.Group` in favor of `std.event.Batch`. * `std.os.execvpeC` calls `getenvZ` rather than `getenv`. This is slightly more efficient on most systems, and works around a limitation of `getenv` lack of integration with libc. * (breaking) `std.os.AccessError` gains `FileBusy`, `SymLinkLoop`, and `ReadOnlyFileSystem`. Previously these error codes were all reported as `PermissionDenied`. * Add `std.Target.isDragonFlyBSD`. * stage2: access to the windows_sdk functions is done with a manually maintained .zig binding file instead of `@cImport`. * Update src-self-hosted/libc_installation.zig with all the improvements that stage1 has seen to src/libc_installation.cpp until now. In addition, it now takes advantage of Batch so that evented I/O mode takes advantage of concurrency, but it still works in blocking I/O mode, which is how it is used in stage1.
2020-02-16more user-friendly error message for some clang diagnosticsAndrew Kelley
See #4455
2020-02-15translate-c: change OutOfMemory → ASTUnitFailureMichael Dusan
- return a better error when no diagnostics are available
2020-01-21fixups to arch data, support any number of cpu featuresAndrew Kelley
2020-01-20stage1 is building. `zig targets` now self-hostedAndrew Kelley
2019-10-23move types from builtin to stdAndrew Kelley
* All the data types from `@import("builtin")` are moved to `@import("std").builtin`. The target-related types are moved to `std.Target`. This allows the data types to have methods, such as `std.Target.current.isDarwin()`. * `std.os.windows.subsystem` is moved to `std.Target.current.subsystem`. * Remove the concept of the panic package from the compiler implementation. Instead, `std.builtin.panic` is always the panic function. It checks for `@hasDecl(@import("root"), "panic")`, or else provides a default implementation. This is an important step for multibuilds (#3028). Without this change, the types inside the builtin namespace look like different types, when trying to merge builds with different target settings. With this change, Zig can figure out that, e.g., `std.builtin.Os` (the enum type) from one compilation and `std.builtin.Os` from another compilation are the same type, even if the target OS value differs.
2019-08-29await does not force async if callee is blockingAndrew Kelley
closes #3067
2019-08-29comparing against zero participates in lazy valuesAndrew Kelley
2019-05-15fix static builds of zig from requiring c compilerAndrew Kelley
to be installed when linking libc. When zig links against libc, it requires a dynamic linker path. Usually this can be determined based on the architecture and operating system components of the target. However on some systems this is not correct; because of this zig checks its own dynamic linker. When zig is statically linked, this information is not available, and so it resorts to using cc -print-filename=foo to find the dynamic linker path. Before this commit, Zig incorrectly exited with an error if there was no c compiler installed. Now, Zig falls back to the dynamic linker determined based on the arch and os when no C compiler can be found.
2019-04-25translate-c: a little closer to self-hosted implementationAndrew Kelley
2019-04-02better error message when os_file_overwrite failsAndrew Kelley
2019-03-07fix .d file processing and use -MV to quote spacesAndrew Kelley
2019-03-07better behavior when cache dir unavailableAndrew Kelley
and choose different manifest dir for local cache to avoid conflict with zig build
2019-02-26windows returns EINVAL for fopen when there is an asterisk in the nameAndrew Kelley
closes #508
2019-02-26breaking changes to the way targets work in zigAndrew Kelley
* CLI: `-target [name]` instead of `--target-*` args. This matches clang's API. * `builtin.Environ` renamed to `builtin.Abi` - likewise `builtin.environ` renamed to `builtin.abi` * stop hiding the concept of sub-arch. closes #1526 * `zig targets` only shows available targets. closes #438 * include all targets in readme, even those that don't print with `zig targets` but note they are Tier 4 * refactor target.cpp and make the naming conventions more consistent * introduce the concept of a "default C ABI" for a given OS/Arch combo. As a rule of thumb, if the system compiler is clang or gcc then the default C ABI is the gnu ABI.
2019-02-25`@cImport` works with `--cache on`Andrew Kelley
We pass -MD -MF args to clang when doing `@cImport`, which gives us a complete list of files that the C code read from. Then we add these to the cache. So even when using `@cImport` Zig's caching system remains perfect. This is a proof of concept for the mechanism that the self-hosted compiler will use to watch and rebuild files.
2019-02-23better libc detection (#1996)Andrew Kelley
* better libc detection This introduces a new command `zig libc` which prints the various paths of libc files. It outputs them to stdout in a simple text file format that it is capable of parsing. You can use `zig libc libc.txt` to validate a file. These arguments are gone: --libc-lib-dir [path] directory where libc crt1.o resides --libc-static-lib-dir [path] directory where libc crtbegin.o resides --msvc-lib-dir [path] (windows) directory where vcruntime.lib resides --kernel32-lib-dir [path] (windows) directory where kernel32.lib resides Instead we have this argument: --libc [file] Provide a file which specifies libc paths This is used to pass a libc text file (which can be generated with `zig libc`). So it is easier to manage multiple cross compilation environments. `--cache on` now works when linking against libc. `ZigTarget` now has a bool field `is_native` Better error messaging when you try to link against libc or use `@cImport` but the various paths cannot be found. It should also be faster. * save native_libc.txt in zig-cache This avoids having to detect libc at runtime on every invocation.
2018-11-26stage1: better file path handlingAndrew Kelley
* better message printed when cache hash fails * better handling of '/' as root source file * os_path_split parses '/' and '/a' correctly closes #1693 closes #1746
2018-11-06limit integer types to maximum bit width of 65535Andrew Kelley
closes #1541
2018-09-12windows os.cpp implementationsAndrew Kelley
2018-09-10caching is workingAndrew Kelley
* add almost all the input parameter state to the hash - missing items are the detected MSVC installation on Windows and detected libc installation on POSIX - also missing are C files and .h files that libclang finds * artifacts are created in global cache directory instead of zig-cache. - exception: builtin.zig is still in zig-cache * zig run uses the new cache correctly * zig run uses execv on posix systems
2018-09-09basic compiler id hash workingAndrew Kelley
2017-11-29fix build broken by previous commitAndrew Kelley
now we report a compile error for unusual failures from translate-c
2017-08-09more intuitive left shift and right shift operatorsAndrew Kelley
Before: * << is left shift, not allowed to shift 1 bits out * <<% is left shift, allowed to shift 1 bits out * >> is right shift, allowed to shift 1 bits out After: * << is left shift, allowed to shift 1 bits out * >> is right shift, allowed to shift 1 bits out * @shlExact is left shift, not allowed to shift 1 bits out * @shrExact is right shift, not allowed to shift 1 bits out Closes #413
2017-05-06builtin functions for division and remainder divisionAndrew Kelley
* add `@divTrunc` and `@divFloor` functions * add `@rem` and `@mod` functions * add compile error for `/` and `%` with signed integers * add `.bit_count` for float primitive types closes #217
2017-04-28zig puts temporary object files in zig-cache folderAndrew Kelley
See #298
2016-12-04add missing copyright noticesAndrew Kelley
2016-04-12add error for dividing by zero in static function evaluationAndrew Kelley
2015-12-01add test for bad importAndrew Kelley
2015-11-30refactor code to prepare for multiple filesAndrew Kelley
verbose compiler output is now behind --verbose flag
2015-11-30add directive to specify root export versionAndrew Kelley
2015-11-05experiment with being a linkerAndrew Kelley