From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 9A3DB3858408 for ; Wed, 2 Mar 2022 01:36:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9A3DB3858408 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id E5F13342D4E; Wed, 2 Mar 2022 01:36:25 +0000 (UTC) From: Mike Frysinger To: newlib@sourceware.org Subject: [PATCH 2/6] newlib: rename mallocr.c to _mallocr.c Date: Tue, 1 Mar 2022 20:36:19 -0500 Message-Id: <20220302013623.368-3-vapier@gentoo.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220302013623.368-1-vapier@gentoo.org> References: <20220302013623.368-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2022 01:36:27 -0000 This file is a little confusing: it provides all of the mallocr logic, but is compiled multiple times to produce a unique symbol each time. For example, building mallocr.c with -DDEFINE_FREER produces freer.o that only defines _free_r(). This is fine for most symbols, but it's a little confusing when defining mallocr itself -- we produce a file with the same symbol name, but we still need -DDEFINE_MALLOCR. In order to move the logic from the build rules to source files, using mallocr.c both as a multiplexer and for defining a single symbol is a bit tricky. It's possible (if we add a lot of redundant preprocessor checks to mallocr.c, or we add complicated build flags just for this one files), but it's easier if we simply rename this to a dedicated file. So let's do that. We do this as a dedicated commit because the next one will create a new mallocr.c file and git's automatic diff algorithms can handle trivial renames, but it can't handle renames+creates in the same commit. --- newlib/libc/stdlib/Makefile.am | 24 ++++++++++---------- newlib/libc/stdlib/Makefile.in | 24 ++++++++++---------- newlib/libc/stdlib/{mallocr.c => _mallocr.c} | 0 3 files changed, 24 insertions(+), 24 deletions(-) rename newlib/libc/stdlib/{mallocr.c => _mallocr.c} (100%) diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am index 950ad98ac134..cb2fbe850b85 100644 --- a/newlib/libc/stdlib/Makefile.am +++ b/newlib/libc/stdlib/Makefile.am @@ -180,40 +180,40 @@ lib_a_CFLAGS = $(AM_CFLAGS) lib_a_DEPENDENCIES = $(LIBADD_OBJS) $(ELIX_OBJS) LIB_COMPILE = $(AM_V_CC)$(COMPILE) -$(lpfx)mallocr.o: mallocr.c +$(lpfx)mallocr.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_MALLOC -c $< -o $@ -$(lpfx)freer.o: mallocr.c +$(lpfx)freer.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_FREE -c $< -o $@ -$(lpfx)reallocr.o: mallocr.c +$(lpfx)reallocr.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_REALLOC -c $< -o $@ -$(lpfx)callocr.o: mallocr.c +$(lpfx)callocr.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_CALLOC -c $< -o $@ -$(lpfx)cfreer.o: mallocr.c +$(lpfx)cfreer.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_CFREE -c $< -o $@ -$(lpfx)malignr.o: mallocr.c +$(lpfx)malignr.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_MEMALIGN -c $< -o $@ -$(lpfx)vallocr.o: mallocr.c +$(lpfx)vallocr.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_VALLOC -c $< -o $@ -$(lpfx)pvallocr.o: mallocr.c +$(lpfx)pvallocr.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_PVALLOC -c $< -o $@ -$(lpfx)mallinfor.o: mallocr.c +$(lpfx)mallinfor.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_MALLINFO -c $< -o $@ -$(lpfx)mallstatsr.o: mallocr.c +$(lpfx)mallstatsr.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_MALLOC_STATS -c $< -o $@ -$(lpfx)msizer.o: mallocr.c +$(lpfx)msizer.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $< -o $@ -$(lpfx)malloptr.o: mallocr.c +$(lpfx)malloptr.o: _mallocr.c $(LIB_COMPILE) -DDEFINE_MALLOPT -c $< -o $@ $(lpfx)dtoa.o: dtoa.c mprec.h diff --git a/newlib/libc/stdlib/mallocr.c b/newlib/libc/stdlib/_mallocr.c similarity index 100% rename from newlib/libc/stdlib/mallocr.c rename to newlib/libc/stdlib/_mallocr.c -- 2.34.1