Skip to content

gccrs: Remove ad-hoc formatting - #4784

Draft
powerboat9 wants to merge 3 commits into
Rust-GCC:masterfrom
powerboat9:expand-msg-strip
Draft

powerboat9 wants to merge 3 commits into
Rust-GCC:masterfrom
powerboat9:expand-msg-strip

Conversation

@powerboat9

Copy link
Copy Markdown
Collaborator

Depends on #4783

ChangeLog:

	* .github/glibcxx_ubuntu64b_log_expected_warnings: Add warnings.
	* .github/log_expected_warnings: Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
This allows rust_debug to use (an ad-hoc implementation of) gcc
diagnostic formatting. To keep this patch as small as possible, proper
fixes for -Wformat-diag are mostly left for future patches.

gcc/rust/ChangeLog:

	* ast/rust-ast.cc: Ignore -Wformat-diag.
	* backend/rust-compile-base.cc: Likewise.
	* backend/rust-compile-expr.cc: Likewise.
	* backend/rust-compile-stmt.cc: Likewise.
	* backend/rust-mangle-v0.cc: Likewise.
	* checks/errors/borrowck/rust-bir-builder.h: Likewise.
	* checks/errors/borrowck/rust-bir-fact-collector.h: Likewise.
	* checks/errors/rust-hir-pattern-analysis.cc: Likewise.
	* expand/rust-cfg-strip.cc: Likewise.
	* expand/rust-macro-builtins-asm.cc: Likewise.
	* expand/rust-macro-builtins-log-debug.cc: Likewise.
	* hir/tree/rust-hir.cc: Likewise.
	* lex/rust-lex.cc: Likewise.
	* parse/rust-parse-impl-lexer.cc: Likewise.
	* parse/rust-parse-impl-macro.cc: Likewise.
	* resolve/rust-forever-stack.hxx: Likewise.
	* rust-diagnostics.cc (rust_debug_loc): Use expand_message.
	* rust-diagnostics.h (rust_debug_loc): Change formatting
	attribute.
	* rust-lang.cc (grs_langhook_parse_file): Change debug message.
	* rust-session-manager.cc: Ignore -Wformat-diag.
	* typecheck/rust-autoderef.cc: Likewise.
	* typecheck/rust-casts.cc: Likewise.
	* typecheck/rust-coercion.cc: Likewise.
	* typecheck/rust-hir-dot-operator.cc: Likewise.
	* typecheck/rust-hir-type-check-expr.cc: Likewise.
	* typecheck/rust-hir-type-check-path.cc: Likewise.
	* typecheck/rust-hir-type-check-type.cc: Likewise.
	* typecheck/rust-type-util.cc: Likewise.
	* typecheck/rust-tyty-bounds.cc: Likewise.
	* typecheck/rust-tyty-subst.cc: Likewise.
	* typecheck/rust-tyty-variance-analysis.cc: Likewise.
	* typecheck/rust-tyty.cc: Likewise.
	* typecheck/rust-unify.cc: Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
This allows the use of %r and %R in rust diagnostic format strings by
removing our ad-hoc (and originally compiler independent?) formatting
code.

Also, makes sure that va_end and va_start are called inside the same
function.

gcc/rust/ChangeLog:

	* rust-diagnostics.cc: Include "diagnostic.h".
	(mformat_value): Remove function.
	(expand_format): Remove function.
	(expand_message): Use pretty_printer and take va_list argument
	by pointer.
	(rust_internal_error_at): Pass va_list to expand_message by
	pointer.
	(rust_error_at): Likewise.
	(rust_warning_at): Likewise.
	(rust_fatal_error): Likewise.
	(rust_inform): Likewise.
	(rust_debug_loc): Likewise.
	(va_constructor): Take va_list argument by pointer for passage
	to expand_message and remove va_end call.
	(Error::Error): Pass va_list to va_constructor by pointer and
	call va_end.
	(Error::Hint): Likewise.
	(Error::Fatal): Likewise.
	* rust-session-manager.cc: Stop ignoring -Wformat-diag.
	(Session::compile_crate): Adjust diagnostic messages.
	(Session::register_plugins): Likewise.
	(TargetOptions::enable_implicit_feature_reqs): Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant