Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9c2725d5
Commit
9c2725d5
authored
Jan 04, 2014
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
makedep: Grow the include file array dynamically.
parent
78f544fd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
23 deletions
+32
-23
makedep.c
tools/makedep.c
+32
-23
No files found.
tools/makedep.c
View file @
9c2725d5
...
...
@@ -35,9 +35,6 @@
#endif
#include "wine/list.h"
/* Max first-level includes per file */
#define MAX_INCLUDES 200
struct
incl_file
{
struct
list
entry
;
...
...
@@ -48,7 +45,9 @@ struct incl_file
int
included_line
;
/* line where this file was included */
unsigned
int
flags
;
/* flags (see below) */
struct
incl_file
*
owner
;
struct
incl_file
*
files
[
MAX_INCLUDES
];
unsigned
int
files_count
;
/* files in use */
unsigned
int
files_size
;
/* total allocated size */
struct
incl_file
**
files
;
};
#define FLAG_SYSTEM 0x0001
/* is it a system include (#include <name>) */
...
...
@@ -550,15 +549,17 @@ static struct incl_file *find_include_file( const char *name )
*
* Add an include file if it doesn't already exists.
*/
static
struct
incl_file
*
add_include
(
struct
incl_file
*
p
File
,
const
char
*
name
,
int
system
)
static
struct
incl_file
*
add_include
(
struct
incl_file
*
p
arent
,
const
char
*
name
,
int
system
)
{
struct
incl_file
*
include
;
char
*
ext
;
int
pos
;
for
(
pos
=
0
;
pos
<
MAX_INCLUDES
;
pos
++
)
if
(
!
pFile
->
files
[
pos
])
break
;
if
(
pos
>=
MAX_INCLUDES
)
fatal_error
(
"too many included files, please fix MAX_INCLUDES
\n
"
);
if
(
parent
->
files_count
>=
parent
->
files_size
)
{
parent
->
files_size
*=
2
;
if
(
parent
->
files_size
<
16
)
parent
->
files_size
=
16
;
parent
->
files
=
xrealloc
(
parent
->
files
,
parent
->
files_size
*
sizeof
(
*
parent
->
files
)
);
}
/* enforce some rules for the Wine tree */
...
...
@@ -567,19 +568,19 @@ static struct incl_file *add_include( struct incl_file *pFile, const char *name,
if
(
!
strcmp
(
name
,
"config.h"
))
{
if
((
ext
=
strrchr
(
p
File
->
filename
,
'.'
))
&&
!
strcmp
(
ext
,
".h"
))
if
((
ext
=
strrchr
(
p
arent
->
filename
,
'.'
))
&&
!
strcmp
(
ext
,
".h"
))
fatal_error
(
"config.h must not be included by a header file
\n
"
);
if
(
p
os
)
if
(
p
arent
->
files_count
)
fatal_error
(
"config.h must be included before anything else
\n
"
);
}
else
if
(
!
strcmp
(
name
,
"wine/port.h"
))
{
if
((
ext
=
strrchr
(
p
File
->
filename
,
'.'
))
&&
!
strcmp
(
ext
,
".h"
))
if
((
ext
=
strrchr
(
p
arent
->
filename
,
'.'
))
&&
!
strcmp
(
ext
,
".h"
))
fatal_error
(
"wine/port.h must not be included by a header file
\n
"
);
if
(
!
p
os
)
fatal_error
(
"config.h must be included before wine/port.h
\n
"
);
if
(
p
os
>
1
)
if
(
!
p
arent
->
files_count
)
fatal_error
(
"config.h must be included before wine/port.h
\n
"
);
if
(
p
arent
->
files_count
>
1
)
fatal_error
(
"wine/port.h must be included before everything except config.h
\n
"
);
if
(
strcmp
(
p
File
->
files
[
0
]
->
name
,
"config.h"
))
if
(
strcmp
(
p
arent
->
files
[
0
]
->
name
,
"config.h"
))
fatal_error
(
"config.h must be included before wine/port.h
\n
"
);
}
...
...
@@ -589,12 +590,12 @@ static struct incl_file *add_include( struct incl_file *pFile, const char *name,
include
=
xmalloc
(
sizeof
(
*
include
)
);
memset
(
include
,
0
,
sizeof
(
*
include
)
);
include
->
name
=
xstrdup
(
name
);
include
->
included_by
=
p
File
;
include
->
included_by
=
p
arent
;
include
->
included_line
=
input_line
;
if
(
system
)
include
->
flags
|=
FLAG_SYSTEM
;
list_add_tail
(
&
includes
,
&
include
->
entry
);
found:
p
File
->
files
[
pos
]
=
include
;
p
arent
->
files
[
parent
->
files_count
++
]
=
include
;
return
include
;
}
...
...
@@ -1323,12 +1324,22 @@ static void add_generated_sources(void)
if
(
strendswith
(
source
->
name
,
".y"
))
{
file
=
add_generated_source
(
replace_extension
(
source
->
name
,
".y"
,
".tab.c"
),
NULL
);
memcpy
(
file
->
files
,
source
->
files
,
sizeof
(
file
->
files
)
);
/* steal the includes list from the source file */
file
->
files_count
=
source
->
files_count
;
file
->
files_size
=
source
->
files_size
;
file
->
files
=
source
->
files
;
source
->
files_count
=
source
->
files_size
=
0
;
source
->
files
=
NULL
;
}
if
(
strendswith
(
source
->
name
,
".l"
))
{
file
=
add_generated_source
(
replace_extension
(
source
->
name
,
".l"
,
".yy.c"
),
NULL
);
memcpy
(
file
->
files
,
source
->
files
,
sizeof
(
file
->
files
)
);
/* steal the includes list from the source file */
file
->
files_count
=
source
->
files_count
;
file
->
files_size
=
source
->
files_size
;
file
->
files
=
source
->
files
;
source
->
files_count
=
source
->
files_size
=
0
;
source
->
files
=
NULL
;
}
}
if
(
get_make_variable
(
"TESTDLL"
))
...
...
@@ -1350,8 +1361,7 @@ static void output_include( struct incl_file *pFile, struct incl_file *owner )
if
(
!
pFile
->
filename
)
return
;
pFile
->
owner
=
owner
;
output_filename
(
pFile
->
filename
);
for
(
i
=
0
;
i
<
MAX_INCLUDES
;
i
++
)
if
(
pFile
->
files
[
i
])
output_include
(
pFile
->
files
[
i
],
owner
);
for
(
i
=
0
;
i
<
pFile
->
files_count
;
i
++
)
output_include
(
pFile
->
files
[
i
],
owner
);
}
...
...
@@ -1614,8 +1624,7 @@ static struct strarray output_sources(void)
free
(
obj
);
free
(
sourcedep
);
for
(
i
=
0
;
i
<
MAX_INCLUDES
;
i
++
)
if
(
source
->
files
[
i
])
output_include
(
source
->
files
[
i
],
source
);
for
(
i
=
0
;
i
<
source
->
files_count
;
i
++
)
output_include
(
source
->
files
[
i
],
source
);
output
(
"
\n
"
);
}
...
...
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