From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id E834E395542C for ; Mon, 14 Jun 2021 17:14:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E834E395542C Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-52-YBjxhsvpMheDHpzwKk4Dzw-1; Mon, 14 Jun 2021 13:14:21 -0400 X-MC-Unique: YBjxhsvpMheDHpzwKk4Dzw-1 Received: by mail-wm1-f70.google.com with SMTP id h9-20020a05600c3509b02901b985251fdcso4939636wmq.9 for ; Mon, 14 Jun 2021 10:14:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xl290yVf2S1bF0sKvl3na8UA6C0XeScJJDQiwsrbBUs=; b=pcTRkDUmKMrXqjKqSMDRmJ9yThojQTvqEPL6LQWm/Qx8Dd3NP4NIB7WtFFeo7Oz32p dHEkbr0agPnoMdO4dZiFIlT6ffexvCRs8qkkotJQtEN5X3pafXXuDL0O5TuH5P7bPQMm zSA5LTInDQudUCWt78mEOA6nIAKUFK1BHbwHqoJCvslIbd7T31LCmQS/Br3FHfQoSQ8I WrAfagvNoVw9XK9Ifylmr12q66C8+Vnr/iD06W2M67WoHRelbA77Fk0si7vCJDLlUgfa U9uLyCzag60x0GchQ/hi7xtikJDOA0ErkIk+S00CjG5kYYeSj25GfcjK77boLx3tOEem Fmkw== X-Gm-Message-State: AOAM530pZ9KQVsBN7OpRV3JEGe2MqfUG9jO6McrXIDzpRQPa8w7N6qF4 x94xoU0OCTZXLyTJ03+QO4/wjklFCWQVvkQWvStzTTZu71YOc2sXOAhC/0Mt5uT1Brir1/nspct P6di8RM7W5aQIadHSozMiQ8WIl8eiTiyr7A== X-Received: by 2002:a7b:c2e8:: with SMTP id e8mr17533629wmk.41.1623690860736; Mon, 14 Jun 2021 10:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyT/emiydjUR9UyKGNg6PLSgs4c24PuZP0ZJ208P7oLRx4UMU0iH7nU9JtgdiHrHASHamgcg7lBoQGgnBO9E6M= X-Received: by 2002:a7b:c2e8:: with SMTP id e8mr17533601wmk.41.1623690860522; Mon, 14 Jun 2021 10:14:20 -0700 (PDT) MIME-Version: 1.0 References: <8ee6804b-be40-99dd-5aaa-07083dc206f6@gmail.com> In-Reply-To: <8ee6804b-be40-99dd-5aaa-07083dc206f6@gmail.com> From: Jonathan Wakely Date: Mon, 14 Jun 2021 18:14:09 +0100 Message-ID: Subject: Re: [PATCH] c-family: Add fix-it suggestions for names [PR101052] To: Martin Sebor Cc: gcc Patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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:14:25 -0000 On Mon, 14 Jun 2021 at 18:03, Martin Sebor wrote: > > 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. Yes, I noticed that. We only search the array after compilation fails, so performance doesn't really matter. > > So I'm wondering if you stopped at the seven above for the same > reason or some other? I lost the motivation to add the rest of when testing it for C turned out to be difficult due to C allowing implicit declarations. > > 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.) Yes, that's why I wanted to add aligned_alloc, at_quick_exit and quick_exit, in a new c11_cxx11_hints array. They're maybe less "well known" than exit and malloc. > 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.