From 60637714956471360a1358d6db5ed992d53a8b3d Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 11 Oct 2015 20:57:53 +0000 Subject: [PATCH] cpp: Fixed for stdlibc++ from GCC 4.9 git-svn-id: svn://ultimatepp.org/upp/trunk@9004 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CppBase/Parser.cpp | 103 +++++++++++++++++------------- uppsrc/ide/Android/AndroidNDK.cpp | 15 ++++- 2 files changed, 73 insertions(+), 45 deletions(-) diff --git a/uppsrc/CppBase/Parser.cpp b/uppsrc/CppBase/Parser.cpp index 56ef66b12..d8a7f68ab 100644 --- a/uppsrc/CppBase/Parser.cpp +++ b/uppsrc/CppBase/Parser.cpp @@ -404,57 +404,62 @@ void Parser::CheckKey(int c) String Parser::TemplateParams(String& param) { - const char *pos = lex.Pos(); - CheckKey('<'); - int level = 1; - String id; - bool gp = true; - while(lex != t_eof) { - if(lex.IsId() && gp) - id = lex.GetId(); - else - if(Key(',')) { - ScAdd(param, id); - id.Clear(); - gp = true; - } - else - if(Key('=')) { - if(!id.IsEmpty()) { + String r; + do { + const char *pos = lex.Pos(); + CheckKey('<'); + int level = 1; + String id; + bool gp = true; + while(lex != t_eof) { + if(lex.IsId() && gp) + id = lex.GetId(); + else + if(Key(',')) { ScAdd(param, id); id.Clear(); + gp = true; } - gp = false; - } - else - if(Key('>')) { - level--; - if(level <= 0) { - ScAdd(param, id); - break; + else + if(Key('=')) { + if(!id.IsEmpty()) { + ScAdd(param, id); + id.Clear(); + } + gp = false; } - } - else - if(Key(t_shr) && level >= 2) { - level -= 2; - if(level <= 0) { - ScAdd(param, id); - break; + else + if(Key('>')) { + level--; + if(level <= 0) { + ScAdd(param, id); + break; + } } + else + if(Key(t_shr) && level >= 2) { + level -= 2; + if(level <= 0) { + ScAdd(param, id); + break; + } + } + else + if(Key('<')) + level++; + else + if(Key('(')) + level++; + else + if(Key(')')) + level--; + else + ++lex; } - else - if(Key('<')) - level++; - else - if(Key('(')) - level++; - else - if(Key(')')) - level--; - else - ++lex; + MergeWith(r, ",", String(pos, lex.Pos())); } - return String(pos, lex.Pos()); + while(Key(tk_template)); + return r; } String Parser::TemplateParams() @@ -1576,6 +1581,16 @@ void Parser::Do() if(Key(';')) // 'empty' declaration, result of some ignores ; else + if(lex == tk_extern && lex[1] == tk_template) { // skip 'extern template void Foo();' + while(lex != t_eof) { + if(lex == ';') { + ++lex; + break; + } + ++lex; + } + } + else if(Key(tk_extern) && lex == t_string) { // extern "C++" kind ++lex; DoNamespace(); diff --git a/uppsrc/ide/Android/AndroidNDK.cpp b/uppsrc/ide/Android/AndroidNDK.cpp index a21cba5d5..a12d90fd4 100644 --- a/uppsrc/ide/Android/AndroidNDK.cpp +++ b/uppsrc/ide/Android/AndroidNDK.cpp @@ -133,7 +133,20 @@ String AndroidNDK::GetCppIncludeDir(const String& cppRuntime) const // TODO: implement selection of library version String versionsDir = nest + "gnu-libstdc++"; - return nest + "gnu-libstdc++" + DIR_SEPS + "4.9" + DIR_SEPS + "include"; + FindFile ff(nest + "gnu-libstdc++/*.*"); + String inc; + double ver = 0; + while(ff) { + if(ff.IsFolder()) { + double h = atof(ff.GetName()); + if(h > ver) { + ver = h; + inc = ff.GetPath(); + } + } + ff.Next(); + } + return inc + '/' + "include"; } else if(cppRuntime.StartsWith("c++")) {