From patchwork Mon Jun 24 00:00:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1120939 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-503542-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="Sf7zGTpT"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZpVnIite"; 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 45X8Zw3dLNz9sNT for ; Mon, 24 Jun 2019 10:01:04 +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=eQpv92O0VayY7o4h7rIpCLuqnuWnYV6rYpJGnYwc4QxorpGKg3 wi+uJETnP5R1qVRsGDQ7OeUdRixF/BCUhg/h506A411o9/RC5IrdYllBlyT6MsQp ChI6sJTdfY77/DaqB8FrMNxdGCVEhShtFepPr1OiYn2jYBxkUOKbt+hGs= 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=/SzDfXj333QwPfd7ykzkMI7ojpI=; b=Sf7zGTpTBCI3trEL7vmf glr6xvTByFOR2F00Zn09EJ7thWgamtrl7M9D1O+9GXeLMvnJ0WpFSXUCVo/n+bh6 zbHSEG4dsCbFuxCVTAX4U71ydSKPWjoOJHN6dUB+7UOIvuWIiUk9uEhl1pyUKzAi JMYFl0S3uijLc/ea1WfBUTo= Received: (qmail 63638 invoked by alias); 24 Jun 2019 00:00:54 -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 63577 invoked by uid 89); 24 Jun 2019 00:00:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=sk:Wfloat-, conventions, instances, sk:wfloat- X-HELO: mail-qk1-f179.google.com Received: from mail-qk1-f179.google.com (HELO mail-qk1-f179.google.com) (209.85.222.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Jun 2019 00:00:48 +0000 Received: by mail-qk1-f179.google.com with SMTP id c11so8483154qkk.8 for ; Sun, 23 Jun 2019 17:00:47 -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=HOSjySvpWV4oXCcr4IyJ8X1QUb0lBPhaBqHOrP7Qmmk=; b=ZpVnIiteTGNmFZl+WoUWvHkjTHcl3yiOQS3zb84pHfLzNTk4/q2p9WW7UHdA00M6Pz itvPr5QWRFNBj9JgiZ9vRSi7+Th7jOvr2ebR7jMJgXtzK4fJEqUd/+GHyitNv6X8UmhC OrWDDbqsxSA+QCyCSp0L4dBYbko121HPzDeSX+LrWIrp8byV2HWnkGdd7AZHBnJEPLTW WADyec4Wgp8k5cjiPISeDaAba1J9IvUE2aT6zY63+bO0Y3Ie21v01r+HdSBYVqKC+1Hz MhAsEqqGxFgpwoStgRhY5Lvzo8vrYn/SpFDeDNPyqi2BKpFija9StHciL1EUETfQOLIV xCfw== Received: from [192.168.0.41] (75-166-109-122.hlrn.qwest.net. [75.166.109.122]) by smtp.gmail.com with ESMTPSA id 41sm6257480qtp.32.2019.06.23.17.00.44 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jun 2019 17:00:45 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH] some more -Wformat-diag cleanup Message-ID: Date: Sun, 23 Jun 2019 18:00:44 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch cleans up a number of outstanding -Wformat-diag instances. I plan to commit it tomorrow. With it applied, an x86_64-linux bootstrap shows just 79 unique instances of the warning originating in 17 files. 49 of those are in the Go front-end that Ian is already dealing with. I will work on the rest. Martin gcc/ada/ChangeLog: * gcc-interface/utils.c (handle_nonnull_attribute): Quote attribute name. gcc/c/ChangeLog: * c-typeck.c (build_binary_op): Hyphenate floating-point. gcc/testsuite/ChangeLog: * gcc.dg/Wfloat-equal-1.c: Adjust text of expected diagnostic. * gcc.dg/misc-column.c: Ditto. gcc/ChangeLog: * tree-pretty-print.h: Remove unnecessary punctuation characters from a diagnostic. * tree-ssa.c (release_defs_bitset): Correct preprocessor conditional. Index: gcc/ada/gcc-interface/utils.c =================================================================== --- gcc/ada/gcc-interface/utils.c (revision 272575) +++ gcc/ada/gcc-interface/utils.c (working copy) @@ -6234,7 +6234,8 @@ handle_nonnull_attribute (tree *node, tree ARG_UNU && (!TYPE_ATTRIBUTES (type) || !lookup_attribute ("type generic", TYPE_ATTRIBUTES (type)))) { - error ("nonnull attribute without arguments on a non-prototype"); + error ("%qs attribute without arguments on a non-prototype", + "nonnull"); *no_add_attrs = true; } return NULL_TREE; @@ -6248,8 +6249,8 @@ handle_nonnull_attribute (tree *node, tree ARG_UNU if (!get_nonnull_operand (TREE_VALUE (args), &arg_num)) { - error ("nonnull argument has invalid operand number (argument %lu)", - (unsigned long) attr_arg_num); + error ("%qs argument has invalid operand number (argument %lu)", + "nonnull", (unsigned long) attr_arg_num); *no_add_attrs = true; return NULL_TREE; } @@ -6270,8 +6271,8 @@ handle_nonnull_attribute (tree *node, tree ARG_UNU if (!argument || TREE_CODE (argument) == VOID_TYPE) { - error ("nonnull argument with out-of-range operand number " - "(argument %lu, operand %lu)", + error ("%qs argument with out-of-range operand number " + "(argument %lu, operand %lu)", "nonnull", (unsigned long) attr_arg_num, (unsigned long) arg_num); *no_add_attrs = true; return NULL_TREE; @@ -6279,8 +6280,8 @@ handle_nonnull_attribute (tree *node, tree ARG_UNU if (TREE_CODE (argument) != POINTER_TYPE) { - error ("nonnull argument references non-pointer operand " - "(argument %lu, operand %lu)", + error ("%qs argument references non-pointer operand " + "(argument %lu, operand %lu)", "nonnull", (unsigned long) attr_arg_num, (unsigned long) arg_num); *no_add_attrs = true; return NULL_TREE; Index: gcc/c/c-typeck.c =================================================================== --- gcc/c/c-typeck.c (revision 272575) +++ gcc/c/c-typeck.c (working copy) @@ -11939,7 +11939,7 @@ build_binary_op (location_t location, enum tree_co 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; Index: gcc/testsuite/gcc.dg/Wfloat-equal-1.c =================================================================== --- gcc/testsuite/gcc.dg/Wfloat-equal-1.c (revision 272575) +++ gcc/testsuite/gcc.dg/Wfloat-equal-1.c (working copy) @@ -4,7 +4,7 @@ double a, b; _Complex double c, d; -int f(void) { return a == b; } /* { dg-warning "comparing floating point" } */ -int g(void) { return c == d; } /* { dg-warning "comparing floating point" } */ -int h(void) { return a != b; } /* { dg-warning "comparing floating point" } */ -int i(void) { return c != d; } /* { dg-warning "comparing floating point" } */ +int f(void) { return a == b; } /* { dg-warning "comparing floating-point" } */ +int g(void) { return c == d; } /* { dg-warning "comparing floating-point" } */ +int h(void) { return a != b; } /* { dg-warning "comparing floating-point" } */ +int i(void) { return c != d; } /* { dg-warning "comparing floating-point" } */ Index: gcc/testsuite/gcc.dg/misc-column.c =================================================================== --- gcc/testsuite/gcc.dg/misc-column.c (revision 272575) +++ gcc/testsuite/gcc.dg/misc-column.c (working copy) @@ -13,7 +13,7 @@ extern void bar(); void foo (void) { - if (a == b) /* { dg-warning "9:comparing floating point with" } */ + if (a == b) /* { dg-warning "9:comparing floating-point with" } */ bar (); if (p < q) /* { dg-warning "9:comparison of distinct pointer types" } */ Index: gcc/tree-pretty-print.h =================================================================== --- gcc/tree-pretty-print.h (revision 272575) +++ gcc/tree-pretty-print.h (working copy) @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "pretty-print.h" #define pp_unsupported_tree(PP, T) \ - pp_verbatim (PP, "#%qs not supported by %s#", \ + pp_verbatim (PP, "%qs not supported by %s", \ get_tree_code_name (TREE_CODE (T)), __FUNCTION__) #define pp_ti_abstract_origin(TI) ((tree *) (TI)->x_data) Index: gcc/tree-ssa.c =================================================================== --- gcc/tree-ssa.c (revision 272575) +++ gcc/tree-ssa.c (working copy) @@ -631,7 +631,7 @@ release_defs_bitset (bitmap toremove) the verification errors. Their format strings don't follow GCC diagnostic conventions and the calls are ultimately followed by one to internal_error. */ -#if __GNUC__ > 10 +#if __GNUC__ >= 10 # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wformat-diag" #endif