Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
CK
game-dev
amxmodx
Commits
4c90d796
Commit
4c90d796
authored
Apr 13, 2019
by
Artem Golubikhin
Browse files
Merge branch 'PRoSToC0der-fix-public-stock-var-always-used' into 'master'
Fixed public stock variables always used See merge request
!3
parents
ad9a6d67
9ed12a72
Changes
3
Hide whitespace changes
Inline
Side-by-side
compiler/libpc300/sc.h
View file @
4c90d796
...
...
@@ -97,6 +97,7 @@ typedef struct s_arginfo { /* function argument info */
}
array
;
}
defvalue
;
/* default value, or pointer to default array */
int
defvalue_tag
;
/* tag of the default value */
struct
s_symbol
*
defvalue_symbol
;
/* symbol of the default value, if refence or array */
}
arginfo
;
/* Equate table, tagname table, library table */
...
...
compiler/libpc300/sc1.c
View file @
4c90d796
...
...
@@ -1977,7 +1977,7 @@ static void declglb(char *firstname,int firsttag,int fpublic,int fstatic,int fst
sym
->
usage
|=
uDEFINE
;
}
/* if */
if
(
ispublic
)
sym
->
usage
|=
uPUBLIC
|
uREAD
;
sym
->
usage
|=
uPUBLIC
;
if
(
fconst
)
sym
->
usage
|=
uCONST
;
if
(
fstock
)
...
...
@@ -3660,6 +3660,7 @@ static int declargs(symbol *sym)
sym
->
dim
.
arglist
[
argcnt
].
hasdefault
=
FALSE
;
sym
->
dim
.
arglist
[
argcnt
].
defvalue
.
val
=
0
;
sym
->
dim
.
arglist
[
argcnt
].
defvalue_tag
=
0
;
sym
->
dim
.
arglist
[
argcnt
].
defvalue_symbol
=
NULL
;
sym
->
dim
.
arglist
[
argcnt
].
numtags
=
numtags
;
sym
->
dim
.
arglist
[
argcnt
].
tags
=
(
int
*
)
malloc
(
numtags
*
sizeof
tags
[
0
]);
if
(
sym
->
dim
.
arglist
[
argcnt
].
tags
==
NULL
)
...
...
@@ -3741,6 +3742,7 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
arg
->
hasdefault
=
FALSE
;
/* preset (most common case) */
arg
->
defvalue
.
val
=
0
;
/* clear */
arg
->
defvalue_tag
=
0
;
arg
->
defvalue_symbol
=
NULL
;
arg
->
numdim
=
0
;
if
(
matchtoken
(
'['
))
{
if
(
ident
==
iREFERENCE
)
...
...
@@ -3776,6 +3778,7 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
arg
->
defvalue
.
array
.
data
=
NULL
;
arg
->
defvalue
.
array
.
addr
=
sym
->
addr
;
arg
->
defvalue_tag
=
sym
->
tag
;
arg
->
defvalue_symbol
=
sym
;
if
(
sc_status
==
statWRITE
&&
(
sym
->
usage
&
uREAD
)
==
0
)
{
markusage
(
sym
,
uREAD
);
}
...
...
@@ -4326,7 +4329,7 @@ static void reduce_referrers(symbol *root)
}
/* if */
}
/* for */
}
else
if
((
sym
->
ident
==
iVARIABLE
||
sym
->
ident
==
iARRAY
)
&&
(
sym
->
usage
&
uPUBLIC
)
==
0
&&
!
(
(
sym
->
usage
&
uPUBLIC
)
!=
0
&&
(
sym
->
usage
&
uSTOCK
)
==
0
)
&&
sym
->
parent
==
NULL
&&
count_referrers
(
sym
)
==
0
)
{
...
...
compiler/libpc300/sc3.c
View file @
4c90d796
...
...
@@ -2226,6 +2226,11 @@ static int nesting=0;
pushreg
(
sPRI
);
/* store the function argument on the stack */
markexpr
(
sPARM
,
NULL
,
0
);
/* mark the end of a sub-expression */
nest_stkusage
++
;
if
(
arg
[
argidx
].
defvalue_symbol
!=
NULL
)
{
if
(
sc_status
!=
statSKIP
)
{
markusage
(
arg
[
argidx
].
defvalue_symbol
,
uREAD
);
/* do not mark as "used" when this call itself is skipped */
}
}
}
else
{
error
(
88
,
argidx
);
/* argument count mismatch */
}
/* if */
...
...
Write
Preview
Supports
Markdown
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