From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id D577E3853819 for ; Wed, 21 Jul 2021 17:09:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D577E3853819 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 16LH8guE030363; Wed, 21 Jul 2021 12:08:42 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 16LH8f2w030362; Wed, 21 Jul 2021 12:08:41 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 21 Jul 2021 12:08:41 -0500 From: Segher Boessenkool To: Bill Schmidt Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH 20/55] rs6000: Write output to the builtins init file, part 3 of 3 Message-ID: <20210721170841.GH1583@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_NUMSUBJECT, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 21 Jul 2021 17:09:43 -0000 Hi! On Thu, Jun 17, 2021 at 10:19:04AM -0500, Bill Schmidt wrote: > 2021-06-15 Bill Schmidt > > gcc/ > * config/rs6000/rs6000-gen-builtins.c (typemap): New struct. > (TYPE_MAP_SIZE): New macro. > (type_map): New initialized variable. > (map_token_to_type_node): New function. > (write_type_node): Likewise. > (write_fntype_init): Implement. > +/* Look up TOK in the type map and return the corresponding string used > + to build the type node. */ There is a standard "bsearch" function ;-) > + /* Avoid side effects of strtok on the original string by using a copy. */ > + char *buf = (char *) malloc (strlen (str) + 1); > + strcpy (buf, str); libiberty has xstrdup (and it can also be done using your new best friend asprintf of course ;-) ) Okay for trunk with or without such improvements. Thanks! Segher