From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19854 invoked by alias); 22 Jan 2018 15:55:50 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 19814 invoked by uid 89); 22 Jan 2018 15:55:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*i:sk:5A66076, H*f:sk:5A66076, Hx-languages-length:2309, HTo:D*at X-HELO: mailfilter04.hatteland.com Received: from mailfilter04.hatteland.com (HELO mailfilter04.hatteland.com) (213.162.250.23) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Jan 2018 15:55:47 +0000 Received: from localhost (localhost [127.0.0.1]) by mailfilter04.hatteland.com (Postfix) with ESMTP id 81E93108AFA; Mon, 22 Jan 2018 16:55:47 +0100 (CET) Received: from mailfilter04.hatteland.com (localhost [127.0.0.1]) by mailfilter04.hatteland.com (Postfix) with ESMTP id 603B71089AD; Mon, 22 Jan 2018 16:55:46 +0100 (CET) Received: from JHSVMHUB02.netsentral.no (unknown [172.21.1.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailfilter04.hatteland.com (Postfix) with ESMTPS id 59E3A10990F; Mon, 22 Jan 2018 16:55:46 +0100 (CET) Received: from [192.168.0.65] (172.21.20.100) by e2010.hatteland.com (172.21.1.26) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 22 Jan 2018 16:55:43 +0100 Message-ID: <5A66097E.7010005@westcontrol.com> Date: Mon, 22 Jan 2018 15:55:00 -0000 From: David Brown User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Manuel Rigger , CC: , Subject: Re: Unused GCC builtins References: <5A66076F0200008100014BC3@s05gw02.im.jku.at> In-Reply-To: <5A66076F0200008100014BC3@s05gw02.im.jku.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-SW-Source: 2018-01/txt/msg00167.txt.bz2 On 22/01/18 16:46, Manuel Rigger wrote: > Hi everyone, > > As part of my research, we have been analyzing the usage of GCC builtins > in 5,000 C GitHub projects. One of our findings is that many of these > builtins are unused, even though they are described in the documentation > (see https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html#C-Extensions) > and obviously took time to develop and maintain. I’ve uploaded a CSV > file with the unused builtins to > http://ssw.jku.at/General/Staff/ManuelRigger/unused-builtins.csv. > > Details: We downloaded all C projects from GitHub that had more than 80 > GitHub stars, which yielded almost 5,000 projects with a total of more > than one billion lines of C code. We filtered GCC, forks of GCC, and > other compilers as we did not want to incorporate internal usages of GCC > builtins or test cases. We extracted all builtin names from the GCC > docs, and also tried to find such names in the source code, which we > considered as builtin usages. We excluded subdirectories with GCC or > Clang, and removed other false positives. In total, we found 320k > builtin usages in these projects, and 3030 unused builtins out of a > total of 6039 builtins. > > What is your take on this? Do you believe that some of these unused > builtins could be removed from the GCC docs or deprecated? Or are they > used in special "niche" domains that we did not consider? If yes, do you > think it is worth to maintain them? Are some of them only used in C++ > projects? Might it be possible to remove their implementations (which > has already happened for the Cilk Plus builtins)? > > We would be glad for any feedback. > > - Manuel > Many of these are going to be used automatically by the compiler. You write "strdup" in your code, and the compiler treats it as "__builtin_strdup". I don't know that such functions need to be documented as extensions, but they are certainly in use. You will also find that a large number of the builtins are for specific target processors, and projects using them are not going to turn up on GitHub. They will be used in embedded software that is not open source. I am sure there are builtins that are rarely or never used - but I doubt if it is anything like as many as you have identified from this survey.