mach = "powerpcle-*-solaris2.[0-4]";
mach = "sparc-*-solaris2.[0-4]";
mach = "i[34567]86-sequent-ptx*";
- mach = "i[34567]86-sequent-sysv3*";
files = sys/byteorder.h;
replace = <<- _EndOfHeader_
#ifndef _SYS_BYTEORDER_H
/*
- * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V5 <sys/stat.h>.
+ * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 headers.
*/
fix = {
hackname = alpha___extern_prefix;
+ select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n(#[ \t]*pragma[ \t]*extern_prefix.*)";
+
+ mach = "alpha*-dec-osf*";
+ c_fix = format;
+ c_fix_arg = "%1 (defined(__DECC) || defined(__PRAGMA_EXTERN_PREFIX))\n%3";
+
+ test_text = "#ifdef __DECC\n"
+ "#pragma extern_prefix \"_P\"\n"
+ "# if defined(__DECC)\n"
+ "# pragma extern_prefix \"_E\"\n"
+ "# if !defined(_LIBC_POLLUTION_H_) && defined(__DECC)\n"
+ "# pragma extern_prefix \"\"";
+};
+
+
+/*
+ * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 <standards.h>.
+ */
+fix = {
+ hackname = alpha___extern_prefix_standards;
+ files = standards.h;
+ select = ".*!defined\\(_LIBC_POLLUTION_H_\\) && !defined\\(__DECC\\)";
+
+ mach = "alpha*-dec-osf*";
+ c_fix = format;
+ c_fix_arg = "%0 && !defined(__PRAGMA_EXTERN_PREFIX)";
+
+ test_text = "#if (_ISO_C_SOURCE>=19990L) && !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)";
+};
+
+
+/*
+ * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V5 <sys/mount.h> and
+ * <sys/stat.h>. The tests for __DECC are special in various ways, so
+ * alpha__extern_prefix cannot be used.
+ */
+fix = {
+ hackname = alpha___extern_prefix_sys_stat;
files = sys/stat.h;
+ files = sys/mount.h;
select = "#[ \t]*if[ \t]*defined\\(__DECC\\)";
mach = "alpha*-dec-osf5*";
fix = {
hackname = alpha_pthread;
files = pthread.h;
- select = "(#[ \t]*if defined \\(_PTHREAD_ENV_DECC\\) || defined \\(_PTHREAD_ENV_EPCC\\))\n"
+ select = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)|def _PTHREAD_ENV_DECC)(.*))\n"
"(#[ \t]*define _PTHREAD_USE_PTDNAM_)";
mach = "alpha*-dec-osf*";
c_fix = format;
- c_fix_arg = "%1 || defined (__PRAGMA_EXTERN_PREFIX)\n%2";
+ c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 || defined (__PRAGMA_EXTERN_PREFIX)\n%5";
test_text = "# if defined (_PTHREAD_ENV_DECC) || defined (_PTHREAD_ENV_EPCC)\n"
+ "# define _PTHREAD_USE_PTDNAM_\n"
+ "# endif\n"
+ "# ifdef _PTHREAD_ENV_DECC\n"
"# define _PTHREAD_USE_PTDNAM_\n"
"# endif";
};
+/*
+ * Recognize GCC in Tru64 UNIX V5.1B <pthread.h>.
+ */
+fix = {
+ hackname = alpha_pthread_gcc;
+ files = pthread.h;
+ select = "#else\n# error <pthread.h>: unrecognized compiler.";
+
+ mach = "alpha*-dec-osf*";
+ c_fix = format;
+ c_fix_arg = "#elif defined (__GNUC__)\n"
+ "# define _PTHREAD_ENV_GCC\n"
+ "%0";
+
+ test_text = "# define _PTHREAD_ENV_INTELC\n"
+ "#else\n"
+ "# error <pthread.h>: unrecognized compiler.\n"
+ "#endif";
+};
+
+
/*
* Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
* And OpenBSD.
};
+/*
+ * Change external names of wcstok/wcsftime via asm instead of macros on
+ * Tru64 UNIX V4.0.
+ */
+fix = {
+ hackname = alpha_wchar;
+ files = wchar.h;
+
+ mach = "alpha*-dec-osf4*";
+ select = "#define wcstok wcstok_r";
+ sed = "s@#define wcstok wcstok_r@extern wchar_t *wcstok __((wchar_t *, const wchar_t *, wchar_t **)) __asm__(\"wcstok_r\");@";
+ sed = "s@#define wcsftime __wcsftime_isoc@extern size_t wcsftime __((wchar_t *, size_t, const wchar_t *, const struct tm *)) __asm__(\"__wcsftime_isoc\");@";
+ test_text = "#define wcstok wcstok_r\n"
+ "#define wcsftime __wcsftime_isoc";
+};
+
+
/*
* For C++, avoid any typedef or macro definition of bool,
* and use the built in type instead.
select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
- files = libgen.h;
files = dirent.h;
files = ftw.h;
files = grp.h;
+ files = libgen.h;
files = ndbm.h;
files = pthread.h;
files = pwd.h;
files = signal.h;
files = standards.h;
+ files = stdio.h;
files = stdlib.h;
files = string.h;
files = stropts.h;
+ files = sys/mount.h;
+ files = sys/resource.h;
+ files = sys/signal.h;
+ files = sys/socket.h;
+ files = sys/stat.h;
+ files = sys/stropts.h;
+ files = sys/uio.h;
files = time.h;
files = unistd.h;
+ files = utmp.h;
+ files = utmpx.h;
+ files = wchar.h;
sed =
"s/^[ \t]*#[ \t]*define[ \t][ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
};
+/*
+ * __private_extern__ doesn't exist in FSF GCC. Even if it did,
+ * why would you ever put it in a system header file?
+ */
+fix = {
+ hackname = darwin_private_extern;
+ mach = "*-*-darwin*";
+ files = mach-o/dyld.h;
+ select = "__private_extern__ [a-z_]+ _dyld_";
+ c_fix = format;
+ c_fix_arg = "extern";
+ c_fix_arg = "__private_extern__";
+ test_text = "__private_extern__ int _dyld_func_lookup(\n"
+ "const char *dyld_func_name,\n"
+ "unsigned long *address);\n";
+};
+
+
/*
* Fix <c_asm.h> on Digital UNIX V4.0:
* It contains a prototype for a DEC C internal asm() function,
};
+/*
+ * Fix hpux 11.00 broken snprintf declaration
+ * (third argument is char *, needs to be const char * to prevent
+ * spurious warnings with -Wwrite-strings or in C++).
+ */
+fix = {
+ hackname = hpux11_snprintf;
+ files = stdio.h;
+ select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
+ ' *(char *\*, *\.\.\.\);)';
+ c_fix = format;
+ c_fix_arg = '%1 const %3';
+
+ test_text = "extern int snprintf(char *, size_t, char *, ...);\n"
+ "extern int snprintf(char *, __size_t, char *, ...);\n"
+ "extern int snprintf(char *, _hpux_size_t, char *, ...);";
+};
+
+
/*
* In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
* of UINT32_C has undefined behavior according to ISO/ANSI:
files = stdio.h;
files = internal/stdio_core.h;
- select = '(printf\(.*), /\* va_list \*/ char \*';
+ select = '/\* va_list \*/ char \*';
c_fix = format;
- c_fix_arg = "%1, __gnuc_va_list";
+ c_fix_arg = "__gnuc_va_list";
test_text =
"extern int printf( const char *, /* va_list */ char * );";
};
};
+/*
+ * obstack.h used casts as lvalues.
+ *
+ * We need to change postincrements of casted pointers (which are
+ * then dereferenced and assigned into) of the form
+ *
+ * *((TYPE*)PTRVAR)++ = (VALUE)
+ *
+ * into expressions like
+ *
+ * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
+ *
+ * which is correct for the cases used in obstack.h since PTRVAR is
+ * of type char * and the value of the expression is not used.
+ */
+fix = {
+ hackname = obstack_lvalue_cast;
+ files = obstack.h;
+ select = '\*\(\(([^()]*)\*\)(.*)\)\+\+ = \(([^()]*)\)';
+ c_fix = format;
+ c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
+ test_text = "*((void **) (h)->next_free)++ = (aptr)";
+};
+
+
/*
* sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
* defining regex.h related types. This causes libg++ build and usage
};
-/*
- * In pwd.h, PTX 1.x needs stdio.h included since FILE * was added in a
- * prototype later on in the file. (It's not clear that this is
- * still true, and even if it is, FILE * may be added after this fix runs by
- * fixproto.)
- */
-#ifdef PTX
-fix = {
- hackname = ptx_pwd_h;
- files = pwd.h;
- select = 'FILE \*';
- bypass = 'stdio.h';
- sed = "/#include <sys\\/types\\.h/a\\\n"
- "\\\n"
- "#if defined(__STDC__) || defined(__cplusplus)\\\n"
- "#include <stdio.h>\\\n"
- "#endif /* __STDC__ */\\\n"
- "\n";
- test_text = "#include <sys/types.h>\n"
- "void foo (FILE *)";
-};
-#endif
-
-
/*
* On DYNIX/ptx, sys/mc_param.h has an embedded asm for the cpuid instruction
* on the P5. This is not used by anything else so we ifdef it out.
fix = {
hackname = solaris_widec;
files = widec.h;
- mach = '*-*-solaris2.[0-5]*';
+ mach = '*-*-solaris2.[0-5]';
+ mach = '*-*-solaris2.[0-5].*';
bypass = "include.*wchar\\.h";
select = "#include <euc.h>";
c_fix = format;
* instead of va_list.
* Don't claim to have defined va_list.
*/
- sed = "s@ va_list @ __gnuc_va_list @\n"
- "s@ va_list)@ __gnuc_va_list)@\n"
- "s@va_list _ap;@__gnuc_va_list _ap;@\n"
+ sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
"s@(va_list)&@(__gnuc_va_list)\\&@\n"
"s@ _VA_LIST_));@ __gnuc_va_list));@\n"
"s@ __VA_LIST__));@ __gnuc_va_list));@\n"
* in any case. -- Nathanael */
mach = '*-*-sysv4*';
mach = 'i?86-sequent-ptx*';
- mach = 'i?86-sequent-sysv3*';
files = fs/rfs/rf_cache.h;
files = sys/erec.h;
files = sys/err.h;
/*
* Fix multiple defines for NULL. Sometimes, we stumble into \r\n
* terminated lines, so accommodate these. Test both ways.
+ * Don't bother to reproduce the \r\n termination, as GCC has to
+ * recognize \n termination anyway.
*/
fix = {
hackname = undefine_null;
bypass = "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
c_fix = format;
- c_fix_arg = "#ifndef NULL%2\n#define NULL%1%2\n#endif%2\n";
- c_fix_arg = "^#[ \t]*define[ \t]*[ \t]NULL([^\r\n]+)([\r]*)\n";
+ c_fix_arg = "#ifndef NULL\n#define NULL%1\n#endif\n";
+ c_fix_arg = "^#[ \t]*define[ \t]+NULL([^\r\n]+)[\r]*\n";
- test_text = "#define NULL 0UL\r\n#define NULL\t((void*)0)\n";
+ test_text = "#define NULL 0UL\r\n"
+ "#define NULL\t((void*)0)\n";
};
/*