smcpeak / elsa Goto Github PK
View Code? Open in Web Editor NEWElsa C/C++ parser
License: Other
Elsa C/C++ parser
License: Other
When building elsa
with -Wall -Wextra -Wno-unused-parameter
we get several compler warnings:
/usr/bin/make -f Makefile
rm -f lexer.lex
perl merge-lexer-exts.pl cc.lex gnu.lex >lexer.lex
chmod a-w lexer.lex
../smflex/smflex -b -olexer.yy.cc lexer.lex
test "xcc" = "xcc"
rm -f cc-tokens.h cc-tokens.cc cc-tokens.ids
perl make-token-files cc-tokens.tok gnu_ext.tok
chmod a-w cc-tokens.h cc-tokens.cc cc-tokens.ids
test "xcc" = "xcc"
rm -f cc.ast.gen.h cc.ast.gen.cc
../ast/astgen.exe -occ.ast.gen cc.ast cc-tcheck.ast cc-print.ast cfg.ast cc-elaborate.ast gnu.ast kandr.ast
writing cc.ast.gen.h...
writing cc.ast.gen.cc...
chmod a-w cc.ast.gen.h cc.ast.gen.cc
test "xcc" = "xcc"
rm -f cc.gr.gen.h cc.gr.gen.cc cc.gr.gen.out
../elkhound/elkhound.exe -v -tr lrtable -o cc.gr.gen cc.gr gnu.gr kandr.gr
%%% progress: 0ms: parsing grammar source: cc.gr
%%% progress: 11ms: parsing grammar source: gnu.gr
%%% progress: 17ms: merging module: gnu.gr
%%% progress: 17ms: parsing grammar source: kandr.gr
%%% progress: 19ms: merging module: kandr.gr
%%% progress: 19ms: parsing grammar AST..
%%% progress: 43ms: beginning grammar analysis..
%%% progress: 44ms: init...
%%% progress: 44ms: derivability relation...
%%% progress: 47ms: first...
%%% progress: 47ms: follow...
%%% progress: 49ms: LR item sets...
%%% progress: 167ms: done with LR sets: 1382 states
%%% progress: 167ms: BFS tree on transition graph...
%%% progress: 179ms: state renumbering...
%%% progress: 181ms: parse tables...
%%% progress: 193ms: printing item sets to cc.gr.gen.out ...
%%% progress: 300ms: emitting C++ code to cc.gr.gen.cc and cc.gr.gen.h ...
%%% progress: 368ms: done
chmod a-w cc.gr.gen.h cc.gr.gen.cc cc.gr.gen.out
../smflex/smflex -b -oiptparse.yy.cc iptparse.lex
g++ -c -o tlexer.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound tlexer.cc
g++ -c -o cc-lang.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-lang.cc
g++ -c -o type-sizes.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound type-sizes.cc
g++ -c -o baselexer.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound baselexer.cc
g++ -c -o lexer.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound lexer.cc
g++ -c -o lexer.yy.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound lexer.yy.cc
g++ -c -o cc-tokens.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-tokens.cc
g++ -c -o cc-flags.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-flags.cc
g++ -o tlexer.exe -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound tlexer.o cc-lang.o type-sizes.o baselexer.o lexer.o lexer.yy.o cc-tokens.o cc-flags.o ../elkhound/libelkhound.a ../ast/libast.a ../smbase/libsmbase.a
g++ -c -o packedword_test.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound packedword_test.cc
g++ -o packedword_test.exe -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound packedword_test.o ../elkhound/libelkhound.a ../ast/libast.a ../smbase/libsmbase.a
g++ -c -o semgrep.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound semgrep.cc
g++ -c -o gnu.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound gnu.cc
g++ -c -o ubermods-attrspec.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound ubermods-attrspec.cc
g++ -c -o kandr.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound kandr.cc
g++ -c -o ast_build.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound ast_build.cc
g++ -c -o astvisit.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound astvisit.cc
g++ -c -o builtinops.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound builtinops.cc
g++ -c -o cc-ast-aux.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-ast-aux.cc
g++ -c -o cc-elaborate.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-elaborate.cc
g++ -c -o cc-env.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-env.cc
g++ -c -o cc-err.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-err.cc
g++ -c -o cc-print.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-print.cc
g++ -c -o cc-scope.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-scope.cc
In file included from ../smbase/strutil.h:9,
from strmap.h:9,
from cc-scope.h:20,
from cc-scope.cc:4:
../smbase/array.h: In instantiation of ‘T ArrayStack<T>::pop() [with T = Scope::ActiveEdgeRecord]’:
cc-scope.cc:919:55: required from here
../smbase/array.h:301:30: warning: implicitly-declared ‘constexpr Scope::ActiveEdgeRecord::ActiveEdgeRecord(const Scope::ActiveEdgeRecord&)’ is deprecated [-Wdeprecated-copy]
301 | { return operator[](--len); }
| ^
In file included from cc-scope.cc:4:
cc-scope.h:47:23: note: because ‘Scope::ActiveEdgeRecord’ has user-provided ‘Scope::ActiveEdgeRecord& Scope::ActiveEdgeRecord::operator=(const Scope::ActiveEdgeRecord&)’
47 | ActiveEdgeRecord& operator= (ActiveEdgeRecord const &obj)
| ^~~~~~~~
g++ -c -o cc-tcheck.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-tcheck.cc
cc-tcheck.cc: In function ‘Type* attemptCondConversion(Env&, ImplicitConversion&, Type*, Type*, SpecialExpr)’:
cc-tcheck.cc:9117:53: warning: implicitly-declared ‘ImplicitConversion& ImplicitConversion::operator=(const ImplicitConversion&)’ is deprecated [-Wdeprecated-copy]
9117 | ic = getImplicitConversion(env, special1, t1, t2);
| ^
In file included from cc-tcheck.cc:25:
implconv.h:45:3: note: because ‘ImplicitConversion’ has user-provided ‘ImplicitConversion::ImplicitConversion(const ImplicitConversion&)’
45 | ImplicitConversion(ImplicitConversion const &obj)
| ^~~~~~~~~~~~~~~~~~
cc-tcheck.cc:9142:53: warning: implicitly-declared ‘ImplicitConversion& ImplicitConversion::operator=(const ImplicitConversion&)’ is deprecated [-Wdeprecated-copy]
9142 | ic = getImplicitConversion(env, special1, t1, t2);
| ^
In file included from cc-tcheck.cc:25:
implconv.h:45:3: note: because ‘ImplicitConversion’ has user-provided ‘ImplicitConversion::ImplicitConversion(const ImplicitConversion&)’
45 | ImplicitConversion(ImplicitConversion const &obj)
| ^~~~~~~~~~~~~~~~~~
In file included from cc-tcheck.cc:24:
generic_amb.h: In instantiation of ‘NODE* resolveAmbiguity(NODE*, Env&, const char*, bool, EXTRA&) [with NODE = TemplateArgument; EXTRA = STemplateArgument]’:
cc-tcheck.cc:11053:82: required from here
generic_amb.h:166:21: warning: implicitly-declared ‘STemplateArgument& STemplateArgument::operator=(const STemplateArgument&)’ is deprecated [-Wdeprecated-copy]
166 | callerExtra = extra;
| ~~~~~~~~~~~~^~~~~~~
In file included from cc.ast.gen.h:258,
from cc-ast.h:20,
from ast_build.h:7,
from cc-tcheck.cc:18:
template.h:434:3: note: because ‘STemplateArgument’ has user-provided ‘STemplateArgument::STemplateArgument(const STemplateArgument&)’
434 | STemplateArgument(STemplateArgument const &obj);
| ^~~~~~~~~~~~~~~~~
g++ -c -o cc-type-visitor.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-type-visitor.cc
g++ -c -o cc-type.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc-type.cc
g++ -c -o cc.ast.gen.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc.ast.gen.cc
g++ -c -o cc.gr.gen.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cc.gr.gen.cc
g++ -c -o ccparse.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound ccparse.cc
g++ -c -o cfg.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound cfg.cc
g++ -c -o const-eval.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound const-eval.cc
g++ -c -o elsaparse.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound elsaparse.cc
g++ -c -o implconv.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound implconv.cc
implconv.cc: In function ‘ImplicitConversion getImplicitConversion(Env&, SpecialExpr, Type*, Type*, bool)’:
implconv.cc:284:15: warning: implicitly-declared ‘ImplicitConversion& ImplicitConversion::operator=(const ImplicitConversion&)’ is deprecated [-Wdeprecated-copy]
284 | ret = conv;
| ^~~~
In file included from implconv.cc:4:
implconv.h:45:3: note: because ‘ImplicitConversion’ has user-provided ‘ImplicitConversion::ImplicitConversion(const ImplicitConversion&)’
45 | ImplicitConversion(ImplicitConversion const &obj)
| ^~~~~~~~~~~~~~~~~~
g++ -c -o implint.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound implint.cc
g++ -c -o integrity.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound integrity.cc
g++ -c -o lookupset.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound lookupset.cc
lookupset.cc: In copy constructor ‘LookupSet::LookupSet(const LookupSet&)’:
lookupset.cc:100:1: warning: base class ‘class SObjList<Variable>’ should be explicitly initialized in the copy constructor [-Wextra]
100 | LookupSet::LookupSet(LookupSet const &obj)
| ^~~~~~~~~
g++ -c -o mangle.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound mangle.cc
g++ -c -o mtype.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound mtype.cc
mtype.cc: In member function ‘bool IMType::imatchNontypeWithVariable(const STemplateArgument*, E_variable*, MatchFlags)’:
mtype.cc:311:22: warning: implicitly-declared ‘STemplateArgument& STemplateArgument::operator=(const STemplateArgument&)’ is deprecated [-Wdeprecated-copy]
311 | binding->sarg = *conc;
| ^~~~
In file included from cc.ast.gen.h:258,
from cc-ast.h:20,
from mtype.h:12,
from mtype.cc:13:
template.h:434:3: note: because ‘STemplateArgument’ has user-provided ‘STemplateArgument::STemplateArgument(const STemplateArgument&)’
434 | STemplateArgument(STemplateArgument const &obj);
| ^~~~~~~~~~~~~~~~~
mtype.cc: In member function ‘void MType::setBoundValue(StringRef, const STemplateArgument&)’:
mtype.cc:1278:13: warning: implicitly-declared ‘STemplateArgument& STemplateArgument::operator=(const STemplateArgument&)’ is deprecated [-Wdeprecated-copy]
1278 | b->sarg = value;
| ^~~~~
In file included from cc.ast.gen.h:258,
from cc-ast.h:20,
from mtype.h:12,
from mtype.cc:13:
template.h:434:3: note: because ‘STemplateArgument’ has user-provided ‘STemplateArgument::STemplateArgument(const STemplateArgument&)’
434 | STemplateArgument(STemplateArgument const &obj);
| ^~~~~~~~~~~~~~~~~
g++ -c -o overload.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound overload.cc
overload.cc: In member function ‘Candidate* OverloadResolver::makeCandidate(Variable*, Variable*)’:
overload.cc:862:36: warning: implicitly-declared ‘ImplicitConversion& ImplicitConversion::operator=(const ImplicitConversion&)’ is deprecated [-Wdeprecated-copy]
862 | c->conversions[argIndex] = ics;
| ^~~
In file included from overload.h:12,
from overload.cc:9:
implconv.h:45:3: note: because ‘ImplicitConversion’ has user-provided ‘ImplicitConversion::ImplicitConversion(const ImplicitConversion&)’
45 | ImplicitConversion(ImplicitConversion const &obj)
| ^~~~~~~~~~~~~~~~~~
overload.cc:884:36: warning: implicitly-declared ‘ImplicitConversion& ImplicitConversion::operator=(const ImplicitConversion&)’ is deprecated [-Wdeprecated-copy]
884 | c->conversions[argIndex] = ics;
| ^~~
In file included from overload.h:12,
from overload.cc:9:
implconv.h:45:3: note: because ‘ImplicitConversion’ has user-provided ‘ImplicitConversion::ImplicitConversion(const ImplicitConversion&)’
45 | ImplicitConversion(ImplicitConversion const &obj)
| ^~~~~~~~~~~~~~~~~~
overload.cc:896:36: warning: implicitly-declared ‘ImplicitConversion& ImplicitConversion::operator=(const ImplicitConversion&)’ is deprecated [-Wdeprecated-copy]
896 | c->conversions[argIndex] = ics;
| ^~~
In file included from overload.h:12,
from overload.cc:9:
implconv.h:45:3: note: because ‘ImplicitConversion’ has user-provided ‘ImplicitConversion::ImplicitConversion(const ImplicitConversion&)’
45 | ImplicitConversion(ImplicitConversion const &obj)
| ^~~~~~~~~~~~~~~~~~
overload.cc:911:36: warning: implicitly-declared ‘ImplicitConversion& ImplicitConversion::operator=(const ImplicitConversion&)’ is deprecated [-Wdeprecated-copy]
911 | c->conversions[argIndex] = ellipsis;
| ^~~~~~~~
In file included from overload.h:12,
from overload.cc:9:
implconv.h:45:3: note: because ‘ImplicitConversion’ has user-provided ‘ImplicitConversion::ImplicitConversion(const ImplicitConversion&)’
45 | ImplicitConversion(ImplicitConversion const &obj)
| ^~~~~~~~~~~~~~~~~~
g++ -c -o parssppt.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound parssppt.cc
g++ -c -o serialno.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound serialno.cc
g++ -c -o sprint.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound sprint.cc
g++ -c -o stdconv.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound stdconv.cc
g++ -c -o strip-comments.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound strip-comments.cc
g++ -c -o subobject-access-path.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound subobject-access-path.cc
g++ -c -o template.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound template.cc
template.cc: In member function ‘STemplateArgument* Env::makeDefaultTemplateArgument(const Variable*, MType&)’:
template.cc:2940:60: warning: implicitly-declared ‘STemplateArgument& STemplateArgument::operator=(const STemplateArgument&)’ is deprecated [-Wdeprecated-copy]
2940 | *ret = applyArgumentMapToExpression(map, param->value);
| ^
template.cc:683:1: note: because ‘STemplateArgument’ has user-provided ‘STemplateArgument::STemplateArgument(const STemplateArgument&)’
683 | STemplateArgument::STemplateArgument(STemplateArgument const &obj)
| ^~~~~~~~~~~~~~~~~
template.cc: In member function ‘STemplateArgument Env::applyArgumentMapToExpression(MType&, Expression*)’:
template.cc:3997:50: warning: implicitly-declared ‘STemplateArgument& STemplateArgument::operator=(const STemplateArgument&)’ is deprecated [-Wdeprecated-copy]
3997 | ret = map.getBoundValue(evar->var->name, tfac);
| ^
template.cc:683:1: note: because ‘STemplateArgument’ has user-provided ‘STemplateArgument::STemplateArgument(const STemplateArgument&)’
683 | STemplateArgument::STemplateArgument(STemplateArgument const &obj)
| ^~~~~~~~~~~~~~~~~
template.cc:4006:76: warning: implicitly-declared ‘STemplateArgument& STemplateArgument::operator=(const STemplateArgument&)’ is deprecated [-Wdeprecated-copy]
4006 | ret = applyArgumentMapToQualifiedName(map, evar->name->asPQ_qualifier());
| ^
template.cc:683:1: note: because ‘STemplateArgument’ has user-provided ‘STemplateArgument::STemplateArgument(const STemplateArgument&)’
683 | STemplateArgument::STemplateArgument(STemplateArgument const &obj)
| ^~~~~~~~~~~~~~~~~
template.cc: In member function ‘Variable* Env::makeExplicitFunctionSpecialization(SourceLoc, DeclFlags, PQName*, FunctionType*)’:
template.cc:4518:42: warning: implicitly-declared ‘STemplateArgument& STemplateArgument::operator=(const STemplateArgument&)’ is deprecated [-Wdeprecated-copy]
4518 | binding = *nameArgsIter.data();
| ^
template.cc:683:1: note: because ‘STemplateArgument’ has user-provided ‘STemplateArgument::STemplateArgument(const STemplateArgument&)’
683 | STemplateArgument::STemplateArgument(STemplateArgument const &obj)
| ^~~~~~~~~~~~~~~~~
g++ -c -o test-strip-comments.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound test-strip-comments.cc
g++ -c -o type-printer.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound type-printer.cc
g++ -c -o typelistiter.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound typelistiter.cc
g++ -c -o variable.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound variable.cc
rm -f libelsa.a
ar -r libelsa.a gnu.o ubermods-attrspec.o kandr.o cc-lang.o type-sizes.o baselexer.o lexer.o lexer.yy.o cc-tokens.o cc-flags.o ast_build.o astvisit.o builtinops.o cc-ast-aux.o cc-elaborate.o cc-env.o cc-err.o cc-flags.o cc-print.o cc-scope.o cc-tcheck.o cc-type-visitor.o cc-type.o cc.ast.gen.o cc.gr.gen.o ccparse.o cfg.o const-eval.o elsaparse.o implconv.o implint.o integrity.o lookupset.o mangle.o mtype.o overload.o parssppt.o serialno.o sprint.o stdconv.o strip-comments.o subobject-access-path.o template.o test-strip-comments.o type-printer.o type-sizes.o typelistiter.o variable.o
ar: creating libelsa.a
ranlib libelsa.a
g++ -o semgrep.exe -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound semgrep.o libelsa.a ../elkhound/libelkhound.a ../ast/libast.a ../smbase/libsmbase.a
g++ -c -o iptparse.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound iptparse.cc
iptparse.cc: In function ‘void shuffleRange(ArrayStack<Interval>&, int, int)’:
iptparse.cc:92:28: warning: implicitly-declared ‘constexpr Interval::Interval(const Interval&)’ is deprecated [-Wdeprecated-copy]
92 | Interval tmp = pairs[lo];
| ^
In file included from iptparse.cc:5:
iptree.h:57:13: note: because ‘Interval’ has user-provided ‘Interval& Interval::operator=(const Interval&)’
57 | Interval& operator= (Interval const &obj)
| ^~~~~~~~
g++ -c -o iptparse.yy.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound iptparse.yy.cc
g++ -c -o iptree.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound iptree.cc
g++ -c -o smin.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound smin.cc
g++ -o smin.exe -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound iptparse.o iptparse.yy.o iptree.o smin.o ../elkhound/libelkhound.a ../ast/libast.a ../smbase/libsmbase.a
g++ -c -o main.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound main.cc
g++ -c -o test-astbuild.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound test-astbuild.cc
g++ -c -o clang-import-stub.o -MMD -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound clang-import-stub.cc
g++ -o ccparse.exe -g -O2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -I../smbase -I../ast -I../elkhound main.o test-astbuild.o clang-import-stub.o libelsa.a ../elkhound/libelkhound.a ../ast/libast.a ../smbase/libsmbase.a
./ccparse.exe in/t0001.cc
When testing with non trivial source code the output of trace -tr
can be long and sometimes we are only interested in a range of lines, would be nice to have a way to specify it, maybe something like:
ccparse -tr printAST,35119-35127 sqlite3.pp2.c
I'm trying to parse sqlite3
(see attached preprocessed attachment) with elsa
, I commented out # line
directives and __attribute__((fallthrough));
and added several builtins (see bellow) but I don't know how to create some overloads:
/usr/bin/time ../elsa/ccparse.exe sqlite3.pp2.c
sqlite3.pp2.c:12577:7: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:12596:5: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:17546:3: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:27129:20: error: Cannot convert initializer '__builtin_alloca(sizeof((*p).u.aHash))' with type 'int' to type '/*u32*//*uint32_t*//*__uint32_t*/unsigned *'.
sqlite3.pp2.c:36009:51: error: cannot convert argument type '/*ht_slot*//*u16*//*uint16_t*//*__uint16_t*/unsigned short volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:36733:3: error: cannot convert argument type '/*u32*//*uint32_t*//*__uint32_t*/unsigned volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:36785:11: error: cannot convert argument type '/*u32*//*uint32_t*//*__uint32_t*/unsigned volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:36799:11: error: cannot convert argument type '/*u32*//*uint32_t*//*__uint32_t*/unsigned volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:36872:9: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:36901:11: error: cannot convert argument type '/*u32*//*uint32_t*//*__uint32_t*/unsigned volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:37457:3: error: cannot convert argument type '/*u32*//*uint32_t*//*__uint32_t*/unsigned volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:37494:9: error: cannot convert argument type '/*u32*//*uint32_t*//*__uint32_t*/unsigned volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:37515:9: error: cannot convert argument type '/*u32*//*uint32_t*//*__uint32_t*/unsigned volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:37557:3: error: cannot convert argument type '/*u32*//*uint32_t*//*__uint32_t*/unsigned volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:37563:3: error: cannot convert argument type '/*u32*//*uint32_t*//*__uint32_t*/unsigned volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:37682:5: error: cannot convert argument type '/*ht_slot*//*u16*//*uint16_t*//*__uint16_t*/unsigned short volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:46888:3: error: cannot convert assignment RHS type 'int' to type '/*u8*//*uint8_t*//*__uint8_t*/unsigned char **'
sqlite3.pp2.c:49036:3: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:49102:3: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:54531:5: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:57901:9: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:60027:3: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:60054:3: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:72961:3: error: cannot convert assignment RHS type 'int' to type 'int (*)(/*Walker*/Walker *, /*Select*/Select *)'
sqlite3.pp2.c:125270:3: error: cannot convert assignment RHS type 'int' to type 'char *'
sqlite3.pp2.c:134093:5: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:134150:7: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:135034:7: error: cannot convert argument type 'void (**)(void *, int , char const *)' to parameter 1 type 'int *'
sqlite3.pp2.c:135034:7: error: cannot convert argument type '/*LOGFUNC_t*/void (*&)(void *, int , char const *)' to parameter 2 type 'int'
sqlite3.pp2.c:135035:7: error: cannot convert argument type 'void **' to parameter 1 type 'int *'
sqlite3.pp2.c:135035:7: error: cannot convert argument type 'void *&' to parameter 2 type 'int'
sqlite3.pp2.c:135062:7: error: cannot convert argument type '/*u8*//*uint8_t*//*__uint8_t*/unsigned char *' to parameter 1 type 'int *'
sqlite3.pp2.c:136205:3: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:136214:3: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:136845:5: error: cannot convert argument type 'int volatile *' to parameter 1 type 'int *'
sqlite3.pp2.c:137238:3: error: cannot convert argument type '/*u8*//*uint8_t*//*__uint8_t*/unsigned char *' to parameter 1 type 'int *'
Command exited with non-zero status 2
3.12user 0.08system 0:03.20elapsed 99%CPU (0avgtext+0avgdata 133848maxresident)k
0inputs+0outputs (0major+32238minor)pagefaults 0swaps
---------------------------------- cc-env.cc ----------------------------------
index e4b3c43..9938cda 100644
@@ -1225,6 +1225,21 @@ Variable *Env::declareFunction2arg(Type *retType, char const *funcName,
}
+Variable *Env::declareFunction3arg(Type *retType, char const *funcName,
+ Type *arg1Type, char const *arg1Name,
+ Type *arg2Type, char const *arg2Name,
+ Type *arg3Type, char const *arg3Name,
+ FunctionFlags flags,
+ Type * /*nullable*/ exnType)
+{
+ Type *types[3] = { arg1Type, arg2Type, arg3Type };
+ char const *names[3] = { arg1Name, arg2Name, arg3Name };
+ return declareFunctionNargs(retType, funcName,
+ types, names, 3 /*numArgs*/,
+ flags, exnType);
+}
+
+
Variable *Env::declareFunction4arg(Type *retType, char const *funcName,
Type *arg1Type, char const *arg1Name,
Type *arg2Type, char const *arg2Name,
----------------------------------- cc-env.h -----------------------------------
index 604a64b..9d88473 100644
@@ -278,7 +278,12 @@ private: // funcs
FunctionFlags flags = FF_NONE,
Type * /*nullable*/ exnType = NULL);
- // NOTE: 3 arg missing; goes here.
+ Variable *declareFunction3arg(Type *retType, char const *funcName,
+ Type *arg1Type, char const *arg1Name,
+ Type *arg2Type, char const *arg2Name,
+ Type *arg3Type, char const *arg3Name,
+ FunctionFlags flags,
+ Type * /*nullable*/ exnType = NULL);
Variable *declareFunction4arg(Type *retType, char const *funcName,
Type *arg1Type, char const *arg1Name,
------------------------------------ gnu.cc ------------------------------------
index e7b8f33..0c54474 100644
@@ -68,19 +68,135 @@ void Env::addGNUBuiltins()
// Type *t_voidconst = getSimpleType(SL_INIT, ST_VOID, CV_CONST);
// Type *t_voidptr = makePtrType(t_void);
// Type *t_voidconstptr = makePtrType(SL_INIT, t_voidconst);
+ Type *t_unsigned_short_ptr = makePtrType(getSimpleType(ST_UNSIGNED_SHORT_INT));
+ Type *t_int_ptr = makePtrType(getSimpleType(ST_INT));
+ Type *t_unsigned_int_ptr = makePtrType(getSimpleType(ST_UNSIGNED_INT));
+ Type *t_unsigned_short = getSimpleType(ST_UNSIGNED_SHORT_INT);
Type *t_int = getSimpleType(ST_INT);
-// Type *t_unsigned_int = getSimpleType(ST_UNSIGNED_INT);
+ Type *t_unsigned_int = getSimpleType(ST_UNSIGNED_INT);
+ Type *t_long_long = getSimpleType(ST_LONG_LONG);
+ Type *t_long_long_ptr = makePtrType(getSimpleType(ST_LONG_LONG));
+ Type *t_unsigned_long_long = getSimpleType(ST_UNSIGNED_LONG_LONG);
Type *t_char = getSimpleType(ST_CHAR);
Type *t_charconst = getSimpleType(ST_CHAR, CV_CONST);
Type *t_charptr = makePtrType(t_char);
Type *t_charconstptr = makePtrType(t_charconst);
+ Type *t_float = getSimpleType(ST_FLOAT);
+ Type *t_double = getSimpleType(ST_DOUBLE);
+
// dsw: This is a form, not a function, since it takes an expression
// AST node as an argument; however, I need a function that takes no
// args as a placeholder for it sometimes.
var__builtin_constant_p = declareSpecialFunction("__builtin_constant_p");
+ // typedef float _Float32;
+ Variable *var_Float32 =
+ makeVariable(SL_INIT, str("_Float32"),
+ t_float, DF_TYPEDEF | DF_BUILTIN);
+ addVariable(var_Float32);
+ env.builtinVars.push(var_Float32);
+
+ // typedef float _Float32;
+ Variable *var_Float32x =
+ makeVariable(SL_INIT, str("_Float32x"),
+ getSimpleType(ST_FLOAT), DF_TYPEDEF | DF_BUILTIN);
+ addVariable(var_Float32x);
+ env.builtinVars.push(var_Float32x);
+
+ // typedef double _Float64;
+ Variable *var_Float64 =
+ makeVariable(SL_INIT, str("_Float64"),
+ t_double, DF_TYPEDEF | DF_BUILTIN);
+ addVariable(var_Float64);
+ env.builtinVars.push(var_Float64);
+
+ // typedef double _Float64x;
+ Variable *var_Float64x =
+ makeVariable(SL_INIT, str("_Float64x"),
+ getSimpleType(ST_DOUBLE), DF_TYPEDEF | DF_BUILTIN);
+ addVariable(var_Float64x);
+ env.builtinVars.push(var_Float64x);
+
+ // typedef double _Float128;
+ Variable *var_Float128 =
+ makeVariable(SL_INIT, str("_Float128"),
+ getSimpleType(ST_DOUBLE), DF_TYPEDEF | DF_BUILTIN);
+ addVariable(var_Float128);
+ env.builtinVars.push(var_Float128);
+
+ // unsigned int __builtin_bswap16(unsigned int __bsx);
+ declareFunction1arg(t_unsigned_short, "__builtin_bswap16",
+ t_unsigned_short, "__bsx");
+
+ // unsigned int __builtin_bswap32(unsigned int __bsx);
+ declareFunction1arg(t_unsigned_int, "__builtin_bswap32",
+ t_unsigned_int, "__bsx");
+
+ // __uint64_t __builtin_bswap64(unsigned int __bsx);
+ declareFunction1arg(t_unsigned_long_long, "__builtin_bswap64",
+ t_unsigned_long_long, "__bsx");
+
+ // __uint64_t __builtin_isnan(double __val);
+ declareFunction1arg(t_int, "__builtin_isnan",
+ t_double, "__val");
+
+ // float __builtin_inff();
+ declareFunction0arg(t_float, "__builtin_inff");
+
+ //bool __builtin_add_overflow (type1 a, type2 b, type3 *res);
+ declareFunction3arg(t_int, "__builtin_add_overflow",
+ t_long_long, "a",
+ t_long_long, "b",
+ t_long_long_ptr, "res",
+ FF_NONE);
+
+ //bool __builtin_sub_overflow (type1 a, type2 b, type3 *res);
+ declareFunction3arg(t_int, "__builtin_sub_overflow",
+ t_long_long, "a",
+ t_long_long, "b",
+ t_long_long_ptr, "res",
+ FF_NONE);
+
+ //bool __builtin_miñ_overflow (type1 a, type2 b, type3 *res);
+ declareFunction3arg(t_int, "__builtin_mul_overflow",
+ t_long_long, "a",
+ t_long_long, "b",
+ t_long_long_ptr, "res",
+ FF_NONE);
+
+ // void __sync_synchronize();
+ declareFunction0arg(t_void, "__sync_synchronize");
+
+ //void __atomic_store_n (int *ptr, int val, int memorder);
+ declareFunction3arg(t_void, "__atomic_store_n",
+ t_int_ptr, "ptr",
+ t_int, "val",
+ t_int, "memorder",
+ FF_NONE);
+
+ //int __atomic_load_n (int *ptr, int memorder);
+ declareFunction2arg(t_int, "__atomic_load_n",
+ t_int_ptr, "ptr",
+ t_int, "memorder",
+ FF_NONE);
+
+ //void __atomic_store_n (unsigned int *ptr, unsigned int val, int memorder);
+ declareFunction3arg(t_void, "__atomic_store_n",
+ t_unsigned_int_ptr, "ptr",
+ t_unsigned_int, "val",
+ t_int, "memorder",
+ FF_NONE);
+
+ //void __atomic_store_n (t_unsigned_short *ptr, t_unsigned_short val, int memorder);
+ declareFunction3arg(t_void, "__atomic_store_n",
+ t_unsigned_short_ptr, "ptr",
+ t_unsigned_short, "val",
+ t_int, "memorder",
+ FF_NONE);
+
+
// typedef void *__builtin_va_list;
Variable *var__builtin_va_list =
makeVariable(SL_INIT, str("__builtin_va_list"),
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.