From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id DDA0E1F8C6 for ; Wed, 8 Sep 2021 15:19:15 +0000 (UTC) Received: from localhost ([::1]:49832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNzM2-0000i6-ND for normalperson@yhbt.net; Wed, 08 Sep 2021 11:19:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNzHZ-0005sw-L1 for bug-gnulib@gnu.org; Wed, 08 Sep 2021 11:14:37 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.161]:15567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNzHX-0002kH-Ef for bug-gnulib@gnu.org; Wed, 08 Sep 2021 11:14:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1631114065; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=drr97yAA5RYXhNmm4JyxQAc5M8wmc9qLSiny+6iu3hg=; b=hqfosgD3QQUn0a0sH6K++aEB6g1WlAJ1vKsvUL9rggo3NluW+59h8XAZpQnY0BI2w0 T5y8OcIMAHSjdqHtU5fdaeB1UdE8XtbEo9M+5rVl9FlXukRSCDaba/7QMo7XwFkic54B tBzCex9qAyu7GSmhZkO3siVcRVdWPxP82CKDhmt21wHnHk6gOkWrmKmRYNzBTUg7YqtP m08ej+ltw9qt1eXimmGyhYhpTq0MtoYpGUqu641/heYc3//LkLuXFpmYETnxYrbPv3tW 9UlBUJEEdBKGpOKjB7Ay2GX55aFb2X0DbjliTRYDhGg/pjO8mt14yfSiObpWcYCxD4VL n4tg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94z26ll5ip69owxEf1wz0BgQYe1Ufo32CKDn9DQ==" X-RZG-CLASS-ID: mo00 Received: from omega.localnet by smtp.strato.de (RZmta 47.33.1 AUTH) with ESMTPSA id c0304dx88FEPSx1 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 8 Sep 2021 17:14:25 +0200 (CEST) From: Bruno Haible To: bug-gnulib@gnu.org, landfillbaby69@gmail.com Subject: Re: [PATCH] string, wchar: avoid some namespace pollution Date: Wed, 08 Sep 2021 17:14:24 +0200 Message-ID: <2891542.ucjEoNaZvj@omega> In-Reply-To: <20210908005632.100624-1-eggert@cs.ucla.edu> References: <20210908005632.100624-1-eggert@cs.ucla.edu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Received-SPF: none client-ip=81.169.146.161; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Hi Paul, > * lib/string.in.h, lib/wchar.in.h: > (free): Declare by hand instead of including stdlib.h. This does not look right to me. There are two cases: (A) REPLACE_FREE is 0. Then it is OK to declare it by hand, because gnulib uses the system's free() function. (B) REPLACE_FREE is 1. (This is the case on most non-glibc systems.) Then gnulib's overrides 'free', by doing #define free rpl_free This means that the system's free() function is no longer visible after some user code does '#include '. If the user code now does #include #include then Gnulib's will have declared that the result of strdup() (or rpl_strdup()) must be deallocated through the system's free() function. But the user cannot access this function any more. So he will get a GCC (=E2=89=A5 11) warning always! This would be avoided if the user code does the includes in the opposite order: #include #include because then, strdup() gets associated with 'rpl_free', not the system's 'free'. But the user is free to arrange their #includes in the order they want (except for which must always come first). > This avoids some namespace pollution. Yes, avoiding namespace pollution is desirable. But so far I don't see how to make it coexist with correct rpl_free handling. Bruno