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_HI,RCVD_IN_MSPIKE_H4,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 E9C311F5AE for ; Mon, 7 Jun 2021 19:31:29 +0000 (UTC) Received: from localhost ([::1]:53964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqKy8-0001eb-LL for normalperson@yhbt.net; Mon, 07 Jun 2021 15:31:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqKxr-0001bu-F4 for bug-gnulib@gnu.org; Mon, 07 Jun 2021 15:31:12 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.221]:34110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqKxo-0000ri-BY for bug-gnulib@gnu.org; Mon, 07 Jun 2021 15:31:11 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1623094265; cv=none; d=strato.com; s=strato-dkim-0002; b=lwjGv9Q6yYc4OkupWu5jorDYe5IFC8fiMrYHKcBSwRfYjJAfrG4b3Im26dfDNuQl+v pd2H5yrwOVaWxpIid/OfJKN4w+5aYBdvI60711IIdTFfk4hJWlEYXIPdgQdtNC54p4C5 2w2umKyks7FsYQatPFUBQlKUvH5FHG8fh4a/ITbYwzNAUkU2Qs151M3GILJqoRh+m1GN ljQqcKvFANaPoXzJqBSVxWG+prW6lyIu3axGWhFOfzJ9SlsAwsV4d9Zvo8lvlfzlDT/b wI5oohlDjJXP3D7UuZ+b60FWFE4gObwPQeAdZi/2dyVTyrseeZRQX2MHhTHC0fa9N9m7 drQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1623094265; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=pc8NcxolesOoxxZ/Yg2ELUu73L5AXkHOXyCYDIw9BCI=; b=AirxjTWPODek6NPqjtnYvzzQj9sLqVrZIyXcjtk1uvfxHfyl6LSiU9sPo1WyViiBhZ t6JjVwjwyqK69aMD7rHYPI0v5ULClLG/RQP5wB1xoULillOgzE2q/UirDEy3FmNUrNjL 7R331DVN0r9TJN22Ixwx9f5RXrcwJSd/7kiWEaT82DZ6zaPOiukJQF6JOAn0216Npnz2 gVzhEu7LVVwiugSlsjONiFpo4SrSH2EtEpNuonVFotsMgfBHPrC12CA2MAVhciEiRB7h sDDzsu/GoBYB/k7rF+PUHaCkoLgW7kEWffSvg5zU/Gwdu1yblHnn4aPPk9L6QvmTWHxe SXcw== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1623094265; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=pc8NcxolesOoxxZ/Yg2ELUu73L5AXkHOXyCYDIw9BCI=; b=HwogaXbBmNaxACYcSPHvMta8MxoY6YQMF8DbnFQWXCwzV+GIzxaOGFa2LxJFDQrBBC 8WdlrbfusCTK0wa990j1q96PmGCgkX9d2gCLJPosfAaMOOZyOwbya31KDsxsiYOQsgPy X0Bh+Wk7oPZuZVYENiPHcSpKlQ07G5Dv+Q5vILJ2Szqv3UJoizYJtAxGTaTj61Q2CPbC CEU0nub9DULI1yS3PC/+/eLSvW8FIIy2SPO1MpWOSTq2j+OWSVs4ADsLnOEYCvHQEAV/ te8ndPcaLdTWVPCN2JfxN40SRrvlp/9fqhTmR8Iul5s/jiaqHWy4HfFmZn6I8NGLH1Kt sJYQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOHqf3z5NW" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 47.27.2 DYNA|AUTH) with ESMTPSA id q0869dx57JV5Q9s (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Mon, 7 Jun 2021 21:31:05 +0200 (CEST) From: Bruno Haible To: bug-gnulib@gnu.org Subject: thread: Fix test link error on DragonFly BSD 6.0 Date: Mon, 07 Jun 2021 21:31:05 +0200 Message-ID: <2717359.GKeOqE04yk@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=81.169.146.221; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On DragonFly BSD 6.0, when compiling a testdir with CFLAGS=-g (no gcc optimizations), I get a link error: gcc -ggdb -o test-thread_self test-thread_self.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ../../gltests/../gllib/glthread/thread.h:323: error: undefined reference to 'pthread_create' collect2: error: ld returned 1 exit status *** Error code 1 (continuing) The reason is that glthread/thread.h contains a supposedly inline function 'gl_thread_create'. But on this platform, config.h defines #define _GL_EXTERN_INLINE_STDHEADER_BUG #define _GL_INLINE static _GL_UNUSED #define _GL_EXTERN_INLINE static _GL_UNUSED That is, no inlining is performed, and the reference to pthread_create ends up in the file test-thread_self.o. This patch fixes it, by moving the reference to pthread_create away from the header file. 2021-06-07 Bruno Haible thread: Fix test link error on DragonFly BSD 6.0. * lib/glthread/thread.c (gl_thread_create): Moved to here... * lib/glthread/thread.h (gl_thread_create): ...from here. (_GLTHREAD_THREAD_INLINE): Remove macro. Remove _GL_INLINE_HEADER_BEGIN/END invocations. diff --git a/lib/glthread/thread.c b/lib/glthread/thread.c index 38ba85d..de44932 100644 --- a/lib/glthread/thread.c +++ b/lib/glthread/thread.c @@ -20,7 +20,6 @@ #include /* Specification. */ -# define _GLTHREAD_THREAD_INLINE _GL_EXTERN_INLINE #include "glthread/thread.h" #include @@ -203,3 +202,15 @@ const gl_thread_t gl_null_thread /* = { .p = NULL } */; #endif /* ========================================================================= */ + +gl_thread_t +gl_thread_create (void *(*func) (void *arg), void *arg) +{ + gl_thread_t thread; + int ret; + + ret = glthread_create (&thread, func, arg); + if (ret != 0) + abort (); + return thread; +} diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h index 1de9dcb..3e84599 100644 --- a/lib/glthread/thread.h +++ b/lib/glthread/thread.h @@ -83,14 +83,6 @@ # endif #endif -#ifndef _GL_INLINE_HEADER_BEGIN - #error "Please include config.h first." -#endif -_GL_INLINE_HEADER_BEGIN -#ifndef _GLTHREAD_THREAD_INLINE -# define _GLTHREAD_THREAD_INLINE _GL_INLINE -#endif - /* ========================================================================= */ #if USE_ISOC_THREADS @@ -314,17 +306,7 @@ typedef int gl_thread_t; extern "C" { #endif -_GLTHREAD_THREAD_INLINE gl_thread_t -gl_thread_create (void *(*func) (void *arg), void *arg) -{ - gl_thread_t thread; - int ret; - - ret = glthread_create (&thread, func, arg); - if (ret != 0) - abort (); - return thread; -} +extern gl_thread_t gl_thread_create (void *(*func) (void *arg), void *arg); #define gl_thread_sigmask(HOW, SET, OSET) \ do \ { \ @@ -351,6 +333,4 @@ gl_thread_create (void *(*func) (void *arg), void *arg) } #endif -_GL_INLINE_HEADER_END - #endif /* _GLTHREAD_THREAD_H */