* 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.
72 lines
2.9 KiB
C++
72 lines
2.9 KiB
C++
/*
|
|
* Copyright (c) 2015 Andrew Kelley
|
|
*
|
|
* This file is part of zig, which is MIT licensed.
|
|
* See http://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#ifndef ZIG_CODEGEN_HPP
|
|
#define ZIG_CODEGEN_HPP
|
|
|
|
#include "parser.hpp"
|
|
#include "errmsg.hpp"
|
|
#include "target.hpp"
|
|
#include "userland.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget *target,
|
|
OutType out_type, BuildMode build_mode, Buf *zig_lib_dir,
|
|
Stage2LibCInstallation *libc, Buf *cache_dir, bool is_test_build, Stage2ProgressNode *progress_node);
|
|
|
|
CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType out_type,
|
|
Stage2LibCInstallation *libc, const char *name, Stage2ProgressNode *progress_node);
|
|
|
|
void codegen_set_clang_argv(CodeGen *codegen, const char **args, size_t len);
|
|
void codegen_set_llvm_argv(CodeGen *codegen, const char **args, size_t len);
|
|
void codegen_set_each_lib_rpath(CodeGen *codegen, bool each_lib_rpath);
|
|
|
|
void codegen_set_emit_file_type(CodeGen *g, EmitFileType emit_file_type);
|
|
void codegen_set_strip(CodeGen *codegen, bool strip);
|
|
void codegen_set_errmsg_color(CodeGen *codegen, ErrColor err_color);
|
|
void codegen_set_out_name(CodeGen *codegen, Buf *out_name);
|
|
void codegen_add_lib_dir(CodeGen *codegen, const char *dir);
|
|
void codegen_add_forbidden_lib(CodeGen *codegen, Buf *lib);
|
|
LinkLib *codegen_add_link_lib(CodeGen *codegen, Buf *lib);
|
|
void codegen_add_framework(CodeGen *codegen, const char *name);
|
|
void codegen_add_rpath(CodeGen *codegen, const char *name);
|
|
void codegen_set_rdynamic(CodeGen *g, bool rdynamic);
|
|
void codegen_set_mmacosx_version_min(CodeGen *g, Buf *mmacosx_version_min);
|
|
void codegen_set_mios_version_min(CodeGen *g, Buf *mios_version_min);
|
|
void codegen_set_linker_script(CodeGen *g, const char *linker_script);
|
|
void codegen_set_test_filter(CodeGen *g, Buf *filter);
|
|
void codegen_set_test_name_prefix(CodeGen *g, Buf *prefix);
|
|
void codegen_set_lib_version(CodeGen *g, size_t major, size_t minor, size_t patch);
|
|
void codegen_add_time_event(CodeGen *g, const char *name);
|
|
void codegen_print_timing_report(CodeGen *g, FILE *f);
|
|
void codegen_link(CodeGen *g);
|
|
void zig_link_add_compiler_rt(CodeGen *g, Stage2ProgressNode *progress_node);
|
|
void codegen_build_and_link(CodeGen *g);
|
|
|
|
ZigPackage *codegen_create_package(CodeGen *g, const char *root_src_dir, const char *root_src_path,
|
|
const char *pkg_path);
|
|
void codegen_add_assembly(CodeGen *g, Buf *path);
|
|
void codegen_add_object(CodeGen *g, Buf *object_path);
|
|
|
|
void codegen_translate_c(CodeGen *g, Buf *full_path);
|
|
|
|
Buf *codegen_generate_builtin_source(CodeGen *g);
|
|
|
|
TargetSubsystem detect_subsystem(CodeGen *g);
|
|
|
|
void codegen_release_caches(CodeGen *codegen);
|
|
bool codegen_fn_has_err_ret_tracing_arg(CodeGen *g, ZigType *return_type);
|
|
bool codegen_fn_has_err_ret_tracing_stack(CodeGen *g, ZigFn *fn, bool is_async);
|
|
|
|
ATTRIBUTE_NORETURN
|
|
void codegen_report_errors_and_exit(CodeGen *g);
|
|
|
|
void codegen_switch_sub_prog_node(CodeGen *g, Stage2ProgressNode *node);
|
|
|
|
#endif
|