From patchwork Tue May 14 21:32:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099738 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500690-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hvhhgxJb"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UAJkw8HZ"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WBT3DQMz9sNd for ; Wed, 15 May 2019 07:33:03 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=cuWcLr8JKxgYOSScAon56wwQfh910wTMW+vTRfPwE6jMMn5QbL CkC6AYSrHDW3jlwVsQKjAXuJrAQzMZxXep9JxCMqybUNiq8DAbkoYqJryTAUQQ3m yOrAuhoWNAyo58zErsMNSAfL/NgIUXy1JD6KG2/jzajML4g2Lok53SYqI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=PBMZzIe0gAvmBQx1FdR6zWgMvDA=; b=hvhhgxJbj0Wpk5aYaEQK 7CI5snmG4hmZMABZ445ANIOuwAQKvQBRjhgsGnwAUqeipo18CloL5WBV0DbGGvl+ GhSze6KpHCaD7RvRof4P15UTxOJiArpl8fzzDBG1g/QBsCodRZxcx4E+nCQs5ggI LQ5DigIKcuXIyl1uRDh5sj8= Received: (qmail 38421 invoked by alias); 14 May 2019 21:32:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 38223 invoked by uid 89); 14 May 2019 21:32:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=sk:constru, code1 X-HELO: mail-qt1-f171.google.com Received: from mail-qt1-f171.google.com (HELO mail-qt1-f171.google.com) (209.85.160.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:32:16 +0000 Received: by mail-qt1-f171.google.com with SMTP id y42so866546qtk.6 for ; Tue, 14 May 2019 14:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=4GqA99CB3gej1f8c4QmnPhNAwDYQWQDxVbVHlV1kFJY=; b=UAJkw8HZ/5MZlAmE3R9NGXNcCFF2VKPBd3J1XNOu5jfeVEuAc0K5SkquzdL8xo7gVj s91eA2HpjKEgFluH/G1yh/ssJ2tGE+qmpwpiCKx/FkIwJEUjf9veIV9+02NWLxGNw2Ho 5Y5VG1k23Q5owLVVGLGWkn7PeuAIaVRCo6MuGs6qlvv2y3aEf8A+wJLQI5vOG45/u3M9 ZodEr3F0hnrdl3igzGr9/3lSdK4eDPYdMe/xuC7UdpJOqQAnyNTZrsvmyeLYxz4ylVhc YTXmy6ASktKRsZz/C1l/TAvy+330f/XANGx1mFtIVjFexhv+om5hzaXKdqp1lFiM+6Le +xmg== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id i13sm7154909qkm.68.2019.05.14.14.32.13 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:32:13 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 4/12] fix diagnostic quoting/spelling in the C front-end Message-ID: <872118de-6982-caef-0a0f-fb481994168f@gmail.com> Date: Tue, 14 May 2019 15:32:12 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued by the C front-end and pointed out by the -Wformat-diag warning. Martin gcc/c/ChangeLog: * c-decl.c (start_decl): Quote keywords, operators, and types in diagnostics. (finish_decl): Same. * c-parser.c (c_parser_asm_statement): Same. (c_parser_conditional_expression): Same. (c_parser_transaction_cancel): Same. * c-typeck.c (c_common_type): Same. (build_conditional_expr): Same. (digest_init): Same. (process_init_element): Same. (build_binary_op): Same. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index c8e7cd01d9e..11c0a421432 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4887,7 +4887,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, switch (TREE_CODE (decl)) { case TYPE_DECL: - error ("typedef %qD is initialized (use __typeof__ instead)", decl); + error ("typedef %qD is initialized (use %<__typeof__%> instead)", decl); initialized = false; break; @@ -5282,7 +5282,7 @@ finish_decl (tree decl, location_t init_loc, tree init, && VAR_P (decl) && !C_DECL_REGISTER (decl) && !TREE_STATIC (decl)) - warning (0, "ignoring asm-specifier for non-static local " + warning (0, "ignoring %-specifier for non-static local " "variable %q+D", decl); else set_user_assembler_name (decl, asmspec); diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 3aa85125cf1..e499a7c8beb 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -6401,7 +6401,7 @@ c_parser_asm_statement (c_parser *parser) case RID_VOLATILE: if (volatile_loc) { - error_at (loc, "duplicate asm qualifier %qE", token->value); + error_at (loc, "duplicate % qualifier %qE", token->value); inform (volatile_loc, "first seen here"); } else @@ -6412,7 +6412,7 @@ c_parser_asm_statement (c_parser *parser) case RID_INLINE: if (inline_loc) { - error_at (loc, "duplicate asm qualifier %qE", token->value); + error_at (loc, "duplicate % qualifier %qE", token->value); inform (inline_loc, "first seen here"); } else @@ -6423,7 +6423,7 @@ c_parser_asm_statement (c_parser *parser) case RID_GOTO: if (goto_loc) { - error_at (loc, "duplicate asm qualifier %qE", token->value); + error_at (loc, "duplicate % qualifier %qE", token->value); inform (goto_loc, "first seen here"); } else @@ -6433,7 +6433,7 @@ c_parser_asm_statement (c_parser *parser) case RID_CONST: case RID_RESTRICT: - error_at (loc, "%qE is not an asm qualifier", token->value); + error_at (loc, "%qE is not an % qualifier", token->value); c_parser_consume_token (parser); continue; @@ -6791,7 +6791,7 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after, location_t middle_loc = c_parser_peek_token (parser)->location; pedwarn (middle_loc, OPT_Wpedantic, - "ISO C forbids omitting the middle term of a ?: expression"); + "ISO C forbids omitting the middle term of a % expression"); if (TREE_CODE (cond.value) == EXCESS_PRECISION_EXPR) { eptype = TREE_TYPE (cond.value); @@ -19825,8 +19825,8 @@ c_parser_transaction_cancel (c_parser *parser) && !is_tm_may_cancel_outer (current_function_decl)) { error_at (loc, "outer %<__transaction_cancel%> not " - "within outer %<__transaction_atomic%>"); - error_at (loc, " or a % function"); + "within outer %<__transaction_atomic%> or " + "a % function"); goto ret_error; } } diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 4e443754002..5eff040e85d 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -743,17 +743,18 @@ c_common_type (tree t1, tree t2) { if (code1 == VECTOR_TYPE || code2 == VECTOR_TYPE) { - error ("can%'t mix operands of decimal float and vector types"); + error ("cannot mix operands of decimal floating and vector types"); return error_mark_node; } if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) { - error ("can%'t mix operands of decimal float and complex types"); + error ("cannot mix operands of decimal floating and complex types"); return error_mark_node; } if (code1 == REAL_TYPE && code2 == REAL_TYPE) { - error ("can%'t mix operands of decimal float and other float types"); + error ("cannot mix operands of decimal floating " + "and other floating types"); return error_mark_node; } } @@ -5253,13 +5254,13 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp, /* OK */; else if (unsigned_op2) warning_at (op1_loc, OPT_Wsign_compare, - "operand of ?: changes signedness from " + "operand of % changes signedness from " "%qT to %qT due to unsignedness of other " "operand", TREE_TYPE (orig_op1), TREE_TYPE (orig_op2)); else warning_at (op2_loc, OPT_Wsign_compare, - "operand of ?: changes signedness from " + "operand of % changes signedness from " "%qT to %qT due to unsignedness of other " "operand", TREE_TYPE (orig_op2), TREE_TYPE (orig_op1)); @@ -7764,13 +7765,13 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype, that is counted in the length of the constant. */ if (compare_tree_int (TYPE_SIZE_UNIT (type), len - unit) < 0) pedwarn_init (init_loc, 0, - ("initializer-string for array of chars " - "is too long")); + ("initializer-string for array of %qT " + "is too long"), typ1); else if (warn_cxx_compat && compare_tree_int (TYPE_SIZE_UNIT (type), len) < 0) warning_at (init_loc, OPT_Wc___compat, - ("initializer-string for array chars " - "is too long for C++")); + ("initializer-string for array of %qT " + "is too long for C++"), typ1); if (compare_tree_int (TYPE_SIZE_UNIT (type), len) < 0) { unsigned HOST_WIDE_INT size @@ -9888,7 +9889,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, && integer_zerop (constructor_unfilled_index)) { if (constructor_stack->replacement_value.value) - error_init (loc, "excess elements in char array initializer"); + error_init (loc, "excess elements in % array initializer"); constructor_stack->replacement_value = value; return; } @@ -11937,7 +11938,7 @@ build_binary_op (location_t location, enum tree_code code, if (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1)) warning_at (location, OPT_Wfloat_equal, - "comparing floating point with == or != is unsafe"); + "comparing floating point with %<==%> or % is unsafe"); /* Result of comparison is always int, but don't convert the args to int! */ build_type = integer_type_node;