Skip to content

Commit

Permalink
Preparation to support Apple ld64's -w option
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 committed Mar 5, 2023
1 parent d2970e0 commit 6d2dbd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class Fatal {
template <typename Context>
class Error {
public:
Error(Context &ctx) : out(ctx, std::cerr) {
Error(Context &ctx) : out(ctx, std::cerr), suppress(ctx.arg.suppress_warnings) {
if (ctx.arg.noinhibit_exec) {
out << add_color(ctx, "warning");
} else {
Expand All @@ -169,12 +169,14 @@ class Error {
}

template <class T> Error &operator<<(T &&val) {
out << std::forward<T>(val);
if (!suppress)
out << std::forward<T>(val);
return *this;
}

private:
SyncOut<Context> out;
bool suppress;
};

template <typename Context>
Expand Down
3 changes: 2 additions & 1 deletion elf/mold.h
Original file line number Diff line number Diff line change
Expand Up @@ -1623,11 +1623,11 @@ struct Context {
bool Bsymbolic = false;
bool Bsymbolic_functions = false;
bool allow_multiple_definition = false;
bool apply_dynamic_relocs = true;
bool color_diagnostics = false;
bool default_symver = false;
bool demangle = true;
bool discard_all = false;
bool apply_dynamic_relocs = true;
bool discard_locals = false;
bool eh_frame_hdr = true;
bool emit_relocs = false;
Expand Down Expand Up @@ -1667,6 +1667,7 @@ struct Context {
bool stats = false;
bool strip_all = false;
bool strip_debug = false;
bool suppress_warnings = false;
bool trace = false;
bool undefined_version = false;
bool warn_common = false;
Expand Down

0 comments on commit 6d2dbd4

Please sign in to comment.