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-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 4329F1F9FD for ; Wed, 3 Mar 2021 00:29:19 +0000 (UTC) Received: from localhost ([::1]:37264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHFO9-0003YD-Qd for normalperson@yhbt.net; Tue, 02 Mar 2021 19:29:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHFO1-0003WR-1h for bug-gnulib@gnu.org; Tue, 02 Mar 2021 19:29:09 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:36456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHFNw-0003tA-8m for bug-gnulib@gnu.org; Tue, 02 Mar 2021 19:29:08 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A18EE16010F for ; Tue, 2 Mar 2021 16:29:00 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ATV4YhSNqSbh; Tue, 2 Mar 2021 16:28:59 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C8A8816008D; Tue, 2 Mar 2021 16:28:59 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vAar5u-5YvQs; Tue, 2 Mar 2021 16:28:59 -0800 (PST) Received: from penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A64F5160086; Tue, 2 Mar 2021 16:28:59 -0800 (PST) From: Paul Eggert To: bug-gnulib@gnu.org Subject: [PATCH] mbrtowc: port to AIX 7.1 with xlc 12.1 Date: Tue, 2 Mar 2021 16:28:55 -0800 Message-Id: <20210303002855.5819-1-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-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" Fix a problem with locks when building GNU Tar (Savannah commit 55f2a0772e08b9febac3ac0de5cb048d4c60d2f5) on AIX 7.1 with IBM XL C/C++ V12.1 using =E2=80=98./configure CC=3Dxlc=E2=80=99. The link fails= due to missing definitions of pthread_mutex_lock and pthread_mutex_unlock. GNU Tar uses unlocked-io and so should not need to worry about multithreading or locks. * lib/mbtowc-lock.h (mbtowc_with_lock) [USE_UNLOCKED_IO]: Don=E2=80=99t bother with locks, since this app is single-threaded. There may be similar linking problems with lib/nl_langinfo.c and lib/setlocale_null.c but my GNU Tar build didn=E2=80=99t run into them, s= o I left them alone for now. --- ChangeLog | 15 +++++++++++++++ lib/mbtowc-lock.h | 10 +++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0304f6958..7ba436925 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2021-03-02 Paul Eggert + + mbrtowc: port to AIX 7.1 with xlc 12.1 + Fix a problem with locks when building GNU Tar (Savannah commit + 55f2a0772e08b9febac3ac0de5cb048d4c60d2f5) on AIX 7.1 with IBM XL + C/C++ V12.1 using =E2=80=98./configure CC=3Dxlc=E2=80=99. The link fai= ls due to + missing definitions of pthread_mutex_lock and + pthread_mutex_unlock. GNU Tar uses unlocked-io and so + should not need to worry about multithreading or locks. + * lib/mbtowc-lock.h (mbtowc_with_lock) [USE_UNLOCKED_IO]: + Don=E2=80=99t bother with locks, since this app is single-threaded. + There may be similar linking problems with lib/nl_langinfo.c and + lib/setlocale_null.c but my GNU Tar build didn=E2=80=99t run into them,= so + I left them alone for now. + 2021-03-01 Paul Eggert =20 unlocked-io: do not redefine getc_unlocked etc. diff --git a/lib/mbtowc-lock.h b/lib/mbtowc-lock.h index 696b12c58..b7c5ba8a0 100644 --- a/lib/mbtowc-lock.h +++ b/lib/mbtowc-lock.h @@ -32,7 +32,15 @@ mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m= ) /* Prohibit renaming this symbol. */ #undef gl_get_mbtowc_lock =20 -#if defined _WIN32 && !defined __CYGWIN__ +#ifdef USE_UNLOCKED_IO + +static int +mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m) +{ + return mbtowc_unlocked (pwc, p, m); +} + +#elif defined _WIN32 && !defined __CYGWIN__ =20 extern __declspec(dllimport) CRITICAL_SECTION *gl_get_mbtowc_lock (void)= ; =20 --=20 2.29.2