replace = "/* This file was generated by fixincludes. */\n"
"#ifndef _SYS_VARARGS_H\n"
"#define _SYS_VARARGS_H\n\n"
-
+
"#ifdef __STDC__\n"
"#include <stdarg.h>\n"
"#else\n"
"#include <varargs.h>\n"
"#endif\n\n"
-
+
"#endif /* _SYS_VARARGS_H */\n";
};
#endif
/*
* Completely replace <sys/byteorder.h>; with a file that implements gcc's
- * optimized byteswapping. Restricted to "SVR4" machines until either
- * it is shown to be safe to replace this file always, or we get bolder ;-)
+ * optimized byteswapping.
*/
fix = {
hackname = AAB_svr4_replace_byteorder;
-#ifndef SVR5
mach = "*-*-sysv4*";
mach = "i[34567]86-*-sysv5*";
+ mach = "i[34567]86-*-sco3.2v5*";
mach = "i[34567]86-*-udk*";
mach = "i[34567]86-*-solaris2.[0-4]";
mach = "powerpcle-*-solaris2.[0-4]";
mach = "sparc-*-solaris2.[0-4]";
-#endif /* SVR5 */
files = sys/byteorder.h;
replace = <<- _EndOfHeader_
#ifndef _SYS_BYTEORDER_H
/*
+ * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V5 <sys/stat.h>.
+ */
+fix = {
+ hackname = alpha___extern_prefix;
+ files = sys/stat.h;
+ select = "#[ \t]*if[ \t]*defined\\(__DECC\\)";
+
+ mach = "alpha*-dec-osf5*";
+ c_fix = format;
+ c_fix_arg = "%0 || defined(__PRAGMA_EXTERN_PREFIX)";
+
+ test_text = "# if defined(__DECC)";
+};
+
+
+/*
* Fix assert macro in assert.h on Alpha OSF/1.
* The superfluous int cast breaks C++.
*/
/*
+ * Various systems derived from BSD4.4 contain a macro definition
+ * for vfscanf that interacts badly with requirements of builtin-attrs.def.
+ * Known to be fixed in FreeBSD 5 system headers.
+ */
+fix = {
+ hackname = bsd_stdio_attrs_conflict;
+ mach = *-*-*bsd*;
+ mach = *-*-*darwin*;
+ files = stdio.h;
+ select = "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$";
+ c_fix = format;
+ c_fix_arg = '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n"
+ '#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n"
+ 'int vfscanf(FILE *, const char *, __builtin_va_list) '
+ '__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");';
+ test_text = '#define vfscanf __svfscanf';
+};
+
+
+/*
* Fix various macros used to define ioctl numbers.
* The traditional syntax was:
*
/*
+ * Fix hpux 10.X missing ctype declarations 1
+ */
+fix = {
+ hackname = hpux10_ctype_declarations1;
+ files = ctype.h;
+ select = "^#[ \t]*define _toupper\\(__c\\)[ \t]*__toupper\\(__c\\)";
+ bypass = "^[ \t]*extern[ \t]*int[ \t]*__tolower[ \t]*\\(";
+ c_fix = format;
+ c_fix_arg = "#ifdef _PROTOTYPES\n"
+ "extern int __tolower(int);\n"
+ "extern int __toupper(int);\n"
+ "#else /* NOT _PROTOTYPES */\n"
+ "extern int __tolower();\n"
+ "extern int __toupper();\n"
+ "#endif /* _PROTOTYPES */\n\n"
+ "%0\n";
+
+ test_text = "# define _toupper(__c) __toupper(__c)\n";
+};
+
+
+/*
+ * Fix hpux 10.X missing ctype declarations 2
+ */
+fix = {
+ hackname = hpux10_ctype_declarations2;
+ files = ctype.h;
+ select = "^# if defined\\(_SB_CTYPE_MACROS\\) && \\!defined\\(__lint\\)";
+ bypass = "^[ \t]*extern[ \t]*int[ \t]*_isalnum[ \t]*\\(";
+ c_fix = format;
+ c_fix_arg = "%0\n\n"
+ "#ifdef _PROTOTYPES\n"
+ " extern int _isalnum(int);\n"
+ " extern int _isalpha(int);\n"
+ " extern int _iscntrl(int);\n"
+ " extern int _isdigit(int);\n"
+ " extern int _isgraph(int);\n"
+ " extern int _islower(int);\n"
+ " extern int _isprint(int);\n"
+ " extern int _ispunct(int);\n"
+ " extern int _isspace(int);\n"
+ " extern int _isupper(int);\n"
+ " extern int _isxdigit(int);\n"
+ "# else /* not _PROTOTYPES */\n"
+ " extern int _isalnum();\n"
+ " extern int _isalpha();\n"
+ " extern int _iscntrl();\n"
+ " extern int _isdigit();\n"
+ " extern int _isgraph();\n"
+ " extern int _islower();\n"
+ " extern int _isprint();\n"
+ " extern int _ispunct();\n"
+ " extern int _isspace();\n"
+ " extern int _isupper();\n"
+ " extern int _isxdigit();\n"
+ "#endif /* _PROTOTYPES */\n";
+
+ test_text = "# if defined(_SB_CTYPE_MACROS) && !defined(__lint)\n"
+ " extern unsigned int *__SB_masks;\n";
+};
+
+
+/*
* Make sure hpux defines abs in header.
*/
fix = {
/*
+ * Fix hpux broken ctype macros
+ */
+fix = {
+ hackname = hpux_ctype_macros;
+ files = ctype.h;
+ select = '((: |\()__SB_masks \? )'
+ '(__SB_masks\[__(alnum|c)\] & _IS)';
+ c_fix = format;
+ c_fix_arg = "%1(int)%3";
+
+ test_text = ": __SB_masks ? __SB_masks[__alnum] & _ISCNTRL\n"
+ "# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS\n";
+};
+
+
+/*
+ * HP-UX long_double
+ */
+fix = {
+ hackname = hpux_long_double;
+ files = stdlib.h;
+ select = "extern[ \t]long_double[ \t]strtold";
+ bypass = "long_double_t";
+ sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
+ sed = "s/long_double/long double/g";
+
+ test_text = "# ifndef _LONG_DOUBLE\n"
+ "# define _LONG_DOUBLE\n"
+ " typedef struct {\n"
+ " unsigned int word1, word2, word3, word4;\n"
+ " } long_double;\n"
+ "# endif /* _LONG_DOUBLE */\n"
+ "extern long_double strtold(const char *, char **);\n";
+};
+
+
+/*
* HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
*/
fix = {
/*
+ * IRIX 6.5.1[89] <internal/sgimacros.h> unconditionally defines
+ * __restrict as restrict iff __c99. This is wrong for C++, which
+ * needs many C99 features, but only supports __restrict.
+ */
+fix = {
+ hackname = irix___restrict;
+ files = internal/sgimacros.h;
+ select = "(#ifdef __c99\n)(#[ \t]*define __restrict restrict)";
+
+ mach = "mips-sgi-irix6.5";
+ c_fix = format;
+ c_fix_arg = "%1"
+ "# ifndef __cplusplus\n%2\n# endif";
+
+ test_text = "#ifdef __c99\n# define __restrict restrict";
+};
+
+/*
* IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
* that causes the assembly preprocessor to complain about an
* unterminated character constant.
/*
+ * IRIX 6.5.1[78] <sys/socket.h> has a broken definition of socklen_t.
+ * Various socket function prototypes use different types instead,
+ * depending on the API in use (BSD, XPG4/5), but the socklen_t
+ * definition doesn't reflect this (SGI Bug Id 864477, fixed in
+ * IRIX 6.5.19).
+ */
+fix = {
+ hackname = irix_socklen_t;
+ files = sys/socket.h;
+ select = "(#define _SOCKLEN_T\n)(typedef u_int32_t socklen_t;)";
+
+ mach = "mips-sgi-irix6.5";
+ c_fix = format;
+ c_fix_arg = "%1"
+ "#if _NO_XOPEN4 && _NO_XOPEN5\n"
+ "typedef int socklen_t;\n"
+ "#else\n"
+ "%2\n"
+ "#endif /* _NO_XOPEN4 && _NO_XOPEN5 */";
+
+ test_text = "#define _SOCKLEN_T\ntypedef u_int32_t socklen_t;";
+};
+
+/*
* IRIX 5.x's stdio.h declares some functions that take a va_list as
* taking char *. However, GCC uses void * for va_list, so
* calling vfprintf with a va_list fails in C++. */
/*
+ * IRIX 6.5.19 <internal/wchar_core.h> provides the XPG4 variant of
+ * wcsftime by default. ISO C99 requires the XPG5 variant instead.
+ */
+fix = {
+ hackname = irix_wcsftime;
+ files = internal/wchar_core.h;
+ select = "#if _NO_XOPEN5\n(extern size_t[ \t]+wcsftime.*const char \*.*)";
+
+ mach = "mips-sgi-irix6.5";
+ c_fix = format;
+ c_fix_arg = "#if _NO_XOPEN5 && !defined(__c99)\n%1";
+
+ test_text = "#if _NO_XOPEN5\n"
+ "extern size_t wcsftime(wchar_t *, __SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, const struct tm *);";
+};
+
+/*
* Fixing ISC fmod declaration
*/
fix = {
* comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
* we find a #ifndef FLT_MIN we assume that all the required #ifndefs
* are there, and we do not add them ourselves.
+ *
+ * QNX Software Systems also guards the defines, but doesn't define
+ * FLT_MIN. Therefore, bypass the fix for *either* guarded FLT_MIN
+ * or guarded FLT_MAX.
*/
fix = {
hackname = limits_ifndefs;
files = "sys/limits.h";
files = "limits.h";
- bypass = "ifndef[ \t]+FLT_MIN";
+ bypass = "ifndef[ \t]+FLT_(MIN|MAX)";
c_fix = format;
c_fix_arg = "#ifndef %1\n%0\n#endif";
/*
+ * NetBSD has a semicolon after the ending '}' for some extern "C".
+ */
+fix = {
+ hackname = netbsd_extra_semicolon;
+ mach = *-*-netbsd*;
+ files = sys/cdefs.h;
+ select = "#define[ \t]*__END_DECLS[ \t]*};";
+
+ c_fix = format;
+ c_fix_arg = "#define __END_DECLS }";
+
+ test_text = "#define __END_DECLS };";
+};
+
+
+/*
* NeXT 3.2 adds const prefix to some math functions.
* These conflict with the built-in functions.
*/
/*
+ * On OpenServer and on UnixWare 7, <math.h> uses the native compiler
+ * __builtin_generic. We fix that usage to use the GCC equivalent.
+ * It also has a plethora of inline functions that conflict with libstdc++.
+ */
+fix = {
+ hackname = sco_math;
+ files = math.h;
+ files = ansi/math.h;
+ files = posix/math.h;
+ files = xpg4/math.h;
+ files = xpg4v2/math.h;
+ files = xpg4plus/math.h;
+ files = ods_30_compat/math.h;
+ files = oldstyle/math.h;
+ select = "inline double abs";
+ sed = "/#define.*__fp_class(a) \\\\/i\\\n"
+ "#ifndef __GNUC__\n";
+ sed =
+"/.*__builtin_generic/a\\\n"
+"#else\\\n"
+"#define __fp_class(a) \\\\\\\n"
+" __builtin_choose_expr(__builtin_types_compatible_p(typeof(a),long double),\\\\\\\n"
+" __fpclassifyl(a), \\\\\\\n"
+" __builtin_choose_expr(__builtin_types_compatible_p(typeof(a), float), \\\\\\\n"
+" __fpclassifyf(a),__fpclassify(a)))\\\n"
+"#endif";
+
+ sed = "/extern \"C\\+\\+\"/N;"
+ "/inline double abs/i\\\n"
+ "#ifndef __GNUC__\n";
+ sed = "/inline long double trunc/N;"
+ "/inline long double trunc.*}.*extern \"C\\+\\+\"/a\\\n"
+ "#endif /* ! __GNUC__ */";
+
+ test_text =
+ "#define __fp_class(a) \\\\\n"
+ " __builtin_generic(a,\"ld:__fplcassifyl;f:__fpclassifyf;:__fpclassify\")\n";
+
+};
+
+
+/*
+ * On SCO OpenServer prior to 5.0.7UP1, <sys/regset.h> and <ieeefp.h>
+ * have a clash on struct _fpstate and struct fpstate.
+ */
+fix = {
+ hackname = sco_regset;
+ files = sys/regset.h;
+ mach = "*-*-sco3.2v5*";
+ select = "(struct[ \t]+.*)fpstate";
+ c_fix = format;
+ c_fix_arg = "%1rsfpstate";
+
+ test_text =
+ "union u_fps {\n"
+ " struct\tfpstate\n"
+ " {\n"
+ " int whatever;\n"
+ " }\n"
+ "};\n"
+ "union _u_fps {\n"
+ " struct _fpstate\n"
+ " {\n"
+ " int whatever;\n"
+ " }\n"
+ "};\n";
+};
+
+
+/*
* The static functions lstat() and fchmod() in <sys/stat.h>
* cause G++ grief since they're not wrapped in "if __cplusplus".
*
"#ifdef __STDC__\n"
"static int\tstat(const char *__f, struct stat *__p) {\n"
"\treturn __stat32(__f, __p);\n"
- "}\n\n# else /* !__STDC__ */\n"
+ "}\n\n# else /* !__STDC__ THIS FAILS ON BSD SYSTEMS */\n"
"static int\tstat(__f, __p)\n"
"\tchar *__f;\n"
/*
+ * Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER
+ * incorrectly, so we replace them with versions that correspond to
+ * the definition. We also explicitly name this fix "1" and the next
+ * fix "2" because this one does not deal with the last field. This
+ * fix needs to run before the next.
+ */
+fix = {
+ hackname = solaris_mutex_init_1;
+ select = '@\(#\)pthread.h' "[ \t]+1.1[0-9][ \t]+9[567]/[0-9/]+ SMI";
+ files = pthread.h;
+ sed = "/define[ \t]*PTHREAD_MUTEX_INI/s/{0, 0,/{{{0}, 0}, {{{0}}},/\n"
+ "/define[ \t]*PTHREAD_COND_INI/s/{0,/{{{0},0},/";
+ test_text =
+ '#ident "@(#)pthread.h 1.16 97/05/05 SMI"'"\n"
+ "#define PTHREAD_MUTEX_INITIALIZER\t{0, 0, 0}\n"
+ "#define PTHREAD_COND_INITIALIZER\t{0, 0} /* */\n";
+};
+
+
+/*
* Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
* "0" for the last field of the pthread_mutex_t structure, which is
* of type upad64_t, which itself is typedef'd to int64_t, but with
* initializer to "{0}" instead
*/
fix = {
- hackname = solaris_mutex_init;
+ hackname = solaris_mutex_init_2;
select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
files = pthread.h;
c_fix = format;
* that is visible to any ANSI compiler using this include. Simply
* delete the lines that #define some string functions to internal forms.
*/
-#ifdef SVR4
fix = {
hackname = svr4_disable_opt;
files = string.h;
select = '#define.*__std_hdr_';
sed = '/#define.*__std_hdr_/d';
+ test_text = "#define strlen __std_hdr_strlen\n";
};
-#endif
/*
test_text =
"@(#)stat.h 6.1 (ULTRIX)\n"
"#define S_IFPORT S_IFIFO\n"
- "\tfstat(),\n";
+ "\tfstat(),\n/* THE INSERTION LINE FAILS ON BSD SYSTEMS */";
};
sed = "s/Widget new,/Widget c_new,/g";
test_text =
"struct wedge {\n"
- " Widget\told, new; /* fix the new */\n"
+ " Widget\told, new; /* fixinc check FAILS ON BSD */\n"
"};\nextern Wedged( Widget new, Widget old );";
};