From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1298) id 0C883385841A; Sun, 16 Jan 2022 09:23:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C883385841A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Olivier Hainque To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6610] Add VxWorks fixincludes hack, #include sysLib.h in time.h X-Act-Checkin: gcc X-Git-Author: Olivier Hainque X-Git-Refname: refs/heads/master X-Git-Oldrev: 00cc412660fe4d64c0b04da9ae20b1ad6ef92bb0 X-Git-Newrev: 943fad67028c7164ddf9f818877394f74c06f254 Message-Id: <20220116092301.0C883385841A@sourceware.org> Date: Sun, 16 Jan 2022 09:23:01 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Jan 2022 09:23:01 -0000 https://gcc.gnu.org/g:943fad67028c7164ddf9f818877394f74c06f254 commit r12-6610-g943fad67028c7164ddf9f818877394f74c06f254 Author: Olivier Hainque Date: Thu Jan 6 17:28:20 2022 +0000 Add VxWorks fixincludes hack, #include sysLib.h in time.h Make sure there is a visible prototype of sysClkRateGet() when CLOCKS_PER_SEC is #defined to that in time.h for VxWorks. This would typically be provided by sysLib.h. 2021-01-10 Olivier Hainque * inclhack.def (vxworks_time_h_syslib): New hack. * tests/base/time.h: Update. * fixincl.x: Regenerate. Diff: --- fixincludes/fixincl.x | 55 +++++++++++++++++++++++++++++++++++++++---- fixincludes/inclhack.def | 32 +++++++++++++++++++++++++ fixincludes/tests/base/time.h | 15 ++++++++++++ 3 files changed, 97 insertions(+), 5 deletions(-) diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index a83fa2f5819..4389ac81a26 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 January 15, 2022 at 10:53:02 PM by AutoGen 5.18.16 + * It has been AutoGen-ed January 15, 2022 at 10:53:57 PM by AutoGen 5.18.16 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jan 15 22:53:02 UTC 2022 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jan 15 22:53:57 UTC 2022 * * 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 264 fixup descriptions. + * This file contains 265 fixup descriptions. * * See README for more information. * @@ -10586,6 +10586,45 @@ static const char* apzVxworks_Iolib_Include_UnistdPatch[] = { "#include ", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Vxworks_Time_H_Syslib fix + */ +tSCC zVxworks_Time_H_SyslibName[] = + "vxworks_time_h_syslib"; + +/* + * File name selection pattern + */ +tSCC zVxworks_Time_H_SyslibList[] = + "time.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzVxworks_Time_H_SyslibMachs[] = { + "*-*-vxworks*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zVxworks_Time_H_SyslibSelect0[] = + "[ \t]*#define[ \t]+CLOCKS_PER_SEC[ \t]+sysClkRateGet.*"; + +#define VXWORKS_TIME_H_SYSLIB_TEST_CT 1 +static tTestDesc aVxworks_Time_H_SyslibTests[] = { + { TT_EGREP, zVxworks_Time_H_SyslibSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Vxworks_Time_H_Syslib + */ +static const char* apzVxworks_Time_H_SyslibPatch[] = { + "format", + "%0\n\ +#include ", + "#include |#endif.* _YVALS.*", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of X11_Class fix @@ -10756,9 +10795,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 303 +#define REGEX_COUNT 304 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 264 +#define FIX_COUNT 265 /* * Enumerate the fixes @@ -11024,6 +11063,7 @@ typedef enum { VXWORKS_TIME_FIXIDX, VXWORKS_WRITE_CONST_FIXIDX, VXWORKS_IOLIB_INCLUDE_UNISTD_FIXIDX, + VXWORKS_TIME_H_SYSLIB_FIXIDX, X11_CLASS_FIXIDX, X11_CLASS_USAGE_FIXIDX, X11_NEW_FIXIDX, @@ -12331,6 +12371,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { VXWORKS_IOLIB_INCLUDE_UNISTD_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aVxworks_Iolib_Include_UnistdTests, apzVxworks_Iolib_Include_UnistdPatch, 0 }, + { zVxworks_Time_H_SyslibName, zVxworks_Time_H_SyslibList, + apzVxworks_Time_H_SyslibMachs, + VXWORKS_TIME_H_SYSLIB_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aVxworks_Time_H_SyslibTests, apzVxworks_Time_H_SyslibPatch, 0 }, + { zX11_ClassName, zX11_ClassList, apzX11_ClassMachs, X11_CLASS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 27564788561..60d7fd6d78b 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -5356,6 +5356,38 @@ fix = { test_text = "#include \"unistd.h\""; }; +/* + * Make sure there is a visible prototype of sysClkRateGet() when + * CLOCKS_PER_SEC is #defined to that in time.h for VxWorks. This would + * typically be provided by sysLib.h. + * + * The new #include has to come after the one for vxWorks.h in kernel headers + * and vxWorks.h is typically not #included in RTP headers. yvals.h is + * conditionally included in the latter, instead, and new #include are better + * inserted after that. + */ +fix = { + hackname = vxworks_time_h_syslib; + files = time.h; + mach = "*-*-vxworks*"; + select = "[ \t]*#define[ \t]+CLOCKS_PER_SEC[ \t]+sysClkRateGet.*"; + + c_fix = format; + c_fix_arg = "%0\n#include "; + c_fix_arg = "#include |#endif.* _YVALS.*"; + + test_text = + "/* kernel header pattern: */\n" + "#include \n" + "\n" + "/* rtp header pattern: */\n" + "#ifndef _YVALS\n" + "#include \n" + "#endif /* _YVALS */\n" + "\n" + "#define CLOCKS_PER_SEC sysClkRateGet()"; +}; + /* * There are several name conflicts with C++ reserved words in X11 header * files. These are fixed in some versions, so don't do the fixes if diff --git a/fixincludes/tests/base/time.h b/fixincludes/tests/base/time.h index cf22e2014d6..e0252bd85d1 100644 --- a/fixincludes/tests/base/time.h +++ b/fixincludes/tests/base/time.h @@ -25,3 +25,18 @@ typedef void (*__gcc_VOIDFUNCPTR) (); #endif #define VOIDFUNCPTR __gcc_VOIDFUNCPTR #endif /* VXWORKS_TIME_CHECK */ + + +#if defined( VXWORKS_TIME_H_SYSLIB_CHECK ) +/* kernel header pattern: */ +#include +#include + +/* rtp header pattern: */ +#ifndef _YVALS +#include +#endif /* _YVALS */ +#include + +#define CLOCKS_PER_SEC sysClkRateGet() +#endif /* VXWORKS_TIME_H_SYSLIB_CHECK */