sed portability fixes in fixincludes

fixincludes/:
	PR testsuite/29737
	PR bootstrap/35938
	PR testsuite/39655
	* check.tpl: Fix typos.
	* README: Likewise.  Also, document that 'select' uses ERE.
	* mkheaders.in: Update copyright years in --version output.
	* inclhack.def (sco_math): Add missing final newline in sed
	script 'a', 'c', or 'i' commands, for BSD sed.
	(sco_math): In the text of 'a', 'c', or 'i' sed
	commands, prepend leading white space with a backslash to avoid
	the whitespace to be removed by BSD sed.
	(sco_math): Match plain 'C++' instead of 'C\+\+' in sed regex.
	(x11_new): Fix sed expression, for BSD sed.
	(glibc_mutex_init): Fix newlines in sed 's' command replacement
	part, for GNU sed 3.02 and Solaris sed.
	(glibc_mutex_init): Replace unportable \+ sed regex operator
	with \{1,\}.
	(glibc_c99_inline_2, glibc_mutex_init): Avoid unportable sed
	alternation \| regex operator.
	(solaris_complex): Remove superfluous backslashes from
	replacement string.  Replace \+ operator with \{1,\}.
	* tests/base/Xm/Traversal.h: This is fixed for BSD sed now.
	* fixincl.x: Regenerate.

From-SVN: r151518
This commit is contained in:
Ralf Wildenhues 2009-09-08 17:30:31 +00:00 committed by Ralf Wildenhues
parent fa8023742a
commit a3d3711969
7 changed files with 121 additions and 55 deletions

View File

@ -1,3 +1,29 @@
2009-09-08 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR testsuite/29737
PR bootstrap/35938
PR testsuite/39655
* check.tpl: Fix typos.
* README: Likewise. Also, document that 'select' uses ERE.
* mkheaders.in: Update copyright years in --version output.
* inclhack.def (sco_math): Add missing final newline in sed
script 'a', 'c', or 'i' commands, for BSD sed.
(sco_math): In the text of 'a', 'c', or 'i' sed
commands, prepend leading white space with a backslash to avoid
the whitespace to be removed by BSD sed.
(sco_math): Match plain 'C++' instead of 'C\+\+' in sed regex.
(x11_new): Fix sed expression, for BSD sed.
(glibc_mutex_init): Fix newlines in sed 's' command replacement
part, for GNU sed 3.02 and Solaris sed.
(glibc_mutex_init): Replace unportable \+ sed regex operator
with \{1,\}.
(glibc_c99_inline_2, glibc_mutex_init): Avoid unportable sed
alternation \| regex operator.
(solaris_complex): Remove superfluous backslashes from
replacement string. Replace \+ operator with \{1,\}.
* tests/base/Xm/Traversal.h: This is fixed for BSD sed now.
* fixincl.x: Regenerate.
2009-09-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR libfortran/41169

View File

@ -51,7 +51,7 @@ To make your fix, you will need to do several things:
the proper functioning of a different fix. Make sure your
fix is properly tested and it does what it is supposed to do.
6. Now that you have the right things happening, syncronize the
6. Now that you have the right things happening, synchronize the
$(srcdir)/tests/base directory with the $(builddir)/tests/res
directory. The output of "make check" will be some diffs that
should give you some hints about what to do.
@ -82,22 +82,23 @@ MAKING CHANGES TO INCLHACK.DEF
and "c-test" because they are performed internally:
* select - Run a regex on the contents of the file being considered.
All such regex-es must match.
All such regex-es must match. Matching is done with
extended regular expressions.
* bypass - Run a regex on the contents of the file being considered.
No such regex may match.
* c-test - call a function in fixtests.c. See that file.
* c_test - call a function in fixtests.c. See that file.
* files - the "fnmatch" pattern of the file(s) to examine for
the issue. There may be several copies of this attribute.
If the header lives in a /usr/include subdirectory, be
sure to include that subdirectory in the name. e.g. net/if.h
* mach - Match the output of config.conf against a series of fnmatch
* mach - Match the output of config.guess against a series of fnmatch
patterns. It must match at least one of the patterns, unless
"not-machine" has also been specified. In that case, the
config.conf output must not match any of the patterns.
config.guess output must not match any of the patterns.
The next test is relatively slow because it must be handled in a
separate shell process. Some platforms do not support server shells,
@ -113,7 +114,7 @@ MAKING CHANGES TO INCLHACK.DEF
1. Be positive for all header files that require the fix.
It is desireable to:
It is desirable to:
2. Be negative as often as possible whenever the fix is not
required, avoiding the process overhead.

View File

@ -1,7 +1,7 @@
[= autogen5 template sh=check.sh =]
[=
#
# This file contanes the shell template to run tests on the fixes
# This file contains the shell template to run tests on the fixes
#
=]#!/bin/sh

View File

@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
* It has been AutoGen-ed Wednesday September 2, 2009 at 04:57:56 PM MEST
* It has been AutoGen-ed Tuesday September 8, 2009 at 07:26:10 PM CEST
* From the definitions inclhack.def
* and the template file fixincl
*/
/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Sep 2 16:57:56 MEST 2009
/* DO NOT SVN-MERGE THIS FILE, EITHER Di 8. Sep 19:26:11 CEST 2009
*
* You must regenerate it. Use the ./genfixes script.
*
@ -2644,11 +2644,23 @@ static tTestDesc aGlibc_C99_Inline_2Tests[] = {
* Fix Command Arguments for Glibc_C99_Inline_2
*/
static const char* apzGlibc_C99_Inline_2Patch[] = { sed_cmd_z,
"-e", "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/#ifdef __GNUC_GNU_INLINE__\\\n\
"-e", "s/extern int \\(stat\\)/#ifdef __GNUC_GNU_INLINE__\\\n\
extern\\\n\
#endif\\\n\
__inline__ int \\1/",
"-e", "s/extern int __REDIRECT\\(_NTH\\|\\) (\\(stat\\|lstat\\|fstat\\)/#ifdef __GNUC_GNU_INLINE__\\\n\
"-e", "s/extern int \\([lf]stat\\)/#ifdef __GNUC_GNU_INLINE__\\\n\
extern\\\n\
#endif\\\n\
__inline__ int \\1/",
"-e", "s/extern int \\(mknod\\)/#ifdef __GNUC_GNU_INLINE__\\\n\
extern\\\n\
#endif\\\n\
__inline__ int \\1/",
"-e", "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/#ifdef __GNUC_GNU_INLINE__\\\n\
extern\\\n\
#endif\\\n\
__inline__ int __REDIRECT\\1 (\\2/",
"-e", "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/#ifdef __GNUC_GNU_INLINE__\\\n\
extern\\\n\
#endif\\\n\
__inline__ int __REDIRECT\\1 (\\2/",
@ -2774,15 +2786,25 @@ static tTestDesc aGlibc_Mutex_InitTests[] = {
* Fix Command Arguments for Glibc_Mutex_Init
*/
static const char* apzGlibc_Mutex_InitPatch[] = { sed_cmd_z,
"-e", "/define[ \t]\\+PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n\
"-e", "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n\
N\n\
s/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n\
}",
"-e", "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_\\(RECURSIVE\\|ERRORCHECK\\|ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/",
"-e", "s/{ \\(0, 0, 0, PTHREAD_MUTEX_\\(RECURSIVE\\|ERRORCHECK\\|ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/",
"-e", "/define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/N;s/^[ \t]*#[ \t]*\\(define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\n# \\1\\n { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\n# else\\n# \\1\\n { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\n# endif/",
"-e", "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/",
"-e", "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/",
"-e", "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/",
"-e", "s/{ \\(0, 0, 0, PTHREAD_MUTEX_\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/",
"-e", "s/{ \\(0, 0, 0, PTHREAD_MUTEX_\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/",
"-e", "s/{ \\(0, 0, 0, PTHREAD_MUTEX_\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/",
"-e", "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/N;s/^[ \t]*#[ \t]*\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n\
# \\1\\\n\
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n\
# else\\\n\
# \\1\\\n\
{ { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n\
# endif/",
"-e", "s/{ \\(0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/",
"-e", "/define[ \t]\\+PTHREAD_COND_INITIALIZER/s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/",
"-e", "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
@ -6165,15 +6187,15 @@ static const char* apzSco_MathPatch[] = { sed_cmd_z,
"-e", "/.*__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",
"-e", "/extern \"C\\+\\+\"/N;/inline double abs/i\\\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\n",
"-e", "/extern \"C++\"/N;/inline double abs/i\\\n\
#ifndef __GNUC__\n",
"-e", "/inline long double trunc/N;/inline long double trunc.*}.*extern \"C\\+\\+\"/a\\\n\
#endif /* ! __GNUC__ */",
"-e", "/inline long double trunc/N;/inline long double trunc.*}.*extern \"C++\"/a\\\n\
#endif /* ! __GNUC__ */\n",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
@ -6209,10 +6231,10 @@ static tTestDesc aSolaris_ComplexTests[] = {
* Fix Command Arguments for Solaris_Complex
*/
static const char* apzSolaris_ComplexPatch[] = { sed_cmd_z,
"-e", "s/#define[ \t]_Complex_I[ \t]_Complex_I/#define\t_Complex_I\t\\(__extension__ 1.0iF\\)/",
"-e", "s/#define[ \t]_Complex_I[ \t]_Complex_I/#define\t_Complex_I\t(__extension__ 1.0iF)/",
"-e", "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d",
"-e", "/#define[ \t]imaginary[ \t]_Imaginary/d",
"-e", "s/#define[ \t]I[ \t]\\+_Imaginary_I/#define\tI\t\t_Complex_I/",
"-e", "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
@ -8331,7 +8353,7 @@ static tTestDesc aX11_NewTests[] = {
static const char* apzX11_NewPatch[] = { sed_cmd_z,
"-e", "/Widget\told, new;/i\\\n\
#ifdef __cplusplus\\\n\
\tWidget\told, c_new;\\\n\
\\\tWidget\told, c_new;\\\n\
#else\n",
"-e", "/Widget\told, new;/a\\\n\
#endif\n",

View File

@ -1451,10 +1451,19 @@ fix = {
hackname = glibc_c99_inline_2;
files = sys/stat.h, '*/sys/stat.h';
select = "extern __inline__ int";
sed = "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/"
sed = "s/extern int \\(stat\\)/"
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
"__inline__ int \\1/";
sed = "s/extern int __REDIRECT\\(_NTH\\|\\) (\\(stat\\|lstat\\|fstat\\)/"
sed = "s/extern int \\([lf]stat\\)/"
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
"__inline__ int \\1/";
sed = "s/extern int \\(mknod\\)/"
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
"__inline__ int \\1/";
sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
"__inline__ int __REDIRECT\\1 (\\2/";
sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
"__inline__ int __REDIRECT\\1 (\\2/";
sed = "s/^extern __inline__ int/"
@ -1509,25 +1518,33 @@ fix = {
hackname = glibc_mutex_init;
files = pthread.h;
select = '\{ *\{ *0, *\} *\}';
sed = "/define[ \t]\\+PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
sed = "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
"N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
"\\(RECURSIVE\\|ERRORCHECK\\|ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
"\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
"\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
"\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
"\\(RECURSIVE\\|ERRORCHECK\\|ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
sed = "/define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
"\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
"\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
"\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
sed = "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
"N;s/^[ \t]*#[ \t]*"
"\\(define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
"[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\n"
"# \\1\\n"
" { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\n"
"# else\\n"
"# \\1\\n"
" { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\n"
"\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
"[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
"# \\1\\\n"
" { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
"# else\\\n"
"# \\1\\\n"
" { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
"# endif/";
sed = "s/{ \\(0, 0, 0, 0, 0, 0, "
"PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
sed = "/define[ \t]\\+PTHREAD_COND_INITIALIZER/"
sed = "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
"s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
test_text = <<- _EOText_
@ -3222,18 +3239,18 @@ fix = {
"/.*__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";
"\\ __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\n";
sed = "/extern \"C\\+\\+\"/N;"
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__ */";
"/inline long double trunc.*}.*extern \"C++\"/a\\\n"
"#endif /* ! __GNUC__ */\n";
test_text =
"#define __fp_class(a) \\\\\n"
@ -3253,10 +3270,10 @@ fix = {
files = complex.h;
select = "#define[ \t]_Complex_I[ \t]_Complex_I";
sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
"#define\t_Complex_I\t\\(__extension__ 1.0iF\\)/";
"#define\t_Complex_I\t(__extension__ 1.0iF)/";
sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
sed = "s/#define[ \t]I[ \t]\\+_Imaginary_I/#define\tI\t\t_Complex_I/";
sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
test_text = "#define _Complex_I _Complex_I\n"
"#define complex _Complex\n"
"#define _Imaginary_I _Imaginary_I\n"
@ -4438,7 +4455,7 @@ fix = {
sed = "/Widget\told, new;/i\\\n"
"#ifdef __cplusplus\\\n"
"\tWidget\told, c_new;\\\n"
"\\\tWidget\told, c_new;\\\n"
"#else\n";
sed = "/Widget\told, new;/a\\\n"
@ -4447,7 +4464,7 @@ fix = {
sed = "s/Widget new,/Widget c_new,/g";
test_text =
"struct wedge {\n"
" Widget\told, new; /* fixinc check FAILS ON BSD */\n"
" Widget\told, new;\n"
"};\nextern Wedged( Widget new, Widget old );";
};

View File

@ -41,7 +41,7 @@ fi
if [ x$1 = x--version ] ; then
echo "mkheaders (GCC) version $version"
echo "Copyright 2002, 2007 Free Software Foundation, Inc."
echo "Copyright 2002, 2007, 2009 Free Software Foundation, Inc."
echo "This program is free software; you may redistribute it under the"
echo "terms of the GNU General Public License. This program has"
echo "absolutely no warranty."

View File

@ -14,7 +14,7 @@ struct wedge {
#ifdef __cplusplus
Widget old, c_new;
#else
Widget old, new; /* fixinc check FAILS ON BSD */
Widget old, new;
#endif
};
extern Wedged( Widget c_new, Widget old );