ImportC: allow imports from multiple C files (#14457)

This commit is contained in:
Walter Bright 2022-09-20 00:18:41 -07:00 committed by GitHub
parent 8d76134534
commit 194182a9c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View file

@ -1544,6 +1544,12 @@ public:
if (flags & IgnoreAmbiguous) // if return NULL on ambiguity
return null;
/* If two imports from C import files, pick first one, as C has global name space
*/
if (s.isCsymbol() && s2.isCsymbol())
continue;
if (!(flags & IgnoreErrors))
ScopeDsymbol.multiplyDefined(loc, s, s2);
break;

View file

@ -0,0 +1,4 @@
__import imports.cimports2a;
__import imports.cimports2b;
int *p = &xx;

View file

@ -0,0 +1 @@
extern int xx;

View file

@ -0,0 +1 @@
extern int xx;