mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 09:00:33 +03:00
Merge branch 'master' into merge-2.067
This commit is contained in:
commit
21d1bab114
6 changed files with 138 additions and 22 deletions
|
@ -327,9 +327,7 @@ if(MSVC)
|
|||
string(REGEX REPLACE "(^| ) */GR-? *( |$)" "\\1 \\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
add_definitions(-D_HAS_EXCEPTIONS=0)
|
||||
set(EXTRA_CXXFLAGS "/GF /GR- /EHs-c- /MP")
|
||||
else()
|
||||
set(EXTRA_CXXFLAGS "")
|
||||
set(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} /GF /GR- /EHs-c- /MP")
|
||||
endif()
|
||||
|
||||
# if llvm was built with assertions we have to do the same
|
||||
|
|
|
@ -38,7 +38,9 @@
|
|||
* so nothing would be compatible anyway.
|
||||
*/
|
||||
|
||||
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || IN_LLVM
|
||||
#if !IN_LLVM
|
||||
//#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Follows Itanium C++ ABI 1.86
|
||||
|
@ -176,7 +178,11 @@ class CppMangleVisitor : public Visitor
|
|||
else
|
||||
{
|
||||
s->error("Internal Compiler Error: C++ %s template value parameter is not supported", tv->valType->toChars());
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (!tp || tp->isTemplateTypeParameter())
|
||||
|
@ -192,7 +198,11 @@ class CppMangleVisitor : public Visitor
|
|||
if (!d && !e)
|
||||
{
|
||||
s->error("Internal Compiler Error: %s is unsupported parameter for C++ template: (%s)", o->toChars());
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
if (d && d->isFuncDeclaration())
|
||||
{
|
||||
|
@ -220,14 +230,22 @@ class CppMangleVisitor : public Visitor
|
|||
else
|
||||
{
|
||||
s->error("Internal Compiler Error: %s is unsupported parameter for C++ template", o->toChars());
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
s->error("Internal Compiler Error: C++ templates support only integral value, type parameters, alias templates and alias function parameters");
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (is_var_arg)
|
||||
|
@ -400,7 +418,11 @@ class CppMangleVisitor : public Visitor
|
|||
if (!(d->storage_class & (STCextern | STCgshared)))
|
||||
{
|
||||
d->error("Internal Compiler Error: C++ static non- __gshared non-extern variables not supported");
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
Dsymbol *p = d->toParent();
|
||||
|
@ -525,7 +547,11 @@ class CppMangleVisitor : public Visitor
|
|||
// Mangle static arrays as pointers
|
||||
t->error(Loc(), "Internal Compiler Error: unable to pass static array to extern(C++) function.");
|
||||
t->error(Loc(), "Use pointer instead.");
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
//t = t->nextOf()->pointerTo();
|
||||
}
|
||||
|
||||
|
@ -587,7 +613,11 @@ public:
|
|||
{
|
||||
t->error(Loc(), "Internal Compiler Error: unsupported type %s\n", t->toChars());
|
||||
}
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0); //Assert, because this error should be handled in frontend
|
||||
#endif
|
||||
}
|
||||
|
||||
void visit(TypeBasic *t)
|
||||
|
@ -892,14 +922,18 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#if !IN_LLVM
|
||||
char *toCppMangle(Dsymbol *s)
|
||||
{
|
||||
//printf("toCppMangle(%s)\n", s->toChars());
|
||||
CppMangleVisitor v;
|
||||
return v.mangleOf(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif TARGET_WINDOS
|
||||
#if !IN_LLVM
|
||||
//#elif TARGET_WINDOS
|
||||
#endif
|
||||
|
||||
// Windows DMC and Microsoft Visual C++ mangling
|
||||
#define VC_SAVED_TYPE_CNT 10
|
||||
|
@ -960,7 +994,11 @@ public:
|
|||
{
|
||||
type->error(Loc(), "Internal Compiler Error: unsupported type %s\n", type->toChars());
|
||||
}
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0); // Assert, because this error should be handled in frontend
|
||||
#endif
|
||||
}
|
||||
|
||||
void visit(TypeBasic *type)
|
||||
|
@ -1375,7 +1413,11 @@ private:
|
|||
if (!(d->storage_class & (STCextern | STCgshared)))
|
||||
{
|
||||
d->error("Internal Compiler Error: C++ static non- __gshared non-extern variables not supported");
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
buf.writeByte('?');
|
||||
mangleIdent(d);
|
||||
|
@ -1513,7 +1555,11 @@ private:
|
|||
else
|
||||
{
|
||||
sym->error("Internal Compiler Error: C++ %s template value parameter is not supported", tv->valType->toChars());
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (!tp || tp->isTemplateTypeParameter())
|
||||
|
@ -1529,7 +1575,11 @@ private:
|
|||
if (!d && !e)
|
||||
{
|
||||
sym->error("Internal Compiler Error: %s is unsupported parameter for C++ template", o->toChars());
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
if (d && d->isFuncDeclaration())
|
||||
{
|
||||
|
@ -1571,7 +1621,11 @@ private:
|
|||
else
|
||||
{
|
||||
sym->error("Internal Compiler Error: C++ templates support only integral value, type parameters, alias templates and alias function parameters");
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
tmp.mangleIdent(d);
|
||||
|
@ -1579,14 +1633,22 @@ private:
|
|||
else
|
||||
{
|
||||
sym->error("Internal Compiler Error: %s is unsupported parameter for C++ template: (%s)", o->toChars());
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sym->error("Internal Compiler Error: C++ templates support only integral value, type parameters, alias templates and alias function parameters");
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
name = tmp.buf.extractString();
|
||||
|
@ -1884,7 +1946,11 @@ private:
|
|||
{
|
||||
t->error(Loc(), "Internal Compiler Error: unable to pass static array to extern(C++) function.");
|
||||
t->error(Loc(), "Use pointer instead.");
|
||||
#if IN_LLVM
|
||||
fatal();
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
flags &= ~IS_NOT_TOP_TYPE;
|
||||
flags &= ~IGNORE_CONST;
|
||||
|
@ -1892,12 +1958,35 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
#if IN_LLVM
|
||||
char *toCppMangle(Dsymbol *s)
|
||||
{
|
||||
#if LDC_LLVM_VER >= 305
|
||||
const bool isTargetWindowsMSVC = global.params.targetTriple.isWindowsMSVCEnvironment();
|
||||
#else
|
||||
const bool isTargetWindowsMSVC = global.params.targetTriple.getOS() == llvm::Triple::Win32;
|
||||
#endif
|
||||
if (isTargetWindowsMSVC)
|
||||
{
|
||||
VisualCPPMangler v(!global.params.is64bit);
|
||||
return v.mangleOf(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
CppMangleVisitor v;
|
||||
return v.mangleOf(s);
|
||||
}
|
||||
}
|
||||
#else
|
||||
char *toCppMangle(Dsymbol *s)
|
||||
{
|
||||
VisualCPPMangler v(!global.params.mscoff);
|
||||
return v.mangleOf(s);
|
||||
}
|
||||
|
||||
#else
|
||||
#error "fix this"
|
||||
#endif
|
||||
|
||||
#if !IN_LLVM
|
||||
//#else
|
||||
//#error "fix this"
|
||||
//#endif
|
||||
#endif
|
|
@ -7756,11 +7756,14 @@ Expression *TypeStruct::defaultInitLiteral(Loc loc)
|
|||
}
|
||||
StructLiteralExp *structinit = new StructLiteralExp(loc, (StructDeclaration *)sym, structelems);
|
||||
|
||||
#if IN_DMD
|
||||
/* Copy from the initializer symbol for larger symbols,
|
||||
* otherwise the literals expressed as code get excessively large.
|
||||
*/
|
||||
if (size(loc) > Target::ptrsize * 4 && !needsNested())
|
||||
#if IN_LLVM
|
||||
structinit->sinit = static_cast<SymbolDeclaration *>(
|
||||
static_cast<VarExp *>(defaultInit(loc))->var);
|
||||
#else
|
||||
structinit->sinit = toInitializer(sym);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2413,7 +2413,15 @@ namespace AsmParserx8664
|
|||
{
|
||||
case Float_Ptr: type_suffix = 's'; break;
|
||||
case Double_Ptr: type_suffix = 'l'; break;
|
||||
case Extended_Ptr: type_suffix = 't'; break;
|
||||
case Extended_Ptr:
|
||||
#if LDC_LLVM_VER >= 305
|
||||
// MS C runtime: real = 64-bit double
|
||||
if (global.params.targetTriple.isWindowsMSVCEnvironment())
|
||||
type_suffix = 'l';
|
||||
else
|
||||
#endif
|
||||
type_suffix = 't';
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -943,7 +943,11 @@ void DtoResolveVariable(VarDeclaration* vd)
|
|||
Logger::println("parent: null");
|
||||
}
|
||||
|
||||
const bool isLLConst = (vd->isConst() || vd->isImmutable()) && vd->init;
|
||||
// If a const/immutable value has a proper initializer (not "= void"),
|
||||
// it cannot be assigned again in a static constructor. Thus, we can
|
||||
// emit it as read-only data.
|
||||
const bool isLLConst = (vd->isConst() || vd->isImmutable()) &&
|
||||
vd->init && !vd->init->isVoidInitializer();
|
||||
|
||||
assert(!vd->ir.isInitialized());
|
||||
if (gIR->dmodule)
|
||||
|
|
|
@ -125,6 +125,7 @@ elseif(WIN32)
|
|||
list(REMOVE_ITEM LDC_D ${RUNTIME_DIR}/src/ldc/eh2.d)
|
||||
endif()
|
||||
list(REMOVE_ITEM DCRT_C ${RUNTIME_DIR}/src/rt/monitor.c)
|
||||
list(REMOVE_ITEM DCRT_C ${RUNTIME_DIR}/src/rt/bss_section.c)
|
||||
endif()
|
||||
list(APPEND CORE_D ${CORE_D_INTERNAL} ${CORE_D_SYNC} ${CORE_D_SYS} ${CORE_D_STDC})
|
||||
list(APPEND CORE_D ${LDC_D} ${RUNTIME_DIR}/src/object_.d)
|
||||
|
@ -226,6 +227,29 @@ add_custom_command(
|
|||
COMMAND gen_gccbuiltins ${GCCBUILTINS} "x86"
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
if(NOT LINK_WITH_MSVCRT)
|
||||
set(variables
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
foreach(variable ${variables})
|
||||
if(${variable} MATCHES "/MT")
|
||||
string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
# /wd4996: suppress deprecation warnings about zlib using POSIX names
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996")
|
||||
set(CMAKE_C_FLAGS_DEBUG "")
|
||||
endif()
|
||||
|
||||
# Always build zlib and other C parts of the runtime in release mode, regardless
|
||||
# of what the user chose for LDC itself.
|
||||
set(cfiles "${CORE_C};${DCRT_C}")
|
||||
|
@ -490,17 +514,7 @@ endmacro()
|
|||
# Set up build targets.
|
||||
#
|
||||
|
||||
if(MSVC)
|
||||
# /wd4996: suppress deprecation warnings about zlib using POSIX names
|
||||
if (LINK_WITH_MSVCRT)
|
||||
set(RT_CFLAGS "/wd4996 /MD")
|
||||
else()
|
||||
set(RT_CFLAGS "/wd4996 /MT")
|
||||
endif()
|
||||
else()
|
||||
set(RT_CFLAGS "")
|
||||
endif()
|
||||
|
||||
|
||||
# This is a bit of a mess as we need to join the two libraries together on
|
||||
# OS X before installing them. After this has run, LIBS_TO_INSTALL contains
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue