From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id 545CF395201F for ; Mon, 14 Jun 2021 17:03:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 545CF395201F Received: by mail-oi1-x22c.google.com with SMTP id x196so15083830oif.10 for ; Mon, 14 Jun 2021 10:03:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UP3x1EjSbNUbG9jzZkGiMzRAS98sPp9T/Cd9vWf5sOw=; b=pPsiA4QPutb1V6VK/2vAOyd06oTJcxGsCyfQfNeHJakKcs2SMK0UxHqAimmkny2PQJ SZPpxHqiEhOsXyYW7qfPKPI/8FaUCtjre2ItMJvdMac2RDaVHkR9fUPbejj3gszZjN6t ehHYLEjmFoKZpw3fhTF8FBGTylULH65Z2Hk4GfargmbIbt/az84OxZiP4J+me94iWI9Z jFO+oJqchL2kIRq5NZv4j7xpf8TjdZUMN0VCvExJaSa7aGjWSmm8+TIukLp6pUlRW7Ze cB83Z2xy+hXCEYmu+5MfigHKcsHM79i1+3GIV62JgI8UmPpFuOSOxWmZZWgdTkp64CSf 9bvQ== X-Gm-Message-State: AOAM530hhE5CFt8pUkCAnL90yDbi1R/5+qEf6d1KJ6gK6KkNG6FCsXWP 7X0TghSDp+IdPYu+ngoNI48YciIw1G4= X-Google-Smtp-Source: ABdhPJznDjpr6+pA9tsIBFVSpSydea+WxwMHoXoo+zqql976usUEErjAPRaFD1+lShz1V6yiix1Yog== X-Received: by 2002:aca:bd42:: with SMTP id n63mr51405oif.73.1623690226568; Mon, 14 Jun 2021 10:03:46 -0700 (PDT) Received: from [192.168.0.41] (184-96-238-78.hlrn.qwest.net. [184.96.238.78]) by smtp.gmail.com with ESMTPSA id 111sm3471350otg.25.2021.06.14.10.03.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Jun 2021 10:03:46 -0700 (PDT) Subject: Re: [PATCH] c-family: Add fix-it suggestions for names [PR101052] To: Jonathan Wakely , gcc-patches@gcc.gnu.org References: From: Martin Sebor Message-ID: <8ee6804b-be40-99dd-5aaa-07083dc206f6@gmail.com> Date: Mon, 14 Jun 2021 11:03:45 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2021 17:03:48 -0000 On 6/14/21 6:17 AM, Jonathan Wakely via Gcc-patches wrote: > PR c++/101052 > > gcc/c-family/ChangeLog: > > * known-headers.cc (get_stdlib_header_for_name): Add known > headers for EXIT_FAILURE, EXIT_SUCCESS, abort, atexit, calloc, > exit, and getenv. > > gcc/testsuite/ChangeLog: > > * g++.dg/spellcheck-stdlib.C: Add checks for names. > * gcc.dg/spellcheck-stdlib.c: Likewise. > > There are no C tests for the functions because the C front-end doesn't > give fix-it hints for them, it complains about mismatched implicit > declarations. I assume this is why there were no existing tests for > malloc, free, etc. > > Tested powerpc64le-linux. OK for trunk? A while back I noticed some other symbol wasn't giving a nice hint. I think it was one of the macros that I can never remember if it's in or . So decided to add them all, and while I was there, I noticed that the function does a linear search through the array. That seems suboptimal so I started optimizing it and never finished the work. So I'm wondering if you stopped at the seven above for the same reason or some other? FWIW, I think the symbols that are hardcoded there now are some of the most obvious ones. The ones that are harder to remember tend to be missing. (E.g., I'd probably include for wcstombs and would have to look it up if I got an error. YMMV of course.) This is not an objection to adding just a handful of new names, just a comment on the general state of incompleteness and the inefficient data structure in case that matters. If we don't care enough about the inefficiency to avoid completing the list then I'd suggest to add all the missing names, not just the seven above. Martin