aboutsummaryrefslogtreecommitdiff
path: root/src/lj_cconv.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_cconv.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lj_cconv.c b/src/lj_cconv.c
index 85fd57e5..e5abf3e9 100644
--- a/src/lj_cconv.c
+++ b/src/lj_cconv.c
@@ -63,7 +63,7 @@ static CType *cconv_childqual(CTState *cts, CType *ct, CTInfo *qual)
63/* Check for compatible types when converting to a pointer. 63/* Check for compatible types when converting to a pointer.
64** Note: these checks are more relaxed than what C99 mandates. 64** Note: these checks are more relaxed than what C99 mandates.
65*/ 65*/
66static int cconv_compatptr(CTState *cts, CType *d, CType *s, CTInfo flags) 66int lj_cconv_compatptr(CTState *cts, CType *d, CType *s, CTInfo flags)
67{ 67{
68 if (!((flags & CCF_CAST) || d == s)) { 68 if (!((flags & CCF_CAST) || d == s)) {
69 CTInfo dqual = 0, squal = 0; 69 CTInfo dqual = 0, squal = 0;
@@ -73,7 +73,7 @@ static int cconv_compatptr(CTState *cts, CType *d, CType *s, CTInfo flags)
73 if ((flags & CCF_SAME)) { 73 if ((flags & CCF_SAME)) {
74 if (dqual != squal) 74 if (dqual != squal)
75 return 0; /* Different qualifiers. */ 75 return 0; /* Different qualifiers. */
76 } else { 76 } else if (!(flags & CCF_IGNQUAL)) {
77 if ((dqual & squal) != squal) 77 if ((dqual & squal) != squal)
78 return 0; /* Discarded qualifiers. */ 78 return 0; /* Discarded qualifiers. */
79 if (ctype_isvoid(d->info) || ctype_isvoid(s->info)) 79 if (ctype_isvoid(d->info) || ctype_isvoid(s->info))
@@ -87,7 +87,7 @@ static int cconv_compatptr(CTState *cts, CType *d, CType *s, CTInfo flags)
87 return 0; /* Different numeric types. */ 87 return 0; /* Different numeric types. */
88 } else if (ctype_ispointer(d->info)) { 88 } else if (ctype_ispointer(d->info)) {
89 /* Check child types for compatibility. */ 89 /* Check child types for compatibility. */
90 return cconv_compatptr(cts, d, s, flags|CCF_SAME); 90 return lj_cconv_compatptr(cts, d, s, flags|CCF_SAME);
91 } else if (ctype_isstruct(d->info)) { 91 } else if (ctype_isstruct(d->info)) {
92 if (d != s) 92 if (d != s)
93 return 0; /* Must be exact same type for struct/union. */ 93 return 0; /* Must be exact same type for struct/union. */
@@ -339,20 +339,20 @@ void lj_cconv_ct_ct(CTState *cts, CType *d, CType *s,
339 goto conv_I_F; 339 goto conv_I_F;
340 340
341 case CCX(P, P): 341 case CCX(P, P):
342 if (!cconv_compatptr(cts, d, s, flags)) goto err_conv; 342 if (!lj_cconv_compatptr(cts, d, s, flags)) goto err_conv;
343 cdata_setptr(dp, dsize, cdata_getptr(sp, ssize)); 343 cdata_setptr(dp, dsize, cdata_getptr(sp, ssize));
344 break; 344 break;
345 345
346 case CCX(P, A): 346 case CCX(P, A):
347 case CCX(P, S): 347 case CCX(P, S):
348 if (!cconv_compatptr(cts, d, s, flags)) goto err_conv; 348 if (!lj_cconv_compatptr(cts, d, s, flags)) goto err_conv;
349 cdata_setptr(dp, dsize, sp); 349 cdata_setptr(dp, dsize, sp);
350 break; 350 break;
351 351
352 /* Destination is an array. */ 352 /* Destination is an array. */
353 case CCX(A, A): 353 case CCX(A, A):
354 if ((flags & CCF_CAST) || (d->info & CTF_VLA) || d->size != s->size || 354 if ((flags & CCF_CAST) || (d->info & CTF_VLA) || d->size != s->size ||
355 d->size == CTSIZE_INVALID || !cconv_compatptr(cts, d, s, flags)) 355 d->size == CTSIZE_INVALID || !lj_cconv_compatptr(cts, d, s, flags))
356 goto err_conv; 356 goto err_conv;
357 goto copyval; 357 goto copyval;
358 358