Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
ba8fcfc3
Commit
ba8fcfc3
authored
May 14, 2000
by
Bruce Korb
Committed by
Bruce Korb
May 14, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement "wrap" c_fix
From-SVN: r33892
parent
3e6fa9ac
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
264 additions
and
109 deletions
+264
-109
gcc/ChangeLog
+11
-0
gcc/fixinc/check.diff
+84
-9
gcc/fixinc/fixfixes.c
+65
-13
gcc/fixinc/fixincl.x
+31
-34
gcc/fixinc/fixlib.c
+14
-0
gcc/fixinc/fixlib.h
+9
-8
gcc/fixinc/inclhack.def
+50
-45
No files found.
gcc/ChangeLog
View file @
ba8fcfc3
2000
-
05
-
14
Bruce
Korb
<
bkorb
@gnu
.
org
>
*
fixinc
/
fixfixes
.
c
(
wrap_fix
)
:
new
fix
-
inserts
text
before
and
/
or
after
current
text
of
file
*
fixinc
/
fixlib
.
c
(
must_malloc
)
:
*
fixinc
/
fixlib
.
h
(
must_malloc
)
:
+
reformatting
*
fixinc
/
inclhack
.
def
:
replace
the
"1i"
and
"$a"
sed
commands
with
usages
of
``
c_fix
=
wrap
;
''
*
fixinc
/
fixincl
.
x
:
regen
*
fixinc
/
check
.
diff
:
regen
Sun
May
14
17
:
58
:
59
2000
Hans
-
Peter
Nilsson
<
hp
@axis
.
com
>
Sun
May
14
17
:
58
:
59
2000
Hans
-
Peter
Nilsson
<
hp
@axis
.
com
>
*
mklibgcc
.
in
(
building
libgcc1
)
[
Xlibgcc1
.
a
]
:
Do
not
use
unset
*
mklibgcc
.
in
(
building
libgcc1
)
[
Xlibgcc1
.
a
]
:
Do
not
use
unset
...
...
gcc/fixinc/check.diff
View file @
ba8fcfc3
...
@@ -85,14 +85,30 @@
...
@@ -85,14 +85,30 @@
--- res/assert.h
--- res/assert.h
***************
***************
*** 1,3 ****
*** 1,3 ****
--- 1,7 ----
--- 1,13 ----
+ #ifndef FIXINC_BROKEN_ASSERT_STDLIB_CHECK
+ #define FIXINC_BROKEN_ASSERT_STDLIB_CHECK 1
+
+ #ifdef __cplusplus
+ #ifdef __cplusplus
+ #include <stdlib.h>
+ #include <stdlib.h>
+ #endif /* BROKEN_ASSERT_STDLIB_CHECK fix stamp */
+ #endif
+ #ifndef FIXINC_BROKEN_ASSERT_STDIO_CHECK
+ #define FIXINC_BROKEN_ASSERT_STDIO_CHECK 1
+
+ #include <stdio.h>
+ #include <stdio.h>
#ifndef BROKEN_ASSERT_STDIO_CHECK
#ifndef BROKEN_ASSERT_STDIO_CHECK
***************
*** 8,10 ****
--- 18,24 ----
#ifndef BROKEN_ASSERT_STDLIB_CHECK
extern void exit ( int );
#endif /* BROKEN_ASSERT_STDLIB_CHECK */
+
+ #endif /* FIXINC_BROKEN_ASSERT_STDIO_CHECK */
+
+ #endif /* FIXINC_BROKEN_ASSERT_STDLIB_CHECK */
*** inc/c_asm.h
*** inc/c_asm.h
--- res/c_asm.h
--- res/c_asm.h
***************
***************
...
@@ -140,10 +156,28 @@
...
@@ -140,10 +156,28 @@
#ifndef BAD_STRUCT_TERM_CHECK
#ifndef BAD_STRUCT_TERM_CHECK
! struct term;
! struct term;
#endif /* BAD_STRUCT_TERM_CHECK */
#endif /* BAD_STRUCT_TERM_CHECK */
*** inc/libgen.h
--- res/libgen.h
***************
*** 2,7 ****
#ifndef BAD_LVAL_CHECK
#pragma extern_prefix "_FOO"
! #define something(x,y,z) _FOOsomething(x,y,z)
#define mumble _FOOmumble
#endif /* BAD_LVAL_CHECK */
--- 2,7 ----
#ifndef BAD_LVAL_CHECK
#pragma extern_prefix "_FOO"
! #define something _FOOsomething
#define mumble _FOOmumble
#endif /* BAD_LVAL_CHECK */
*** inc/math.h
*** inc/math.h
--- res/math.h
--- res/math.h
***************
***************
*** 2,9 ****
*** 1,10 ****
#ifndef BROKEN_CABS_CHECK
#ifndef BROKEN_CABS_CHECK
#ifdef __STDC__
#ifdef __STDC__
...
@@ -152,7 +186,33 @@
...
@@ -152,7 +186,33 @@
- extern double cabs();
- extern double cabs();
#endif
#endif
#endif /* BROKEN_CABS_CHECK */
#endif /* BROKEN_CABS_CHECK */
--- 2,7 ----
--- 1,14 ----
+ #ifndef FIXINC_MATH_EXCEPTION_CHECK
+ #define FIXINC_MATH_EXCEPTION_CHECK 1
+
+ #ifdef __cplusplus
+ #define exception __math_exception
+ #endif
#ifndef BROKEN_CABS_CHECK
#ifdef __STDC__
#else
#endif
#endif /* BROKEN_CABS_CHECK */
***************
*** 12,14 ****
--- 16,23 ----
#ifndef MATH_EXCEPTION_CHECK
typedef struct exception t_math_exception;
#endif /* MATH_EXCEPTION_CHECK */
+ #ifdef __cplusplus
+ #undef exception
+ #endif
+
+ #endif /* FIXINC_MATH_EXCEPTION_CHECK */
*** inc/stdio.h
*** inc/stdio.h
--- res/stdio.h
--- res/stdio.h
***************
***************
...
@@ -169,7 +229,10 @@
...
@@ -169,7 +229,10 @@
int foo;
int foo;
#endif
#endif
#endif /* ISC_OMITS_WITH_STDC_CHECK */
#endif /* ISC_OMITS_WITH_STDC_CHECK */
--- 1,14 ----
--- 1,17 ----
+ #ifndef FIXINC_STDIO_STDARG_H_CHECK
+ #define FIXINC_STDIO_STDARG_H_CHECK 1
+
+ #define __need___va_list
+ #define __need___va_list
+ #include <stdarg.h>
+ #include <stdarg.h>
...
@@ -184,6 +247,14 @@
...
@@ -184,6 +247,14 @@
int foo;
int foo;
#endif
#endif
#endif /* ISC_OMITS_WITH_STDC_CHECK */
#endif /* ISC_OMITS_WITH_STDC_CHECK */
***************
*** 15,17 ****
--- 20,24 ----
#ifndef STDIO_STDARG_H_CHECK
#endif /* STDIO_STDARG_H_CHECK */
+
+ #endif /* FIXINC_STDIO_STDARG_H_CHECK */
*** inc/stdlib.h
*** inc/stdlib.h
--- res/stdlib.h
--- res/stdlib.h
***************
***************
...
@@ -275,11 +346,13 @@
...
@@ -275,11 +346,13 @@
--- res/sys/mman.h
--- res/sys/mman.h
***************
***************
*** 1,5 ****
*** 1,5 ****
--- 1,12 ----
--- 1,16 ----
+ #ifndef FIXINC_CXX_UNREADY_CHECK
+ #define FIXINC_CXX_UNREADY_CHECK 1
+
+ #ifdef __cplusplus
+ #ifdef __cplusplus
+ extern "C" {
+ extern "C" {
+ #endif /* CXX_UNREADY_CHECK */
+ #endif
+
#ifndef CXX_UNREADY_CHECK
#ifndef CXX_UNREADY_CHECK
...
@@ -287,7 +360,9 @@
...
@@ -287,7 +360,9 @@
#endif /* CXX_UNREADY_CHECK */
#endif /* CXX_UNREADY_CHECK */
+ #ifdef __cplusplus
+ #ifdef __cplusplus
+ }
+ }
+ #endif /* CXX_UNREADY_CHECK */
+ #endif
+
+ #endif /* FIXINC_CXX_UNREADY_CHECK */
*** inc/sys/param.h
*** inc/sys/param.h
--- res/sys/param.h
--- res/sys/param.h
***************
***************
...
...
gcc/fixinc/fixfixes.c
View file @
ba8fcfc3
...
@@ -19,7 +19,7 @@ Here are the rules:
...
@@ -19,7 +19,7 @@ Here are the rules:
2. Use the "FIX_PROC_HEAD()" macro _with_ the "_fix" suffix
2. Use the "FIX_PROC_HEAD()" macro _with_ the "_fix" suffix
(I cannot use the ## magic from ANSI C) for defining your entry point.
(I cannot use the ## magic from ANSI C) for defining your entry point.
3. Put your test name into the FIXUP_TABLE
3. Put your test name into the FIXUP_TABLE
.
4. Do not read anything from stdin. It is closed.
4. Do not read anything from stdin. It is closed.
...
@@ -27,17 +27,16 @@ Here are the rules:
...
@@ -27,17 +27,16 @@ Here are the rules:
In such an event, call "exit(1)".
In such an event, call "exit(1)".
6. You have access to the fixDescList entry for the fix in question.
6. You have access to the fixDescList entry for the fix in question.
This may be useful, for example, if there are
pre-compiled
This may be useful, for example, if there are
interesting strings
selection
expressions stored there.
or pre-compiled regular
expressions stored there.
For example, you may do this if you know that the first
It is also possible to access fix descriptions by using the
test contains a useful regex. This is okay because, remember,
index of a known fix, "my_fix_name" for example:
this code perforce works closely with the inclhack.def fixes!!
tFixDesc* pMyDesc
= fixDescList + MY_FIX_NAME_FIXIDX;
tFixDesc* p_desc
= fixDescList + MY_FIX_NAME_FIXIDX;
tTestDesc* pTestList = pMyD
esc->p_test_desc;
tTestDesc* p_tlist = p_d
esc->p_test_desc;
regexec (pTestL
ist->p_test_regex, ...)
regexec (p_tl
ist->p_test_regex, ...)
= = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = = = = = = = = =
...
@@ -66,10 +65,11 @@ typedef struct {
...
@@ -66,10 +65,11 @@ typedef struct {
}
fix_entry_t
;
}
fix_entry_t
;
#define FIXUP_TABLE \
#define FIXUP_TABLE \
_FT_( "format", format_fix ) \
_FT_( "char_macro_use", char_macro_use_fix ) \
_FT_( "char_macro_def", char_macro_def_fix ) \
_FT_( "char_macro_def", char_macro_def_fix ) \
_FT_( "machine_name", machine_name_fix )
_FT_( "char_macro_use", char_macro_use_fix ) \
_FT_( "format", format_fix ) \
_FT_( "machine_name", machine_name_fix ) \
_FT_( "wrap", wrap_fix )
#define FIX_PROC_HEAD( fix ) \
#define FIX_PROC_HEAD( fix ) \
...
@@ -234,6 +234,7 @@ FIX_PROC_HEAD( format_fix )
...
@@ -234,6 +234,7 @@ FIX_PROC_HEAD( format_fix )
fputs
(
text
,
stdout
);
fputs
(
text
,
stdout
);
}
}
/* Scan the input file for all occurrences of text like this:
/* Scan the input file for all occurrences of text like this:
#define TIOCCONS _IO(T, 12)
#define TIOCCONS _IO(T, 12)
...
@@ -332,7 +333,7 @@ FIX_PROC_HEAD( char_macro_use_fix )
...
@@ -332,7 +333,7 @@ FIX_PROC_HEAD( char_macro_use_fix )
you provide in the STR argument. */
you provide in the STR argument. */
FIX_PROC_HEAD
(
char_macro_def_fix
)
FIX_PROC_HEAD
(
char_macro_def_fix
)
{
{
/* This regexp looks for any traditional-syntax #define (# in col
umn 1).
*/
/* This regexp looks for any traditional-syntax #define (# in col
1).
*/
static
const
char
pat
[]
=
static
const
char
pat
[]
=
"^#[
\t
]*define[
\t
]+"
;
"^#[
\t
]*define[
\t
]+"
;
static
regex_t
re
;
static
regex_t
re
;
...
@@ -518,6 +519,57 @@ FIX_PROC_HEAD( machine_name_fix )
...
@@ -518,6 +519,57 @@ FIX_PROC_HEAD( machine_name_fix )
}
}
FIX_PROC_HEAD
(
wrap_fix
)
{
char
z_fixname
[
64
];
tCC
*
pz_src
=
p_fixd
->
fix_name
;
tCC
*
pz_name
=
z_fixname
;
char
*
pz_dst
=
z_fixname
;
size_t
len
=
0
;
for
(;;)
{
char
ch
=
*
(
pz_src
++
);
if
(
islower
(
ch
))
*
(
pz_dst
++
)
=
toupper
(
ch
);
else
if
(
isalnum
(
ch
))
*
(
pz_dst
++
)
=
ch
;
else
if
(
ch
==
NUL
)
{
*
(
pz_dst
++
)
=
ch
;
break
;
}
else
*
(
pz_dst
++
)
=
'_'
;
if
(
++
len
>=
sizeof
(
z_fixname
))
{
void
*
p
=
must_malloc
(
len
+
strlen
(
pz_src
)
+
1
);
memcpy
(
p
,
(
void
*
)
z_fixname
,
len
);
pz_name
=
(
tCC
*
)
p
;
pz_dst
=
(
char
*
)
pz_name
+
len
;
}
}
printf
(
"#ifndef FIXINC_%s_CHECK
\n
"
,
pz_name
);
printf
(
"#define FIXINC_%s_CHECK 1
\n\n
"
,
pz_name
);
if
(
p_fixd
->
patch_args
[
1
]
==
(
tCC
*
)
NULL
)
fputs
(
text
,
stdout
);
else
{
fputs
(
p_fixd
->
patch_args
[
1
],
stdout
);
fputs
(
text
,
stdout
);
if
(
p_fixd
->
patch_args
[
2
]
!=
(
tCC
*
)
NULL
)
fputs
(
p_fixd
->
patch_args
[
2
],
stdout
);
}
printf
(
"
\n
#endif /* FIXINC_%s_CHECK */
\n
"
,
pz_name
);
if
(
pz_name
!=
z_fixname
)
free
(
(
void
*
)
pz_name
);
}
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
test for fix selector
test for fix selector
...
...
gcc/fixinc/fixincl.x
View file @
ba8fcfc3
...
@@ -1173,7 +1173,7 @@ tTestDesc aBad_LvalTests[] = {
...
@@ -1173,7 +1173,7 @@ tTestDesc aBad_LvalTests[] = {
* Fix Command Arguments for Bad_Lval
* Fix Command Arguments for Bad_Lval
*/
*/
const char* apzBad_LvalPatch[] = { "sed",
const char* apzBad_LvalPatch[] = { "sed",
"-e", "s/^[ \t]*#[ \t]*define[ \t]
+\\([^(]*\\)\\(([^)]*)\\)[ \t]*\\(_.
\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/",
"-e", "s/^[ \t]*#[ \t]*define[ \t]
[ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*\\(_.*
\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/",
(char*)NULL };
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
/* * * * * * * * * * * * * * * * * * * * * * * * * *
...
@@ -1214,9 +1214,9 @@ tTestDesc aBroken_Assert_StdioTests[] = {
...
@@ -1214,9 +1214,9 @@ tTestDesc aBroken_Assert_StdioTests[] = {
/*
/*
* Fix Command Arguments for Broken_Assert_Stdio
* Fix Command Arguments for Broken_Assert_Stdio
*/
*/
const char* apzBroken_Assert_StdioPatch[] = {
"sed",
const char* apzBroken_Assert_StdioPatch[] = {
"
-e", "1i\\\n\
"
wrap",
#include <stdio.h>\n",
"
#include <stdio.h>\n",
(char*)NULL };
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
/* * * * * * * * * * * * * * * * * * * * * * * * * *
...
@@ -1257,11 +1257,11 @@ tTestDesc aBroken_Assert_StdlibTests[] = {
...
@@ -1257,11 +1257,11 @@ tTestDesc aBroken_Assert_StdlibTests[] = {
/*
/*
* Fix Command Arguments for Broken_Assert_Stdlib
* Fix Command Arguments for Broken_Assert_Stdlib
*/
*/
const char* apzBroken_Assert_StdlibPatch[] = {
"sed",
const char* apzBroken_Assert_StdlibPatch[] = {
"
-e", "1i\\\n\
"
wrap",
#ifdef __cplusplus\\
\n\
"#ifdef __cplusplus
\n\
#include <stdlib.h>\
\\
n\
#include <stdlib.h>\n\
#endif
/* BROKEN_ASSERT_STDLIB_CHECK fix stamp */
\n",
#endif\n",
(char*)NULL };
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
/* * * * * * * * * * * * * * * * * * * * * * * * * *
...
@@ -1466,16 +1466,14 @@ tTestDesc aCxx_UnreadyTests[] = {
...
@@ -1466,16 +1466,14 @@ tTestDesc aCxx_UnreadyTests[] = {
/*
/*
* Fix Command Arguments for Cxx_Unready
* Fix Command Arguments for Cxx_Unready
*/
*/
const char* apzCxx_UnreadyPatch[] = { "sed",
const char* apzCxx_UnreadyPatch[] = {
"-e", "1i\\\n\
"wrap",
#ifdef __cplusplus\\\n\
"#ifdef __cplusplus\n\
extern \"C\" {\\\n\
extern \"C\" {\n\
#endif /* CXX_UNREADY_CHECK */\\\n\
#endif\n",
\n",
"#ifdef __cplusplus\n\
"-e", "$a\\\n\
}\n\
#ifdef __cplusplus\\\n\
#endif\n",
}\\\n\
#endif /* CXX_UNREADY_CHECK */\n",
(char*)NULL };
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
/* * * * * * * * * * * * * * * * * * * * * * * * * *
...
@@ -2468,14 +2466,13 @@ tTestDesc aMath_ExceptionTests[] = {
...
@@ -2468,14 +2466,13 @@ tTestDesc aMath_ExceptionTests[] = {
/*
/*
* Fix Command Arguments for Math_Exception
* Fix Command Arguments for Math_Exception
*/
*/
const char* apzMath_ExceptionPatch[] = {
"sed",
const char* apzMath_ExceptionPatch[] = {
"
-e", "1i\\\n\
"
wrap",
#ifdef __cplusplus\\
\n\
"#ifdef __cplusplus
\n\
#define exception __math_exception\
\\
n\
#define exception __math_exception\n\
#endif\n",
#endif\n",
"-e", "$a\\\n\
"#ifdef __cplusplus\n\
#ifdef __cplusplus\\\n\
#undef exception\n\
#undef exception\\\n\
#endif\n",
#endif\n",
(char*)NULL };
(char*)NULL };
...
@@ -3292,9 +3289,9 @@ tTestDesc aStdio_Stdarg_HTests[] = {
...
@@ -3292,9 +3289,9 @@ tTestDesc aStdio_Stdarg_HTests[] = {
/*
/*
* Fix Command Arguments for Stdio_Stdarg_H
* Fix Command Arguments for Stdio_Stdarg_H
*/
*/
const char* apzStdio_Stdarg_HPatch[] = {
"sed",
const char* apzStdio_Stdarg_HPatch[] = {
"
-e", "1i\\\n\
"
wrap",
#define __need___va_list\\
\n\
"#define __need___va_list
\n\
#include <stdarg.h>\n",
#include <stdarg.h>\n",
(char*)NULL };
(char*)NULL };
...
@@ -4821,12 +4818,12 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
...
@@ -4821,12 +4818,12 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zBroken_Assert_StdioName, zBroken_Assert_StdioList,
{ zBroken_Assert_StdioName, zBroken_Assert_StdioList,
apzBroken_Assert_StdioMachs,
apzBroken_Assert_StdioMachs,
BROKEN_ASSERT_STDIO_TEST_CT, FD_MACH_ONLY,
BROKEN_ASSERT_STDIO_TEST_CT, FD_MACH_ONLY
| FD_SUBROUTINE
,
aBroken_Assert_StdioTests, apzBroken_Assert_StdioPatch },
aBroken_Assert_StdioTests, apzBroken_Assert_StdioPatch },
{ zBroken_Assert_StdlibName, zBroken_Assert_StdlibList,
{ zBroken_Assert_StdlibName, zBroken_Assert_StdlibList,
apzBroken_Assert_StdlibMachs,
apzBroken_Assert_StdlibMachs,
BROKEN_ASSERT_STDLIB_TEST_CT, FD_MACH_ONLY,
BROKEN_ASSERT_STDLIB_TEST_CT, FD_MACH_ONLY
| FD_SUBROUTINE
,
aBroken_Assert_StdlibTests, apzBroken_Assert_StdlibPatch },
aBroken_Assert_StdlibTests, apzBroken_Assert_StdlibPatch },
{ zBroken_CabsName, zBroken_CabsList,
{ zBroken_CabsName, zBroken_CabsList,
...
@@ -4856,7 +4853,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
...
@@ -4856,7 +4853,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zCxx_UnreadyName, zCxx_UnreadyList,
{ zCxx_UnreadyName, zCxx_UnreadyList,
apzCxx_UnreadyMachs,
apzCxx_UnreadyMachs,
CXX_UNREADY_TEST_CT, FD_MACH_ONLY,
CXX_UNREADY_TEST_CT, FD_MACH_ONLY
| FD_SUBROUTINE
,
aCxx_UnreadyTests, apzCxx_UnreadyPatch },
aCxx_UnreadyTests, apzCxx_UnreadyPatch },
{ zHpux_MaxintName, zHpux_MaxintList,
{ zHpux_MaxintName, zHpux_MaxintList,
...
@@ -4991,7 +4988,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
...
@@ -4991,7 +4988,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zMath_ExceptionName, zMath_ExceptionList,
{ zMath_ExceptionName, zMath_ExceptionList,
apzMath_ExceptionMachs,
apzMath_ExceptionMachs,
MATH_EXCEPTION_TEST_CT, FD_MACH_ONLY,
MATH_EXCEPTION_TEST_CT, FD_MACH_ONLY
| FD_SUBROUTINE
,
aMath_ExceptionTests, apzMath_ExceptionPatch },
aMath_ExceptionTests, apzMath_ExceptionPatch },
{ zMath_Huge_Val_From_Dbl_MaxName, zMath_Huge_Val_From_Dbl_MaxList,
{ zMath_Huge_Val_From_Dbl_MaxName, zMath_Huge_Val_From_Dbl_MaxList,
...
@@ -5101,7 +5098,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
...
@@ -5101,7 +5098,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zStdio_Stdarg_HName, zStdio_Stdarg_HList,
{ zStdio_Stdarg_HName, zStdio_Stdarg_HList,
apzStdio_Stdarg_HMachs,
apzStdio_Stdarg_HMachs,
STDIO_STDARG_H_TEST_CT, FD_MACH_ONLY,
STDIO_STDARG_H_TEST_CT, FD_MACH_ONLY
| FD_SUBROUTINE
,
aStdio_Stdarg_HTests, apzStdio_Stdarg_HPatch },
aStdio_Stdarg_HTests, apzStdio_Stdarg_HPatch },
{ zStdio_Va_ListName, zStdio_Va_ListList,
{ zStdio_Va_ListName, zStdio_Va_ListList,
...
...
gcc/fixinc/fixlib.c
View file @
ba8fcfc3
...
@@ -24,6 +24,20 @@ Boston, MA 02111-1307, USA. */
...
@@ -24,6 +24,20 @@ Boston, MA 02111-1307, USA. */
#include "fixlib.h"
#include "fixlib.h"
void
*
must_malloc
(
siz
)
size_t
siz
;
{
void
*
res
=
malloc
(
siz
);
if
(
res
==
(
void
*
)
NULL
)
{
fprintf
(
stderr
,
"fixincl failed to malloc %d bytes
\n
"
,
siz
);
exit
(
3
);
}
return
res
;
}
/* * * * * * * * * * * * *
/* * * * * * * * * * * * *
load_file_data loads all the contents of a file into malloc-ed memory.
load_file_data loads all the contents of a file into malloc-ed memory.
...
...
gcc/fixinc/fixlib.h
View file @
ba8fcfc3
...
@@ -138,14 +138,14 @@ typedef struct patch_desc tPatchDesc;
...
@@ -138,14 +138,14 @@ typedef struct patch_desc tPatchDesc;
typedef
struct
fix_desc
tFixDesc
;
typedef
struct
fix_desc
tFixDesc
;
struct
fix_desc
struct
fix_desc
{
{
const
char
*
fix_name
;
/* Name of the fix */
tCC
*
fix_name
;
/* Name of the fix */
const
char
*
file_list
;
/* List of files it applies to */
tCC
*
file_list
;
/* List of files it applies to */
const
char
**
papz_machs
;
/* List of machine/os-es it applies to */
tCC
**
papz_machs
;
/* List of machine/os-es it applies to */
int
test_ct
;
int
test_ct
;
int
fd_flags
;
int
fd_flags
;
tTestDesc
*
p_test_desc
;
tTestDesc
*
p_test_desc
;
const
char
**
patch_args
;
tCC
**
patch_args
;
long
unused
;
long
unused
;
};
};
/*
/*
...
@@ -155,6 +155,7 @@ char * load_file_data _P_(( FILE* fp ));
...
@@ -155,6 +155,7 @@ char * load_file_data _P_(( FILE* fp ));
t_bool
is_cxx_header
_P_
((
tCC
*
filename
,
tCC
*
filetext
));
t_bool
is_cxx_header
_P_
((
tCC
*
filename
,
tCC
*
filetext
));
void
compile_re
_P_
((
tCC
*
pat
,
regex_t
*
re
,
int
match
,
void
compile_re
_P_
((
tCC
*
pat
,
regex_t
*
re
,
int
match
,
tCC
*
e1
,
tCC
*
e2
));
tCC
*
e1
,
tCC
*
e2
));
void
*
must_malloc
_P_
((
size_t
));
void
apply_fix
_P_
((
tFixDesc
*
p_fixd
,
tCC
*
filname
));
void
apply_fix
_P_
((
tFixDesc
*
p_fixd
,
tCC
*
filname
));
apply_fix_p_t
run_test
_P_
((
tCC
*
t_name
,
tCC
*
f_name
,
tCC
*
text
));
apply_fix_p_t
run_test
_P_
((
tCC
*
t_name
,
tCC
*
f_name
,
tCC
*
text
));
...
...
gcc/fixinc/inclhack.def
View file @
ba8fcfc3
...
@@ -733,13 +733,13 @@ fix = {
...
@@ -733,13 +733,13 @@ fix = {
files = stropts.h;
files = stropts.h;
files = time.h;
files = time.h;
files = unistd.h;
files = unistd.h;
sed =
sed =
"s/^[ \t]*#[ \t]*define[ \t]
+
\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
"s/^[ \t]*#[ \t]*define[ \t]
[ \t]*
\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
"\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
"\\(_.
*
\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
test_text = '#pragma extern_prefix "_FOO"'"\n"
test_text = '#pragma extern_prefix "_FOO"'"\n"
"#define something(x,y,z) _FOOsomething(x,y,z)\n"
"#define something(x,y,z) _FOOsomething(x,y,z)\n"
"#define otherwise(x,y,z) BAR_Something(x,y,z)\n"
"#define mumble _FOOmumble";
"#define mumble _FOOmumble";
};
};
...
@@ -748,12 +748,12 @@ fix = {
...
@@ -748,12 +748,12 @@ fix = {
* check for broken assert.h that needs stdio.h
* check for broken assert.h that needs stdio.h
*/
*/
fix = {
fix = {
hackname = broken_assert_stdio;
hackname
= broken_assert_stdio;
files = assert.h;
files
= assert.h;
select = stderr;
select
= stderr;
bypass = "include.*stdio\\.h";
bypass
= "include.*stdio\\.h";
sed = "1i\\\n"
c_fix = wrap;
"#include <stdio.h>\n";
c_fix_arg =
"#include <stdio.h>\n";
test_text = "extern FILE* stderr;";
test_text = "extern FILE* stderr;";
};
};
...
@@ -762,14 +762,14 @@ fix = {
...
@@ -762,14 +762,14 @@ fix = {
* check for broken assert.h that needs stdlib.h
* check for broken assert.h that needs stdlib.h
*/
*/
fix = {
fix = {
hackname = broken_assert_stdlib;
hackname
= broken_assert_stdlib;
files = assert.h;
files
= assert.h;
select = 'exit *\(|abort *\(';
select
= 'exit *\(|abort *\(';
bypass = "include.*stdlib\\.h";
bypass
= "include.*stdlib\\.h";
sed = "1i\\\n"
c_fix = wrap;
"#ifdef __cplusplus\\
\n"
c_fix_arg = "#ifdef __cplusplus
\n"
"#include <stdlib.h>\\
\n"
"#include <stdlib.h>
\n"
"#endif /* BROKEN_ASSERT_STDLIB_CHECK fix stamp */
\n";
"#endif
\n";
test_text = "extern void exit ( int );";
test_text = "extern void exit ( int );";
};
};
...
@@ -861,18 +861,17 @@ fix = {
...
@@ -861,18 +861,17 @@ fix = {
hackname = cxx_unready;
hackname = cxx_unready;
files = sys/mman.h;
files = sys/mman.h;
files = rpc/types.h;
files = rpc/types.h;
select = '[^#]+malloc.*;'; /*
Should catch any form of a
declaration
select = '[^#]+malloc.*;'; /*
Catch any form of
declaration
but not mention
within a macro. */
not
within a macro. */
bypass = '"C"|__BEGIN_DECLS';
bypass = '"C"|__BEGIN_DECLS';
sed = "1i\\\n"
c_fix = wrap;
"#ifdef __cplusplus\\\n"
c_fix_arg = "#ifdef __cplusplus\n"
"extern \"C\" {\\\n"
"extern \"C\" {\n"
"#endif /* CXX_UNREADY_CHECK */\\\n\n";
"#endif\n";
sed = "$a\\\n"
c_fix_arg = "#ifdef __cplusplus\n"
"#ifdef __cplusplus\\\n"
"}\n"
"}\\\n"
"#endif\n";
"#endif /* CXX_UNREADY_CHECK */\n";
test_text = "extern void* malloc( size_t );";
test_text = "extern void* malloc( size_t );";
};
};
...
@@ -1310,18 +1309,21 @@ fix = {
...
@@ -1310,18 +1309,21 @@ fix = {
* additional references to struct exception.
* additional references to struct exception.
*/
*/
fix = {
fix = {
hackname = math_exception;
hackname = math_exception;
files = math.h;
files = math.h;
select = "struct exception";
select = "struct exception";
bypass = "We have a problem when using C\\+\\+";
bypass = "We have a problem when using C\\+\\+";
sed = "1i\\\n"
c_fix = wrap;
"#ifdef __cplusplus\\\n"
"#define exception __math_exception\\\n"
c_fix_arg = "#ifdef __cplusplus\n"
"#endif\n";
"#define exception __math_exception\n"
sed = "$a\\\n"
"#endif\n";
"#ifdef __cplusplus\\\n"
"#undef exception\\\n"
c_fix_arg = "#ifdef __cplusplus\n"
"#endif\n";
"#undef exception\n"
"#endif\n";
test_text = "typedef struct exception t_math_exception;";
};
};
fix = {
fix = {
...
@@ -1687,11 +1689,11 @@ fix = {
...
@@ -1687,11 +1689,11 @@ fix = {
files = stdio.h;
files = stdio.h;
bypass = "include.*(stdarg\.h|machine/ansi\.h)";
bypass = "include.*(stdarg\.h|machine/ansi\.h)";
sed = '1i\\
c_fix = wrap;
\#define __need___va_list\\
\#include <stdarg.h>
';
c_fix_arg = "#define __need___va_list\n#include <stdarg.h>\n";
test_text = "";
};
};
...
@@ -2038,8 +2040,11 @@ fix = {
...
@@ -2038,8 +2040,11 @@ fix = {
files = sys/cmn_err.h;
files = sys/cmn_err.h;
files = sys/kdebugger.h;
files = sys/kdebugger.h;
bypass = '_KERNEL';
bypass = '_KERNEL';
sed = "1i\\\n#ifdef _KERNEL";
c_fix = wrap;
sed = "$a\\\n#endif /* _KERNEL */";
c_fix_arg = "#ifdef _KERNEL\n";
c_fix_arg = "#endif /* _KERNEL */\n";
test_text = "";
};
};
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment