From b6a8b96b678eeda4f61ee8e20a19a47707537637 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 26 Jun 2015 01:12:33 +0300 Subject: Rename to Ast dumper to Paranoid null checker. --- README.md | 10 ++--- README.ru.md | 10 ++--- astdumper.so | 1 - configure.ac | 2 +- cppastdumper.so | 1 - cxxparanucker.so | 1 + examples/cexample.sh | 2 +- examples/cppexample.cpp | 77 -------------------------------------- examples/cppexample.sh | 3 -- examples/cxxexample.cpp | 77 ++++++++++++++++++++++++++++++++++++++ examples/cxxexample.sh | 3 ++ paranucker.so | 1 + src/Makefile.am | 16 ++++---- src/includes.h | 2 +- src/parsers/block/try_block.cpp | 2 +- src/parsers/cst/ptrmem_cst.cpp | 2 +- src/parsers/decl/template_decl.cpp | 2 +- src/parsers/expr/aggrinit_expr.cpp | 2 +- src/parsers/expr/vecinit_expr.cpp | 2 +- src/parsers/templateparmindex.cpp | 2 +- src/parsers/templatetypeparm.cpp | 2 +- src/parsers/type/typename_type.cpp | 4 +- test/Makefile | 8 ++-- 23 files changed, 116 insertions(+), 116 deletions(-) delete mode 120000 astdumper.so delete mode 120000 cppastdumper.so create mode 120000 cxxparanucker.so delete mode 100644 examples/cppexample.cpp delete mode 100755 examples/cppexample.sh create mode 100644 examples/cxxexample.cpp create mode 100755 examples/cxxexample.sh create mode 120000 paranucker.so diff --git a/README.md b/README.md index 647404b..14219a8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Ast Dumper - static code analyser for C/C++ +# Paranoid null checker (paranucker) - static code analyser for C/C++ This is [gcc](https://gcc.gnu.org) plugin for dump [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) tree and search possible null pointers. @@ -20,8 +20,8 @@ Version 1.0 Date: 2015-06-22 ## Build - Run build.sh - - You will get astdumper.so for gcc binary - and cppastdumper.so for g++ binary + - You will get paranucker.so for gcc binary + and cxxparanucker.so for g++ binary ## Usage examples In directory [examples](examples) present two examples one for C++ and other for C. @@ -31,10 +31,10 @@ In directory [examples](examples) present two examples one for C++ and other for - [Hercules](http://herc.ws/) ## Advanced usage -Ast Dumper support one plugin paramater named -fplugin-arg-astdumper-command or -fplugin-arg-cppastdumper-command depend what you using C or C++ +Paranoid null checker support one plugin paramater named -fplugin-arg-paranucker-command or -fplugin-arg-cxxparanucker-command depend what you using C or C++ Example: - gcc-5 -fplugin=../astdumper.so -fplugin-arg-astdumper-command=detectnullpointers + gcc-5 -fplugin=../paranucker.so -fplugin-arg-paranucker-command=detectnullpointers Known parameter values: diff --git a/README.ru.md b/README.ru.md index d13825e..1677a42 100644 --- a/README.ru.md +++ b/README.ru.md @@ -1,4 +1,4 @@ -# Ast Dumper - статический анализатор C/C++ кода. +# Paranoid null checker (paranucker) - статический анализатор C/C++ кода. Представляет собой плагин к компилятору [gcc](https://gcc.gnu.org). Есть возможность вывода абстрактного синтаксического дерева [AST](https://ru.wikipedia.org/wiki/Абстрактное_синтаксическое_дерево) и поиска нулевых указателей. @@ -21,8 +21,8 @@ ## Компиляции - Запустить build.sh - - Вы получите два файла. astdumper.so для C/gcc. - и cppastdumper.so для C++/g++ + - Вы получите два файла. paranucker.so для C/gcc. + и cxxparanucker.so для C++/g++ ## Примеры использования В директории [examples](examples) находится два примера для C++ и C. @@ -32,10 +32,10 @@ - [Hercules](http://herc.ws/) ## Расширенное использование -Ast Dumper поддерживает один параметр с именем -fplugin-arg-astdumper-command или -fplugin-arg-cppastdumper-command в зависимости от того, что вы используется C или C++. +Paranoid null checker поддерживает один параметр с именем -fplugin-arg-paranucker-command или -fplugin-arg-cxxparanucker-command в зависимости от того, что вы используется C или C++. Пример: - gcc-5 -fplugin=../astdumper.so -fplugin-arg-astdumper-command=detectnullpointers + gcc-5 -fplugin=../paranucker.so -fplugin-arg-paranucker-command=detectnullpointers Возможные значения параметра: diff --git a/astdumper.so b/astdumper.so deleted file mode 120000 index ae8b7d1..0000000 --- a/astdumper.so +++ /dev/null @@ -1 +0,0 @@ -build/src/.libs/libastdumper.so \ No newline at end of file diff --git a/configure.ac b/configure.ac index 9d6792a..f958b6a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(astdumper, 1.0, akaras@inbox.ru) +AC_INIT(paranucker, 1.0, akaras@inbox.ru) AC_CONFIG_AUX_DIR(config) AC_CONFIG_SRCDIR(src) AC_CONFIG_MACRO_DIR([m4]) diff --git a/cppastdumper.so b/cppastdumper.so deleted file mode 120000 index 47af69e..0000000 --- a/cppastdumper.so +++ /dev/null @@ -1 +0,0 @@ -build/src/.libs/libcppastdumper.so \ No newline at end of file diff --git a/cxxparanucker.so b/cxxparanucker.so new file mode 120000 index 0000000..255d53b --- /dev/null +++ b/cxxparanucker.so @@ -0,0 +1 @@ +build/src/.libs/libcxxparanucker.so \ No newline at end of file diff --git a/examples/cexample.sh b/examples/cexample.sh index eff04e5..89861ab 100755 --- a/examples/cexample.sh +++ b/examples/cexample.sh @@ -1,3 +1,3 @@ #!/bin/bash -gcc-5 -fplugin=../astdumper.so -fplugin-arg-astdumper-command=detectnullpointers cexample.c +gcc-5 -fplugin=../paranucker.so -fplugin-arg-paranucker-command=detectnullpointers cexample.c diff --git a/examples/cppexample.cpp b/examples/cppexample.cpp deleted file mode 100644 index 46b3c01..0000000 --- a/examples/cppexample.cpp +++ /dev/null @@ -1,77 +0,0 @@ -class Data1 -{ - public: - int val; -}; - -int main(int) -{ -} - -class Object1 -{ - int k; - - void func1(Data1 *ptr1, Data1 *ptr2) - { - if (!ptr1 || ptr1->val == 100) - { - return; - } - - ptr1->val = 200; - } - - void func2(Data1 *ptr1, Data1 *ptr2) - { - if (ptr1 && ptr1->val == 100) - { - ptr1->val = 200; - return; - } - - ptr1->val = 300; - } - - void func3(Data1 *ptr1, Data1 *ptr2) - { - if (ptr1 || ptr1->val == 100) - { - return; - } - - ptr1->val = 200; - } - - void func4(Data1 *ptr1, Data1 *ptr2) - { - if (!ptr1 && ptr1->val == 100) - { - return; - } - - ptr1->val = 200; - } - - void func5(Data1 *ptr1, Data1 *ptr2) - { - if ((!ptr1 || ptr1->val == 100) || (!ptr2 || ptr2->val == 200)) - { - return; - } - - ptr1->val = 300; - ptr2->val = 400; - } - - void func6(Data1 *ptr1, Data1 *ptr2) - { - if ((!ptr1 || ptr1->val == 100) && (!ptr2 || ptr2->val == 200)) - { - return; - } - - ptr1->val = 300; - ptr2->val = 400; - } -}; diff --git a/examples/cppexample.sh b/examples/cppexample.sh deleted file mode 100755 index d6ff401..0000000 --- a/examples/cppexample.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -g++-5 -fplugin=../cppastdumper.so -fplugin-arg-cppastdumper-command=detectnullpointers cppexample.cpp diff --git a/examples/cxxexample.cpp b/examples/cxxexample.cpp new file mode 100644 index 0000000..46b3c01 --- /dev/null +++ b/examples/cxxexample.cpp @@ -0,0 +1,77 @@ +class Data1 +{ + public: + int val; +}; + +int main(int) +{ +} + +class Object1 +{ + int k; + + void func1(Data1 *ptr1, Data1 *ptr2) + { + if (!ptr1 || ptr1->val == 100) + { + return; + } + + ptr1->val = 200; + } + + void func2(Data1 *ptr1, Data1 *ptr2) + { + if (ptr1 && ptr1->val == 100) + { + ptr1->val = 200; + return; + } + + ptr1->val = 300; + } + + void func3(Data1 *ptr1, Data1 *ptr2) + { + if (ptr1 || ptr1->val == 100) + { + return; + } + + ptr1->val = 200; + } + + void func4(Data1 *ptr1, Data1 *ptr2) + { + if (!ptr1 && ptr1->val == 100) + { + return; + } + + ptr1->val = 200; + } + + void func5(Data1 *ptr1, Data1 *ptr2) + { + if ((!ptr1 || ptr1->val == 100) || (!ptr2 || ptr2->val == 200)) + { + return; + } + + ptr1->val = 300; + ptr2->val = 400; + } + + void func6(Data1 *ptr1, Data1 *ptr2) + { + if ((!ptr1 || ptr1->val == 100) && (!ptr2 || ptr2->val == 200)) + { + return; + } + + ptr1->val = 300; + ptr2->val = 400; + } +}; diff --git a/examples/cxxexample.sh b/examples/cxxexample.sh new file mode 100755 index 0000000..4c1a5a5 --- /dev/null +++ b/examples/cxxexample.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +g++-5 -fplugin=../cxxparanucker.so -fplugin-arg-cxxparanucker-command=detectnullpointers cxxexample.cpp diff --git a/paranucker.so b/paranucker.so new file mode 120000 index 0000000..35f1abd --- /dev/null +++ b/paranucker.so @@ -0,0 +1 @@ +build/src/.libs/libparanucker.so \ No newline at end of file diff --git a/src/Makefile.am b/src/Makefile.am index 36200bf..ed51167 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,14 +35,14 @@ if ENABLE_GPROF SHARED_CXXFLAGS += "-pg" endif -lib_LTLIBRARIES = libastdumper.la libcppastdumper.la -libastdumper_la_SOURCES = ${SRC} -libastdumper_la_LDFLAGS = ${SHARED_LDFLAGS} -libastdumper_la_CXXFLAGS = ${SHARED_CXXFLAGS} +lib_LTLIBRARIES = libparanucker.la libcxxparanucker.la +libparanucker_la_SOURCES = ${SRC} +libparanucker_la_LDFLAGS = ${SHARED_LDFLAGS} +libparanucker_la_CXXFLAGS = ${SHARED_CXXFLAGS} -libcppastdumper_la_SOURCES = ${SRC} custom/fixed-cp-tree.h -libcppastdumper_la_LDFLAGS = ${SHARED_LDFLAGS} -libcppastdumper_la_CXXFLAGS = ${SHARED_CXXFLAGS} -DENABLE_CPPLANG +libcxxparanucker_la_SOURCES = ${SRC} custom/fixed-cp-tree.h +libcxxparanucker_la_LDFLAGS = ${SHARED_LDFLAGS} +libcxxparanucker_la_CXXFLAGS = ${SHARED_CXXFLAGS} -DENABLE_CXXLANG -all-local: libastdumper.la libcppastdumper.la +all-local: libparanucker.la libcxxparanucker.la echo done diff --git a/src/includes.h b/src/includes.h index 51a6999..bd4cf04 100644 --- a/src/includes.h +++ b/src/includes.h @@ -41,7 +41,7 @@ #include "tree.h" #include "print-tree.h" -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG #include "cp/cp-tree.h" #else #include "c-family/c-common.h" diff --git a/src/parsers/block/try_block.cpp b/src/parsers/block/try_block.cpp index bf320f2..8d6f8aa 100644 --- a/src/parsers/block/try_block.cpp +++ b/src/parsers/block/try_block.cpp @@ -34,7 +34,7 @@ void parseTryBlockNode(TryBlockNode *node) fillExprLocation(node); Log::dump(node); -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG setPrintField(node, CLEANUP_P, isClean); node->body = createParseNode( diff --git a/src/parsers/cst/ptrmem_cst.cpp b/src/parsers/cst/ptrmem_cst.cpp index 7934769..e783cdb 100644 --- a/src/parsers/cst/ptrmem_cst.cpp +++ b/src/parsers/cst/ptrmem_cst.cpp @@ -33,7 +33,7 @@ void parsePtrMemCstNode(PtrMemCstNode *node) fillType(node); Log::dump(node); -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG node->record = createParseNode( node, PTRMEM_CST_CLASS(node->gccNode), diff --git a/src/parsers/decl/template_decl.cpp b/src/parsers/decl/template_decl.cpp index 394f427..21220b5 100644 --- a/src/parsers/decl/template_decl.cpp +++ b/src/parsers/decl/template_decl.cpp @@ -38,7 +38,7 @@ void parseTemplateDeclNode(TemplateDeclNode *node) fillDeclAutoGenerated(node); fillDeclAttributes(node); -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG node->specializations = static_cast(createParseNode( node, DECL_TEMPLATE_SPECIALIZATIONS(node->gccNode), diff --git a/src/parsers/expr/aggrinit_expr.cpp b/src/parsers/expr/aggrinit_expr.cpp index b5c17ae..6642631 100644 --- a/src/parsers/expr/aggrinit_expr.cpp +++ b/src/parsers/expr/aggrinit_expr.cpp @@ -36,7 +36,7 @@ void parseAggrInitExprNode(AggrInitExprNode *node) //fillExprOperands(node); -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG node->function = createParseNode( node, AGGR_INIT_EXPR_FN(node->gccNode), diff --git a/src/parsers/expr/vecinit_expr.cpp b/src/parsers/expr/vecinit_expr.cpp index 178b414..88817aa 100644 --- a/src/parsers/expr/vecinit_expr.cpp +++ b/src/parsers/expr/vecinit_expr.cpp @@ -34,7 +34,7 @@ void parseVecInitExprNode(VecInitExprNode *node) fillExprLocation(node); Log::dump(node); -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG setPrintField(node, VEC_INIT_EXPR_IS_CONSTEXPR, isConstExpr); #endif diff --git a/src/parsers/templateparmindex.cpp b/src/parsers/templateparmindex.cpp index a5f6b62..211ccab 100644 --- a/src/parsers/templateparmindex.cpp +++ b/src/parsers/templateparmindex.cpp @@ -32,7 +32,7 @@ void parseTemplateParmIndexNode(TemplateParmIndexNode *node) fillType(node); Log::dump(node); -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG setPrintField(node, TEMPLATE_PARM_IDX, parmIdx); setPrintField(node, TEMPLATE_PARM_LEVEL, parmLevel); setPrintField(node, TEMPLATE_PARM_ORIG_LEVEL, parmOrigLevel); diff --git a/src/parsers/templatetypeparm.cpp b/src/parsers/templatetypeparm.cpp index 46dc18b..9f0978e 100644 --- a/src/parsers/templatetypeparm.cpp +++ b/src/parsers/templatetypeparm.cpp @@ -32,7 +32,7 @@ void parseTemplateTypeParmNode(TemplateTypeParmNode *node) fillType(node); Log::dump(node); -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG node->index = createParseNode( node, TEMPLATE_TYPE_PARM_INDEX(node->gccNode), diff --git a/src/parsers/type/typename_type.cpp b/src/parsers/type/typename_type.cpp index 2acb957..8439504 100644 --- a/src/parsers/type/typename_type.cpp +++ b/src/parsers/type/typename_type.cpp @@ -33,7 +33,7 @@ void parseTypeNameTypeNode(TypeNameTypeNode *node) fillType(node); Log::dump(node); -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG setPrintField(node, TYPENAME_IS_ENUM_P, isEnum); setPrintField(node, TYPENAME_IS_CLASS_P, isClass); setPrintField(node, TYPENAME_IS_RESOLVING_P, isResolving); @@ -42,7 +42,7 @@ void parseTypeNameTypeNode(TypeNameTypeNode *node) fillTypeName(node); fillTypeAttributes(node); -#ifdef ENABLE_CPPLANG +#ifdef ENABLE_CXXLANG node->fullName = createParseNode( node, TYPENAME_TYPE_FULLNAME(node->gccNode), diff --git a/test/Makefile b/test/Makefile index ded802e..885abe0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -30,11 +30,11 @@ CC := gcc-5 CXX := g++-5 MAKEFLAGS += --jobs=9 -PLUGINXX = ../cppastdumper.so -PLUGIN = ../astdumper.so +PLUGINXX = ../cxxparanucker.so +PLUGIN = ../paranucker.so -CMDXX = LANG=C ${CXX} -c ${4} -fplugin=${PLUGINXX} -fplugin-arg-cppastdumper-command=${1} ${2} -o ../build/${3}.out 2>${3} -CMD = LANG=C ${CC} -c ${4} -fplugin=${PLUGIN} -fplugin-arg-astdumper-command=${1} ${2} -o ../build/${3}.out 2>${3} +CMDXX = LANG=C ${CXX} -c ${4} -fplugin=${PLUGINXX} -fplugin-arg-cxxparanucker-command=${1} ${2} -o ../build/${3}.out 2>${3} +CMD = LANG=C ${CC} -c ${4} -fplugin=${PLUGIN} -fplugin-arg-paranucker-command=${1} ${2} -o ../build/${3}.out 2>${3} all: ${ALLTESTS} ${CRASHES} tests: ${ALLTESTS} -- cgit v1.2.3-70-g09d2