diff --git a/uppsrc/CppBase/Body.cpp b/uppsrc/CppBase/Body.cpp index 579198e6a..cca64a5ef 100644 --- a/uppsrc/CppBase/Body.cpp +++ b/uppsrc/CppBase/Body.cpp @@ -20,9 +20,8 @@ void Parser::Locals(const String& type) bool Parser::TryDecl() { // attempt to interpret code as local variable declaration for(;;) { - if(lex[0] == tk_static || lex[0] == tk_const || - lex[0] == tk_register || lex[0] == tk_volatile) - ++lex; + if(findarg(lex[0], tk_static, tk_const, tk_register, tk_volatile) >= 0) + ++lex; else if(!VCAttribute()) break; diff --git a/uppsrc/CppBase/cpp.cpp b/uppsrc/CppBase/cpp.cpp index 533cbe877..fca8c4147 100644 --- a/uppsrc/CppBase/cpp.cpp +++ b/uppsrc/CppBase/cpp.cpp @@ -234,6 +234,13 @@ void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, bo if(get_macros) return; + if(in.Peek() == 0xef) { // Skip UTF-8 BOM + int64 pos = in.GetPos(); + in.Get(); + if(in.Get() != 0xbb || in.Get() != 0xbf) + in.Seek(pos); // Was not UTF-8 BOM after all + } + LTIMING("Expand"); incomment = false; prefix_macro.Clear();