Skip to content

Commit

Permalink
Merge pull request #4748 from MartinNowak/stable
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'upstream/master' into stable
  • Loading branch information
MartinNowak committed Jun 17, 2015
2 parents 779e52c + 6cadebc commit 6963c2b
Show file tree
Hide file tree
Showing 419 changed files with 26,316 additions and 9,029 deletions.
83 changes: 82 additions & 1 deletion .gitignore
Expand Up @@ -3,6 +3,7 @@
src/cdxxx.c
src/debtab.c
src/dmd
src/ddmd
src/dmd.conf
src/elxxx.c
src/fltables.c
Expand All @@ -26,6 +27,7 @@ src/verstr.h
trace.def
trace.log
Makefile
src/magicport/magicport

# Visual Studio files
*.exe
Expand All @@ -42,9 +44,88 @@ ipch
# Xcode files
DerivedData/
xcuserdata/
dmd.xcodeproj/project.xcworkspace/xcuserdata
dmd.xcodeproj/

# Output files
src/*.bak
src/*.lib
tags

# OSX
src/impcnvgen.dSYM/
src/optabgen.dSYM/

# Generated D source
src/access.d
src/aggregate.d
src/aliasthis.d
src/apply.d
src/argtypes.d
src/arrayop.d
src/arraytypes.d
src/attrib.d
src/builtin.d
src/canthrow.d
src/dcast.d
src/dclass.d
src/clone.d
src/cond.d
src/constfold.d
src/cppmangle.d
src/ctfeexpr.d
src/declaration.d
src/delegatize.d
src/doc.d
src/dsymbol.d
src/denum.d
src/errors.d
src/expression.d
src/func.d
src/hdrgen.d
src/id.d
src/identifier.d
src/imphint.d
src/dimport.d
src/dinifile.d
src/inline.d
src/init.d
src/dinterpret.d
src/json.d
src/lexer.d
src/link.d
src/dmacro.d
src/dmangle.d
src/mars.d
src/dmodule.d
src/mtype.d
src/nspace.d
src/opover.d
src/optimize.d
src/parse.d
src/sapply.d
src/dscope.d
src/sideeffect.d
src/statement.d
src/staticassert.d
src/dstruct.d
src/target.d
src/dtemplate.d
src/tokens.d
src/traits.d
src/dunittest.d
src/utf.d
src/dversion.d
src/visitor.d
src/lib.d
src/nogc.d
src/nspace.d
src/color.d
src/globals.d
src/root/aav.d
src/root/file.d
src/root/filename.d
src/root/speller.d
src/root/man.d
src/root/outbuffer.d
src/root/response.d
src/root/stringtable.d
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.067
2.068
1,102 changes: 0 additions & 1,102 deletions dmd.xcodeproj/project.pbxproj

This file was deleted.

7 changes: 0 additions & 7 deletions dmd.xcodeproj/project.xcworkspace/contents.xcworkspacedata

This file was deleted.

5 changes: 5 additions & 0 deletions ini/solaris/bin32/dmd.conf
@@ -0,0 +1,5 @@
[Environment32]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib32 -L--export-dynamic

[Environment64]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib64 -L--export-dynamic
5 changes: 5 additions & 0 deletions ini/solaris/bin64/dmd.conf
@@ -0,0 +1,5 @@
[Environment32]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib32 -L--export-dynamic

[Environment64]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib64 -L--export-dynamic
9 changes: 8 additions & 1 deletion posix.mak
Expand Up @@ -2,11 +2,16 @@ INSTALL_DIR=$(PWD)/../install
ECTAGS_LANGS = Make,C,C++,Sh
ECTAGS_FILES = src/*.[ch] src/backend/*.[ch] src/root/*.[ch] src/tk/*.[ch]

.PHONY: all clean test install
.PHONY: all clean test install auto-tester-build auto-tester-test

all:
$(QUIET)$(MAKE) -C src -f posix.mak

auto-tester-build:
$(QUIET)$(MAKE) -C src -f posix.mak $<

auto-tester-test: test

clean:
$(QUIET)$(MAKE) -C src -f posix.mak clean
$(QUIET)$(MAKE) -C test -f Makefile clean
Expand All @@ -25,3 +30,5 @@ install: all
cp -r samples $(INSTALL_DIR)
mkdir -p $(INSTALL_DIR)/man
cp -r docs/man/* $(INSTALL_DIR)/man/

.DELETE_ON_ERROR: # GNU Make directive (delete output files on error)
2 changes: 1 addition & 1 deletion samples/pi.d
Expand Up @@ -11,7 +11,7 @@ int q;

int main(string[] args)
{
long startime, endtime;
time_t startime, endtime;
int i;

if (args.length == 2)
Expand Down
5 changes: 2 additions & 3 deletions samples/winsamp.d
Expand Up @@ -21,13 +21,12 @@ extern(Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
{
int result;
void exceptionHandler(Throwable e) { throw e; }

try
{
Runtime.initialize(&exceptionHandler);
Runtime.initialize();
result = myWinMain(hInstance, hPrevInstance, lpCmdLine, iCmdShow);
Runtime.terminate(&exceptionHandler);
Runtime.terminate();
}
catch (Throwable e)
{
Expand Down
76 changes: 36 additions & 40 deletions src/access.c
Expand Up @@ -39,7 +39,6 @@ bool isFriendOf(AggregateDeclaration *ad, AggregateDeclaration *cd);
/****************************************
* Return Prot access for Dsymbol smember in this declaration.
*/

Prot getAccess(AggregateDeclaration *ad, Dsymbol *smember)
{
Prot access_ret = Prot(PROTnone);
Expand Down Expand Up @@ -101,13 +100,12 @@ Prot getAccess(AggregateDeclaration *ad, Dsymbol *smember)
}

/********************************************************
* Helper function for ClassDeclaration::accessCheck()
* Helper function for checkAccess()
* Returns:
* false no access
* true access
* false is not accessible
* true is accessible
*/

static bool accessCheckX(
static bool isAccessible(
Dsymbol *smember,
Dsymbol *sfunc,
AggregateDeclaration *dthis,
Expand All @@ -116,7 +114,7 @@ static bool accessCheckX(
assert(dthis);

#if 0
printf("accessCheckX for %s.%s in function %s() in scope %s\n",
printf("isAccessible for %s.%s in function %s() in scope %s\n",
dthis->toChars(), smember->toChars(),
sfunc ? sfunc->toChars() : "NULL",
cdscope ? cdscope->toChars() : "NULL");
Expand All @@ -126,19 +124,17 @@ static bool accessCheckX(
{
if (smember->toParent() == dthis)
return true;
else

if (ClassDeclaration *cdthis = dthis->isClassDeclaration())
{
ClassDeclaration *cdthis = dthis->isClassDeclaration();
if (cdthis)
for (size_t i = 0; i < cdthis->baseclasses->dim; i++)
{
for (size_t i = 0; i < cdthis->baseclasses->dim; i++)
{ BaseClass *b = (*cdthis->baseclasses)[i];
Prot access = getAccess(b->base, smember);
if (access.kind >= PROTprotected ||
accessCheckX(smember, sfunc, b->base, cdscope)
)
return true;

BaseClass *b = (*cdthis->baseclasses)[i];
Prot access = getAccess(b->base, smember);
if (access.kind >= PROTprotected ||
isAccessible(smember, sfunc, b->base, cdscope))
{
return true;
}
}
}
Expand All @@ -147,13 +143,12 @@ static bool accessCheckX(
{
if (smember->toParent() != dthis)
{
ClassDeclaration *cdthis = dthis->isClassDeclaration();
if (cdthis)
if (ClassDeclaration *cdthis = dthis->isClassDeclaration())
{
for (size_t i = 0; i < cdthis->baseclasses->dim; i++)
{ BaseClass *b = (*cdthis->baseclasses)[i];

if (accessCheckX(smember, sfunc, b->base, cdscope))
{
BaseClass *b = (*cdthis->baseclasses)[i];
if (isAccessible(smember, sfunc, b->base, cdscope))
return true;
}
}
Expand All @@ -165,15 +160,15 @@ static bool accessCheckX(
/*******************************
* Do access check for member of this class, this class being the
* type of the 'this' pointer used to access smember.
* Returns true if the member is not accessible.
*/

void accessCheck(AggregateDeclaration *ad, Loc loc, Scope *sc, Dsymbol *smember)
bool checkAccess(AggregateDeclaration *ad, Loc loc, Scope *sc, Dsymbol *smember)
{
FuncDeclaration *f = sc->func;
AggregateDeclaration *cdscope = sc->getStructClassScope();

#if LOG
printf("AggregateDeclaration::accessCheck() for %s.%s in function %s() in scope %s\n",
printf("AggregateDeclaration::checkAccess() for %s.%s in function %s() in scope %s\n",
ad->toChars(), smember->toChars(),
f ? f->toChars() : NULL,
cdscope ? cdscope->toChars() : NULL);
Expand All @@ -185,7 +180,7 @@ void accessCheck(AggregateDeclaration *ad, Loc loc, Scope *sc, Dsymbol *smember)
#if LOG
printf("not an aggregate member\n");
#endif
return; // then it is accessible
return false; // then it is accessible
}

// BUG: should enable this check
Expand Down Expand Up @@ -221,7 +216,7 @@ void accessCheck(AggregateDeclaration *ad, Loc loc, Scope *sc, Dsymbol *smember)
}
else
{
result = accessCheckX(smember, f, ad, cdscope);
result = isAccessible(smember, f, ad, cdscope);
#if LOG
printf("result4 = %d\n", result);
#endif
Expand All @@ -231,13 +226,14 @@ void accessCheck(AggregateDeclaration *ad, Loc loc, Scope *sc, Dsymbol *smember)
ad->error(loc, "member %s is not accessible", smember->toChars());
//printf("smember = %s %s, prot = %d, semanticRun = %d\n",
// smember->kind(), smember->toPrettyChars(), smember->prot(), smember->semanticRun);
return true;
}
return false;
}

/****************************************
* Determine if this is the same or friend of cd.
*/

bool isFriendOf(AggregateDeclaration *ad, AggregateDeclaration *cd)
{
#if LOG
Expand Down Expand Up @@ -265,7 +261,6 @@ bool isFriendOf(AggregateDeclaration *ad, AggregateDeclaration *cd)
/****************************************
* Determine if scope sc has package level access to s.
*/

bool hasPackageAccess(Scope *sc, Dsymbol *s)
{
#if LOG
Expand Down Expand Up @@ -343,7 +338,6 @@ bool hasPackageAccess(Scope *sc, Dsymbol *s)
/**********************************
* Determine if smember has access to private members of this declaration.
*/

bool hasPrivateAccess(AggregateDeclaration *ad, Dsymbol *smember)
{
if (smember)
Expand Down Expand Up @@ -398,28 +392,28 @@ bool hasPrivateAccess(AggregateDeclaration *ad, Dsymbol *smember)

/****************************************
* Check access to d for expression e.d
* Returns true if the declaration is not accessible.
*/

void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d)
bool checkAccess(Loc loc, Scope *sc, Expression *e, Declaration *d)
{
if (sc->flags & SCOPEnoaccesscheck)
return;
return false;

#if LOG
if (e)
{
printf("accessCheck(%s . %s)\n", e->toChars(), d->toChars());
printf("checkAccess(%s . %s)\n", e->toChars(), d->toChars());
printf("\te->type = %s\n", e->type->toChars());
}
else
{
printf("accessCheck(%s)\n", d->toPrettyChars());
printf("checkAccess(%s)\n", d->toPrettyChars());
}
#endif
if(d->isUnitTestDeclaration())
if (d->isUnitTestDeclaration())
{
// Unittests are always accessible.
return;
return false;
}
if (!e)
{
Expand All @@ -428,6 +422,7 @@ void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d)
{
error(loc, "%s %s is not accessible from module %s",
d->kind(), d->toPrettyChars(), sc->module->toChars());
return true;
}
}
else if (e->type->ty == Tclass)
Expand All @@ -440,12 +435,13 @@ void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d)
if (cd2)
cd = cd2;
}
accessCheck(cd, loc, sc, d);
return checkAccess(cd, loc, sc, d);
}
else if (e->type->ty == Tstruct)
{
// Do access check
StructDeclaration *cd = (StructDeclaration *)(((TypeStruct *)e->type)->sym);
accessCheck(cd, loc, sc, d);
return checkAccess(cd, loc, sc, d);
}
return false;
}

0 comments on commit 6963c2b

Please sign in to comment.