diff --git a/include/math.c b/include/math.c index 3ed0649..bbb6126 100644 --- a/include/math.c +++ b/include/math.c @@ -125,7 +125,7 @@ float exp(float f) int fi = (int)ff; - union xx { + union { float f; int i[2]; } x; @@ -155,7 +155,7 @@ float log(float f) if (f == 0.0) return 1.0; - union xx { + union { float f; int i[2]; } x; @@ -193,7 +193,7 @@ float sqrt(float f) { if (f >= 0) { - union xx { + union { float f; int i[2]; } x; @@ -216,7 +216,7 @@ float sqrt(float f) bool isinf(float f) { - union xx { + union { float f; unsigned i[2]; } x; @@ -228,7 +228,7 @@ bool isinf(float f) bool isfinite(float f) { - union xx { + union { float f; unsigned i[2]; } x; diff --git a/oscar64/Declaration.cpp b/oscar64/Declaration.cpp index 09d00d4..e30d317 100644 --- a/oscar64/Declaration.cpp +++ b/oscar64/Declaration.cpp @@ -1301,11 +1301,17 @@ const Ident* Declaration::MangleIdent(void) } else if (mType == DT_TYPE_STRUCT) { - mMangleIdent = mQualIdent->PreMangle("struct "); + if (mQualIdent) + mMangleIdent = mQualIdent->PreMangle("struct "); + else + mMangleIdent = Ident::Unique("struct"); } else if (mType == DT_TYPE_ENUM) { - mMangleIdent = mQualIdent->PreMangle("enum "); + if (mQualIdent) + mMangleIdent = mQualIdent->PreMangle("enum "); + else + mMangleIdent = Ident::Unique("enum"); } else if (mType == DT_TYPE_VOID) { diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index ace7eed..af521dc 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -174,8 +174,10 @@ Declaration* Parser::ParseStructDeclaration(uint64 flags, DecType dt, Declaratio } } } - else - mErrors->Error(mScanner->mLocation, EERR_UNIMPLEMENTED, "Unnamed structs are not implemented"); + else if ((mCompilerOptions & COPT_CPLUSPLUS) && mScope->mLevel < SLEVEL_CLASS) + { + mErrors->Error(mScanner->mLocation, EERR_INVALID_IDENTIFIER, "Invalid unnamed struct on global level"); + } if (!dec->mIdent || !dec->mScope) {