Skip to content

Commit

Permalink
fixes while compiling variant header
Browse files Browse the repository at this point in the history
  • Loading branch information
LADSoft committed Sep 23, 2024
1 parent e855249 commit 05f8083
Show file tree
Hide file tree
Showing 23 changed files with 927 additions and 234 deletions.
4 changes: 2 additions & 2 deletions src/clibs/cpp/libcxx/src/filesystem/filesystem_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS,
auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count();
return static_cast<int_type>(dur);
};
struct ::timeval ConvertedTS[2] = {{TS[0].tv_sec, Convert(TS[0].tv_nsec)},
{TS[1].tv_sec, Convert(TS[1].tv_nsec)}};
struct ::timeval ConvertedTS[2] = {{/*DAL*/(long)TS[0].tv_sec, Convert(TS[0].tv_nsec)},
{/*DAL*/(long)TS[1].tv_sec, Convert(TS[1].tv_nsec)}};
if (::utimes(p.c_str(), ConvertedTS) == -1) {
ec = capture_errno();
return true;
Expand Down
1 change: 1 addition & 0 deletions src/occparse/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ struct Initializer
{
int offset;
Type* basetp;
Type* realtp;
struct sym* fieldsp;
EXPRESSION* fieldoffs;
EXPRESSION* exp;
Expand Down
10 changes: 8 additions & 2 deletions src/occparse/ccerr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ bool printerrinternal(int err, const char* file, int line, va_list args)
disabledNote = true;
if (Warning::Instance()->IsSet(err, Warning::Disable))
return false;
if (Warning::Instance()->IsSet(err, Warning::OnlyOnce))
if (Warning::Instance()->IsSet(err, Warning::OnlyOnce))
if (Warning::Instance()->IsSet(err, Warning::Emitted))
return false;
disabledNote = false;
Expand Down Expand Up @@ -686,7 +686,13 @@ void errorNotMember(SYMBOL* strSym, NAMESPACEVALUEDATA* nsv, const char* name)
}
void error(int err) { printerr(err, nullptr, 0); }
void errorint(int err, int val) { printerr(err, nullptr, 0, val); }
void errorstr(int err, const char* val) { printerr(err, nullptr, 0, (char*)val); }
void errorstr(int err, const char* val)
{
const char* t = LookupIntrinsicName(val);
if (t)
val = t;
printerr(err, nullptr, 0, (char*)val);
}
void errorstr2(int err, const char* val, const char* two) { printerr(err, nullptr, 0, (char*)val, (char*)two); }
void errorsym(int err, SYMBOL* sym)
{
Expand Down
22 changes: 9 additions & 13 deletions src/occparse/constexpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,14 +662,18 @@ static void pushArrayOrStruct(SYMBOL* arg, std::list<Argument*>& il, std::unorde
int n = il.size();
argmap[arg] = MakeVarPtr(false, getSize(BasicType::pointer_) + getSize(BasicType::int_), 1, arg, nullptr);
auto& listDeclarator = argmap[arg]->v.constexprData;
listDeclarator.data[0] = MakeVarPtr(false, n, il.front()->tp->size, arg, nullptr);
listDeclarator.data[0] = MakeVarPtr(false, n, n == 0 ? 1 : il.front()->tp->size, arg, nullptr);
listDeclarator.data[getSize(BasicType::pointer_)] = MakeIntExpression(ExpressionNode::c_i_, n);
auto target = listDeclarator.data[0]->v.constexprData.data;

n = 0;
for (auto&& xil : il)
if (n > 0)
{
target[n++] = xil->exp;
auto target = listDeclarator.data[0]->v.constexprData.data;

n = 0;
for (auto&& xil : il)
{
target[n++] = xil->exp;
}
}
}
}
Expand Down Expand Up @@ -1277,8 +1281,6 @@ static EXPRESSION* EvaluateStatements(EXPRESSION* node, std::list<Statement*>* s
return nullptr;
case StatementNode::select_:
case StatementNode::notselect_: {
if (Optimizer::cparams.prm_debug)
return nullptr;
auto node1 = stmt->select;
node1 = EvaluateExpression(node1, ths, retblk, true);
optimize_for_constants(&node1);
Expand All @@ -1297,15 +1299,11 @@ static EXPRESSION* EvaluateStatements(EXPRESSION* node, std::list<Statement*>* s
}
case StatementNode::goto_:
case StatementNode::loopgoto_:
if (Optimizer::cparams.prm_debug)
return nullptr;
if (stmt->explicitGoto || stmt->indirectGoto)
return nullptr;
it = labels[stmt->label];
break;
case StatementNode::switch_: {
if (Optimizer::cparams.prm_debug)
return nullptr;
auto node1 = stmt->select;
node1 = EvaluateExpression(node1, ths, retblk, true);
optimize_for_constants(&node1);
Expand Down Expand Up @@ -1336,8 +1334,6 @@ static EXPRESSION* EvaluateStatements(EXPRESSION* node, std::list<Statement*>* s
case StatementNode::expr_:
if (stmt->select)
{
if (Optimizer::cparams.prm_debug)
return nullptr;
auto node1 = copy_expression(stmt->select);
node1 = EvaluateExpression(node1, ths, retblk, true);
optimize_for_constants(&node1);
Expand Down
9 changes: 6 additions & 3 deletions src/occparse/constopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3282,9 +3282,12 @@ int typedconsts(EXPRESSION* node1)
rv = true;
break;
case ExpressionNode::const_:
optimize_for_constants(&node1->v.sp->sb->init->front()->exp);
*node1 = *node1->v.sp->sb->init->front()->exp;
rv = true;
if (!node1->v.sp->templateParams || allTemplateArgsSpecified(node1->v.sp, node1->v.sp->templateParams))
{
optimize_for_constants(&node1->v.sp->sb->init->front()->exp);
*node1 = *node1->v.sp->sb->init->front()->exp;
rv = true;
}
break;
default:
break;
Expand Down
10 changes: 9 additions & 1 deletion src/occparse/declcons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,11 @@ void createDefaultConstructors(SYMBOL* sp)
sp->sb->trivialCons = trivialCons;
sp->sb->trivialDest = trivialDest;
}
else
{
sp->sb->trivialCons = false;
sp->sb->trivialDest = false;
}
for (auto s : *cons->tp->syms)
{
if (s->sb->constexpression | s->sb->defaulted)
Expand Down Expand Up @@ -2451,8 +2456,11 @@ static bool DefaultConstructorConstExpression(SYMBOL* sp)

if (sp->sb->baseClasses)
for (auto base : *sp->sb->baseClasses)
if (!DefaultConstructorConstExpression(base->cls))
{
base->cls->tp->InitializeDeferred();
if (base->cls->tp->size && !DefaultConstructorConstExpression(base->cls))
return false;
}
sp->sb->constexpression = true;
return true;
}
Expand Down
Loading

0 comments on commit 05f8083

Please sign in to comment.