From 888339e6484b40591bbc9728eb2c0228715889c1 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Sat, 25 Feb 2017 20:29:39 +0000 Subject: [PATCH] re PR target/68739 (FAIL: 30_threads/call_once/constexpr.cc (test for excess errors)) PR target/68739 * inclhack.def (hpux11_pthread_pointer): New fix. (hpux11_pthread_const): Adjust to remove void * cast from define. * fixincl.x: Regenerate. From-SVN: r245740 --- fixincludes/ChangeLog | 7 ++++ fixincludes/fixincl.x | 57 ++++++++++++++++++++++++---- fixincludes/inclhack.def | 24 ++++++++++-- fixincludes/tests/base/sys/pthread.h | 7 +++- 4 files changed, 84 insertions(+), 11 deletions(-) diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 218a5a23620..4f729dbf63a 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,10 @@ +2017-02-25 John David Anglin + + PR target/68739 + * inclhack.def (hpux11_pthread_pointer): New fix. + (hpux11_pthread_const): Adjust to remove void * cast from define. + * fixincl.x: Regenerate. + 2017-02-11 John David Anglin * tests/base/alloca.h: New file. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index ece2b87ce5b..c5be74f2832 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Saturday February 11, 2017 at 04:09:01 PM EST + * It has been AutoGen-ed Saturday February 25, 2017 at 03:25:44 PM EST * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat 11 Feb 2017 16:09:01 EST +/* DO NOT SVN-MERGE THIS FILE, EITHER Sat 25 Feb 2017 15:25:44 EST * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 247 fixup descriptions. + * This file contains 248 fixup descriptions. * * See README for more information. * @@ -4571,6 +4571,43 @@ static const char* apzHpux11_FabsfPatch[] = { #endif", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Hpux11_Pthread_Pointer fix + */ +tSCC zHpux11_Pthread_PointerName[] = + "hpux11_pthread_pointer"; + +/* + * File name selection pattern + */ +tSCC zHpux11_Pthread_PointerList[] = + "sys/pthread.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzHpux11_Pthread_PointerMachs[] = { + "*-hp-hpux11.[0-3]*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zHpux11_Pthread_PointerSelect0[] = + "(void[ \t]*\\*)(m|c|rw)(_ptr)"; + +#define HPUX11_PTHREAD_POINTER_TEST_CT 1 +static tTestDesc aHpux11_Pthread_PointerTests[] = { + { TT_EGREP, zHpux11_Pthread_PointerSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Hpux11_Pthread_Pointer + */ +static const char* apzHpux11_Pthread_PointerPatch[] = { + "format", + "long\t%2%3", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Hpux11_Pthread_Const fix @@ -4594,7 +4631,7 @@ tSCC* apzHpux11_Pthread_ConstMachs[] = { * content selection pattern - do fix if pattern found */ tSCC zHpux11_Pthread_ConstSelect0[] = - "^#define[ \t]*__POINTER_SET[ \t]*\\(\\(void \\*\\) 1LL\\)"; + "^(#define[ \t]+__POINTER_SET[ \t0,]*)(.*\\))"; #define HPUX11_PTHREAD_CONST_TEST_CT 1 static tTestDesc aHpux11_Pthread_ConstTests[] = { @@ -4605,7 +4642,7 @@ static tTestDesc aHpux11_Pthread_ConstTests[] = { */ static const char* apzHpux11_Pthread_ConstPatch[] = { "format", - "#define __POINTER_SET\t\t((void *) 1L)", + "%11", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * @@ -10102,9 +10139,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 284 +#define REGEX_COUNT 285 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 247 +#define FIX_COUNT 248 /* * Enumerate the fixes @@ -10216,6 +10253,7 @@ typedef enum { HPUX11_EXTERN_SENDFILE_FIXIDX, HPUX11_EXTERN_SENDPATH_FIXIDX, HPUX11_FABSF_FIXIDX, + HPUX11_PTHREAD_POINTER_FIXIDX, HPUX11_PTHREAD_CONST_FIXIDX, HPUX11_SIZE_T_FIXIDX, HPUX11_SNPRINTF_FIXIDX, @@ -10890,6 +10928,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { HPUX11_FABSF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aHpux11_FabsfTests, apzHpux11_FabsfPatch, 0 }, + { zHpux11_Pthread_PointerName, zHpux11_Pthread_PointerList, + apzHpux11_Pthread_PointerMachs, + HPUX11_PTHREAD_POINTER_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aHpux11_Pthread_PointerTests, apzHpux11_Pthread_PointerPatch, 0 }, + { zHpux11_Pthread_ConstName, zHpux11_Pthread_ConstList, apzHpux11_Pthread_ConstMachs, HPUX11_PTHREAD_CONST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index fd12062e165..8a5514ffcab 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -2366,16 +2366,34 @@ fix = { }; /* - * Fix C99 constant in __POINTER_SET define. + * The definitions for PTHREAD_MUTEX_INITIALIZER and similar initializers + * in pthread.h need to be constant expressions to be standard complient. + * As a result, we need to remove the void * casts in the initializers + * (see hpux11_pthread_const) and to change the __(M|C|RW)POINTER defines + * to use the long type. + */ +fix = { + hackname = hpux11_pthread_pointer; + mach = "*-hp-hpux11.[0-3]*"; + files = sys/pthread.h; + select = "(void[ \t]*\\*)(m|c|rw)(_ptr)"; + + c_fix = format; + c_fix_arg = "long\t%2%3"; + test_text = "#define __MPOINTER\t\tvoid\t *m_ptr"; +}; + +/* + * Remove void pointer cast and fix C99 constant in __POINTER_SET defines. */ fix = { hackname = hpux11_pthread_const; mach = "*-hp-hpux11.[0-3]*"; files = sys/pthread.h; - select = "^#define[ \t]*__POINTER_SET[ \t]*\\(\\(void \\*\\) 1LL\\)"; + select = "^(#define[ \t]+__POINTER_SET[ \t0,]*)(.*\\))"; c_fix = format; - c_fix_arg = "#define __POINTER_SET\t\t((void *) 1L)"; + c_fix_arg = "%11"; test_text = "#define __POINTER_SET\t\t((void *) 1LL)"; }; diff --git a/fixincludes/tests/base/sys/pthread.h b/fixincludes/tests/base/sys/pthread.h index 36f656eb6a6..2036580301b 100644 --- a/fixincludes/tests/base/sys/pthread.h +++ b/fixincludes/tests/base/sys/pthread.h @@ -14,8 +14,13 @@ #endif /* HPUX11_LWP_RWLOCK_VALID_CHECK */ +#if defined( HPUX11_PTHREAD_POINTER_CHECK ) +#define __MPOINTER long m_ptr +#endif /* HPUX11_PTHREAD_POINTER_CHECK */ + + #if defined( HPUX11_PTHREAD_CONST_CHECK ) -#define __POINTER_SET ((void *) 1L) +#define __POINTER_SET 1 #endif /* HPUX11_PTHREAD_CONST_CHECK */ -- 2.30.2