From patchwork Tue Apr 23 23:13:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [netbsd] Define TARGET_D_CRITSEC_SIZE for D language X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 17724 Message-Id: To: gcc-patches Date: Wed, 24 Apr 2019 01:13:44 +0200 From: Iain Buclaw List-Id: Hi, This patch adds missing implementation of TARGET_D_CRITSEC_SIZE, which would be noticed when using any bare synchronized statements. I couldn't see any target-specific alternatives of pthread_mutex_t in netbsd headers, so the condition should be right. OK for trunk? -- Iain --- gcc/ChangeLog: 2019-04-24 Iain Buclaw * config/netbsd-d.c (netbsd_d_critsec_size): New function. (TARGET_D_CRITSEC_SIZE): Define as netbsd_d_critsec_size. diff --git a/gcc/config/netbsd-d.c b/gcc/config/netbsd-d.c index 76342aacae3..c49366dc23b 100644 --- a/gcc/config/netbsd-d.c +++ b/gcc/config/netbsd-d.c @@ -28,6 +28,8 @@ along with GCC; see the file COPYING3. If not see #include "d/d-target.h" #include "d/d-target-def.h" +/* Implement TARGET_D_OS_VERSIONS for NetBSD targets. */ + static void netbsd_d_os_builtins (void) { @@ -35,7 +37,19 @@ netbsd_d_os_builtins (void) d_add_builtin_version ("NetBSD"); } +/* Implement TARGET_D_CRITSEC_SIZE for NetBSD targets. */ + +static unsigned +netbsd_d_critsec_size (void) +{ + /* This is the sizeof pthread_mutex_t. */ + return (POINTER_SIZE == 64) ? 48 : 28; +} + #undef TARGET_D_OS_VERSIONS #define TARGET_D_OS_VERSIONS netbsd_d_os_builtins +#undef TARGET_D_CRITSEC_SIZE +#define TARGET_D_CRITSEC_SIZE netbsd_d_critsec_size + struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;