mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-25 01:55:33 +08:00
Add VxWorks fixincludes hack, open posix API for C++
When system headers expose a strict "open" prototype with 3 args, arrange to expose a C++ overload with only two. 2021-01-10 Olivier Hainque <hainque@adacore.com> * inclhack.def (vxworks_math_h_fp_c99): New hack. * tests/base/fcntl.h: Update. * fixincl.x: Regenerate.
This commit is contained in:
parent
943fad6702
commit
9d7e19255c
@ -2,11 +2,11 @@
|
||||
*
|
||||
* DO NOT EDIT THIS FILE (fixincl.x)
|
||||
*
|
||||
* It has been AutoGen-ed January 15, 2022 at 10:53:57 PM by AutoGen 5.18.16
|
||||
* It has been AutoGen-ed January 15, 2022 at 10:54:24 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:57 UTC 2022
|
||||
/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jan 15 22:54:24 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 265 fixup descriptions.
|
||||
* This file contains 266 fixup descriptions.
|
||||
*
|
||||
* See README for more information.
|
||||
*
|
||||
@ -10469,6 +10469,53 @@ static const char* apzVxworks_RegsPatch[] = {
|
||||
"#include <arch/../regs.h>",
|
||||
(char*)NULL };
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Description of Vxworks_Posix_Open fix
|
||||
*/
|
||||
tSCC zVxworks_Posix_OpenName[] =
|
||||
"vxworks_posix_open";
|
||||
|
||||
/*
|
||||
* File name selection pattern
|
||||
*/
|
||||
tSCC zVxworks_Posix_OpenList[] =
|
||||
"fcntl.h\0";
|
||||
/*
|
||||
* Machine/OS name selection pattern
|
||||
*/
|
||||
tSCC* apzVxworks_Posix_OpenMachs[] = {
|
||||
"*-*-vxworks*",
|
||||
(const char*)NULL };
|
||||
|
||||
/*
|
||||
* content selection pattern - do fix if pattern found
|
||||
*/
|
||||
tSCC zVxworks_Posix_OpenSelect0[] =
|
||||
"extern int.*open \\(const char \\*[ a-z]*, int[ a-z]*, int[ a-z]*\\);";
|
||||
|
||||
#define VXWORKS_POSIX_OPEN_TEST_CT 1
|
||||
static tTestDesc aVxworks_Posix_OpenTests[] = {
|
||||
{ TT_EGREP, zVxworks_Posix_OpenSelect0, (regex_t*)NULL }, };
|
||||
|
||||
/*
|
||||
* Fix Command Arguments for Vxworks_Posix_Open
|
||||
*/
|
||||
static const char* apzVxworks_Posix_OpenPatch[] = {
|
||||
"format",
|
||||
"%0\n\n\
|
||||
#if defined(__cplusplus)\n\
|
||||
extern \"C++\" {\n\
|
||||
inline int open (const char *, int) __attribute__((__always_inline__));\n\n\
|
||||
inline int\n\
|
||||
open (const char *name, int flags)\n\
|
||||
{\n\
|
||||
return open (name, flags, 0);\n\
|
||||
}\n\
|
||||
}\n\
|
||||
#endif\n",
|
||||
(char*)NULL };
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Description of Vxworks_Time fix
|
||||
@ -10795,9 +10842,9 @@ static const char* apzX11_SprintfPatch[] = {
|
||||
*
|
||||
* List of all fixes
|
||||
*/
|
||||
#define REGEX_COUNT 304
|
||||
#define REGEX_COUNT 305
|
||||
#define MACH_LIST_SIZE_LIMIT 187
|
||||
#define FIX_COUNT 265
|
||||
#define FIX_COUNT 266
|
||||
|
||||
/*
|
||||
* Enumerate the fixes
|
||||
@ -11060,6 +11107,7 @@ typedef enum {
|
||||
VXWORKS_NEEDS_VXWORKS_FIXIDX,
|
||||
VXWORKS_NEXT_YVALS_FIXIDX,
|
||||
VXWORKS_REGS_FIXIDX,
|
||||
VXWORKS_POSIX_OPEN_FIXIDX,
|
||||
VXWORKS_TIME_FIXIDX,
|
||||
VXWORKS_WRITE_CONST_FIXIDX,
|
||||
VXWORKS_IOLIB_INCLUDE_UNISTD_FIXIDX,
|
||||
@ -12356,6 +12404,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
|
||||
VXWORKS_REGS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
|
||||
aVxworks_RegsTests, apzVxworks_RegsPatch, 0 },
|
||||
|
||||
{ zVxworks_Posix_OpenName, zVxworks_Posix_OpenList,
|
||||
apzVxworks_Posix_OpenMachs,
|
||||
VXWORKS_POSIX_OPEN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
|
||||
aVxworks_Posix_OpenTests, apzVxworks_Posix_OpenPatch, 0 },
|
||||
|
||||
{ zVxworks_TimeName, zVxworks_TimeList,
|
||||
apzVxworks_TimeMachs,
|
||||
VXWORKS_TIME_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
|
||||
|
@ -5296,6 +5296,47 @@ fix = {
|
||||
test_text = "#include <regs.h>\n";
|
||||
};
|
||||
|
||||
/*
|
||||
* Likewise, open's posix interface allows two or three arguments and
|
||||
* some VxWorks headers expose only a strict 3 arguments version. Merely
|
||||
* changing the prototype into a varargs one is risky as the implementation
|
||||
* would receive garbage in the third arg for calls providing only two,
|
||||
* which libstdc++ does. We simply provide an always inline overload for C++
|
||||
* instead.
|
||||
*
|
||||
* Both fcntl.h and ioLib.h might "feature" such a prototype for _WRS_KERNEL.
|
||||
* The latter #includes the former though (since 1992 according to the embedded
|
||||
* log), so just leave ioLib.h alone.
|
||||
*/
|
||||
fix = {
|
||||
hackname = vxworks_posix_open;
|
||||
mach = "*-*-vxworks*";
|
||||
files = fcntl.h;
|
||||
|
||||
select = "extern int.*open \\(const char \\*[ a-z]*, int[ a-z]*, int[ a-z]*\\);";
|
||||
c_fix = format;
|
||||
c_fix_arg = << _EOArg_
|
||||
%0
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C++" {
|
||||
inline int open (const char *, int) __attribute__((__always_inline__));
|
||||
|
||||
inline int
|
||||
open (const char *name, int flags)
|
||||
{
|
||||
return open (name, flags, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
_EOArg_;
|
||||
|
||||
test_text =
|
||||
"extern int open (const char *, int, int);\n"
|
||||
"extern int open (const char *name, int flags, int mode );\n";
|
||||
};
|
||||
|
||||
/*
|
||||
* Another bad dependency in VxWorks 5.2 <time.h>.
|
||||
*/
|
||||
|
@ -18,6 +18,39 @@ extern "C" {
|
||||
#if defined( AAB_AIX_FCNTL_CHECK )
|
||||
|
||||
#endif /* AAB_AIX_FCNTL_CHECK */
|
||||
|
||||
|
||||
#if defined( VXWORKS_POSIX_OPEN_CHECK )
|
||||
extern int open (const char *, int, int);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C++" {
|
||||
inline int open (const char *, int) __attribute__((__always_inline__));
|
||||
|
||||
inline int
|
||||
open (const char *name, int flags)
|
||||
{
|
||||
return open (name, flags, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int open (const char *name, int flags, int mode );
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C++" {
|
||||
inline int open (const char *, int) __attribute__((__always_inline__));
|
||||
|
||||
inline int
|
||||
open (const char *name, int flags)
|
||||
{
|
||||
return open (name, flags, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* VXWORKS_POSIX_OPEN_CHECK */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user