_EndOfHeader_;
};
+/*
+ * SDKs for 10.13 and 10.14 omit the definitions for API_AVAILABLE where
+ * __attribute__((availability)) is not supported.
+ */
+fix = {
+ hackname = darwin_api_availability;
+ mach = "*-*-darwin*";
+ files = os/availability.h;
+ bypass = "__IPHONE_OS_VERSION_MIN_REQUIRED";
+ select =
+ " *#define __API_AVAILABLE.*\n"
+ " *#define __API_DEPRECATED.*\n"
+ " *#define __API_DEPRECATED_WITH_REPLACEMENT.*\n"
+ " *#define __API_UNAVAILABLE.*\n";
+ c_fix = format;
+ c_fix_arg =
+ " #define API_AVAILABLE(...)\n"
+ " #define API_DEPRECATED(...)\n"
+ " #define API_DEPRECATED_WITH_REPLACEMENT(...)\n"
+ " #define API_UNAVAILABLE(...)\n";
+ test_text =
+ "#define __API_AVAILABLE(...)\n"
+ "#define __API_DEPRECATED(...)\n"
+ "#define __API_DEPRECATED_WITH_REPLACEMENT(...)\n"
+ "#define __API_UNAVAILABLE(...)\n";
+};
+
/*
* This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
*/
mach = "*-*-vxworks*";
replace = <<- _EndOfHeader_
- #ifndef _ASSERT_H
+ #ifdef _ASSERT_H
+ #undef _ASSERT_H
+ #undef assert
+ #endif
+
#define _ASSERT_H
- #ifdef assert
- #undef assert
+ #ifdef __cplusplus
+ extern "C" {
#endif
#if defined(__STDC__) || defined(__cplusplus)
#define assert(test) ((void) \
((test) ? ((void)0) : \
- __assert("Assertion failed: " ASSERT_STRINGIFY(test) ", file " \
+ __assert("Assertion failed: " #test ", file " \
__FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n")))
#endif
+ #ifdef __cplusplus
+ }
#endif
_EndOfHeader_;
};
replace = <<- _EndOfHeader_
#ifndef _REGS_H
#define _REGS_H
+ /* regs.h depends on CPU_FAMILY being properly defined, which
+ is done by vxCpu.h. */
+ #include <types/vxCpu.h>
+ /* regs.h includes a CPU_FAMILY-specific header that requires
+ vxTypesOld.h to already have been included. Those headers
+ contain proper _ASMLANGUAGE guards around their typedefs,
+ but vxTypesOld.h itself does not. So we avoid including
+ vxTypesOld.h from assembly. */
+ #ifndef _ASMLANGUAGE
#include <types/vxTypesOld.h>
+ #endif
#include_next <arch/../regs.h>
#endif
_EndOfHeader_;
hackname = aix_externcpp1;
mach = "*-*-aix*";
files = "sys/socket.h";
- select = "#ifdef __cplusplus";
+ select = "#ifndef _KERNEL\n"
+ "#ifdef __cplusplus";
c_fix = format;
- c_fix_arg = "#ifdef __cplusplus\n"
+ c_fix_arg = "#ifndef _KERNEL\n"
+ "#ifdef __cplusplus\n"
"extern \"C++\" {";
- test_text = "#ifdef __cplusplus";
-
+ test_text = "#ifndef _KERNEL\n"
+ "#ifdef __cplusplus";
};
fix = {
hackname = aix_externcpp2;
mach = "*-*-aix*";
files = "sys/socket.h";
- select = "#else /\\* __cplusplus \\*/";
+ select = "#endif /\\* COMPAT_43 \\*/\n"
+ "#else /\\* __cplusplus \\*/";
c_fix = format;
- c_fix_arg = "} /* extern \"C++\" */\n"
+ c_fix_arg = "#endif /* COMPAT_43 */\n"
+ "} /* extern \"C++\" */\n"
"#else /* __cplusplus */";
- test_text = "#else /* __cplusplus */";
+ test_text = "#endif /* COMPAT_43 */\n"
+ "#else /* __cplusplus */";
+};
+/*
+ * inttypes.h STDC_FORMAT_MACROS
+ */
+fix = {
+ hackname = aix_inttypes;
+ mach = "*-*-aix*";
+ files = "sys/inttypes.h";
+ select = "#if !defined\\(__cplusplus\\) \\|\\| defined\\(__STDC_FORMAT_MACROS\\)";
+ c_fix = format;
+ c_fix_arg = "#if 1";
+ test_text = "#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)";
};
/*
hackname = aix_malloc;
mach = "*-*-aix*";
files = "malloc.h";
- select = "#ifdef __cplusplus";
+ select = "#ifdef __cplusplus\n"
+ "extern \"C\" \\{\n"
+ "[ \t]extern \"builtin\" char \\*__alloca \\(size_t\\);";
c_fix = format;
- c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))";
- test_text = "#ifdef __cplusplus";
+ c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))\n"
+ "extern \"C\" {\n"
+ "\textern \"builtin\" char *__alloca (size_t);";
+ test_text = "#ifdef __cplusplus\n"
+ "extern \"C\" {\n"
+ "\textern \"builtin\" char *__alloca (size_t);";
};
/*
"{ \\\\\n";
};
+
+/* On AIX 'typedef struct {<stuff>} * physadr_t;' needs to give the struct a
+ name for linkage purposes. Fortunately it is on exactly one
+ line. */
+fix = {
+ hackname = aix_physadr_t;
+ mach = "*-*-aix*";
+ files = sys/types.h;
+ select = "typedef[ \t]*struct[ \t]*([{][^}]*[}][ \t]*\\*[ \t]*physadr_t;)";
+ c_fix = format;
+ c_fix_arg = "typedef struct __physadr_s %1";
+ test_text = "typedef struct __physadr_s {";
+};
+
/*
* pthread.h on AIX 4.3.3 tries to define a macro without whitspace
* which violates a requirement of ISO C.
test_text = "#define valloc __linux_valloc";
};
+fix = {
+ hackname = aix_stdlib_vec_malloc;
+ mach = "*-*-aix*";
+ files = stdlib.h;
+ select = "#define[ \t]+malloc[ \t]+vec_malloc";
+ c_fix = format;
+ c_fix_arg = "extern void *malloc(size_t) __asm__(\"vec_malloc\");";
+ test_text = "#define malloc vec_malloc";
+};
+
+fix = {
+ hackname = aix_stdlib_vec_calloc;
+ mach = "*-*-aix*";
+ files = stdlib.h;
+ select = "#define[ \t]+calloc[ \t]+vec_calloc";
+ c_fix = format;
+ c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"vec_calloc\");";
+ test_text = "#define calloc vec_calloc";
+};
+
/*
* stdlib.h on AIX 4.3 declares strtof() with a non-const first argument.
*/
test_text = "typedef volatile int sig_atomic_t;";
};
+/*
+ * AIX unistd.h defines a static function with an empty parameter list.
+ */
+fix = {
+ hackname = aix_unistd;
+ mach = "*-*-aix*";
+ files = unistd.h;
+
+ select = "[ \t]+static[ \t]+int[ \t]+getdtablesize\\(\\)";
+ c_fix = format;
+ c_fix_arg = "\tstatic int\t\tgetdtablesize(void)";
+ test_text = " static int getdtablesize()";
+};
+
/*
* Fix __assert declaration in assert.h on Alpha OSF/1.
*/
};
/*
- * For the AAB_darwin7_9_long_double_funcs fix to be useful,
- * you have to not use "" includes.
+ * For the AAB_darwin7_9_long_double_funcs fix (and later fixes for long long)
+ * to be useful, the main math.h must use <> and not "" includes.
*/
fix = {
hackname = darwin_9_long_double_funcs_2;
- mach = "*-*-darwin7.9*";
+ mach = "*-*-darwin*";
files = math.h;
select = '#include[ \t]+\"';
c_fix = format;
c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
- test_text = '#include "architecture/ppc/math.h"';
+ test_text = '#include <architecture/ppc/math.h>';
};
/*
"(__GNUC_MINOR__ >= 1)\n";
};
+/*
+ * math.h hides the long long functions that are available on the system for
+ * 10.5 and 10.6 SDKs, we expect to use them in G++ without specifying a value
+ * for __STDC_VERSION__, or switching __STRICT_ANSI__ off.
+ */
+fix = {
+ hackname = darwin_ll_funcs_avail;
+ mach = "*-*-darwin*";
+ files = architecture/ppc/math.h, architecture/i386/math.h;
+ select = "#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*"
+ "__STRICT_ANSI__[^_]*__GNUC__[^\)]*";
+ sed = "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*"
+ "__STRICT_ANSI__[^_]*__GNUC__[^\\)]*\)/#if\ !\(__DARWIN_NO_LONG_LONG\)/";
+ test_text = "#if\ !(__DARWIN_NO_LONG_LONG)";
+};
+
/*
* Before Mac OS X 10.8 <i386/setjmp.h> doesn't mark longjump noreturn.
*/
_EOText_;
};
+/*
+ * In macOS 10.10 <os/base.h>, doesn't have __has_extension guarded.
+ */
+fix = {
+ hackname = darwin_os_base_1;
+ mach = "*-*-darwin*";
+ files = os/base.h;
+ select = <<- OS_BASE_1_SEL
+#define __has_attribute.*
+#endif
+OS_BASE_1_SEL;
+ c_fix = format;
+ c_fix_arg = <<- OS_BASE_1_FIX
+%0
+#ifndef __has_extension
+#define __has_extension(x) 0
+#endif
+OS_BASE_1_FIX;
+ test_text = <<- OS_BASE_1_TEST
+#define __has_attribute(x) 0
+#endif
+
+#if __GNUC__
+OS_BASE_1_TEST;
+};
+
+/*
+ * In macOS 10.10 <dispatch/object.h>, has unguarded block syntax.
+ */
+fix = {
+ hackname = darwin_dispatch_object_1;
+ mach = "*-*-darwin*";
+ files = dispatch/object.h;
+ select = "typedef void.*\\^dispatch_block_t.*";
+ c_fix = format;
+ c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
+ test_text = <<- DISPATCH_OBJECT_1_TEST
+typedef void (^dispatch_block_t)(void);
+
+__BEGIN_DECLS
+DISPATCH_OBJECT_1_TEST;
+};
+
/*
* __private_extern__ doesn't exist in FSF GCC. Even if it did,
* why would you ever put it in a system header file?
"#define UINTMAX_C(v) (v ## ULL)";
};
+/* The SDK included with XCode 10.2 has the file <sys/ucred.h> that uses the
+ C11 _Atomic keyword (exposing it to C++ code). The work-around here follows
+ the header in declaring the entity volatile when _Atomic is not available.
+*/
+fix = {
+ hackname = darwin_ucred__Atomic;
+ mach = "*-*-darwin*";
+ files = sys/ucred.h;
+ select = "_Atomic";
+ c_fix = wrap;
+ c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n"
+ "# define _Atomic volatile\n"
+ "#endif\n";
+ c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n"
+ "# undef _Atomic\n"
+ "#endif\n";
+ test_text = ""; /* Don't provide this for wrap fixes. */
+};
+
/*
* Fix <c_asm.h> on Digital UNIX V4.0:
* It contains a prototype for a DEC C internal asm() function,
"# define UINT16_C(__c) ((unsigned short)(__c))\n";
};
+/*
+ * Fix broken and missing defines in inttypes.h
+ */
+fix = {
+ hackname = hpux_c99_inttypes3;
+ mach = "hppa*-hp-hpux11*";
+ files = inttypes.h;
+ select = "#define[ \t]INTPTR_MAX[ \t]*\n"
+ "#define[ \t]UINTPTR_MAX[ \t]*\n";
+ c_fix = format;
+ c_fix_arg = "#undef SIZE_MAX\n"
+ "#define SIZE_MAX __SIZE_MAX__\n"
+ "#ifdef __INTPTR_MAX__\n"
+ "# undef INTPTR_MAX\n"
+ "# define INTPTR_MAX __INTPTR_MAX__\n"
+ "# undef INTPTR_MIN\n"
+ "# define INTPTR_MIN (-INTPTR_MAX - 1)\n"
+ "#endif\n"
+ "#ifdef __UINTPTR_MAX__\n"
+ "# undef UINTPTR_MAX\n"
+ "# define UINTPTR_MAX __UINTPTR_MAX__\n"
+ "#endif\n";
+ test_text = "#define INTPTR_MAX\n"
+ "#define UINTPTR_MAX\n";
+};
+
+/*
+ * Fix missing SCNuMAX defines in inttypes.h
+ */
+fix = {
+ hackname = hpux_c99_inttypes4;
+ mach = "hppa*-hp-hpux11.[01]*";
+ files = inttypes.h;
+ sed = "/^[ \t]*#[ \t]*define[ \t]*SCNxMAX[ \t]*SCNx64/a\\\n"
+ "#define SCNuMAX \t SCNu64\n";
+ sed = "/^[ \t]*#[ \t]*define[ \t]*SCNxMAX[ \t]*SCNx32/a\\\n"
+ "#define SCNuMAX \t SCNu32\n";
+ test_text = "#define SCNxMAX SCNx64\n"
+ "#define SCNxMAX SCNx32\n";
+};
+
/*
* Fix hpux broken ctype macros
*/
c_fix = format;
c_fix_arg = "%0\n"
- "#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n";
+ "#define ioctl(fd, func, arg) ioctl(fd, func, (int)(arg))\n";
c_fix_arg = "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);";
test_text = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
test_text = "extern int write ( int , char * , size_t ) ;";
};
+/*
+ * This hack ensures the include_next in the fixed unistd.h actually
+ * finds the system's unistd.h and not the fixed unistd.h again.
+ */
+fix = {
+ hackname = vxworks_iolib_include_unistd;
+ files = ioLib.h;
+ mach = "*-*-vxworks*";
+ select = "#include \"unistd.h\"";
+
+ c_fix = format;
+ c_fix_arg = "#include <unistd.h>";
+
+ test_text = "#include \"unistd.h\"";
+};
+
/*
* 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