![]() ![]() Also note that not all Matlab releases support all options. To which were added in recent years ‘-eml’, ‘-codegen’ etc. '-all' % ? '-allmsg' % display the full list of possible mlint messages and their codes '-amb' % display all possibly-ambiguous identifiers (variable/function) '-body' % ? '-callops' % display the internal call tree, with nesting levels and function types '-calls' % (looks similar to -callops, not sure what the difference is) '-com' % ? '-cyc' % display McCabe complexity value of all functions in the analyzed file % '-db' % = -set + -ud + -tab '-dty' % debug info for the mlint parsing tree '-edit' % display all encountered identifiers and their assumed types '-en' % messages in English '-id' % display the mlint code associated with each message '-ja' % messages in Japanese '-lex' % display the LEX parse-tree for the analyzed file '-m0' % + other opt '-m1' % + other opt '-m2' % + other opt '-m3' % + other opt '-mess' % debug info for mlint message-reporting (start/end locations etc.) '-msg' % (looks similar to -allmsg above, not sure what the difference is) '-notok' % disregard %#ok directives and report messages on lines having them '-pf' % ? '-set' % debug info for the mlint parsing tree '-spmd' % ? (presumably display SPMD-related messages) '-stmt' % display the number of statements in each function within the analyzed file '-tab' % set-by/used-by table for all identifiers (see -edit) '-tmtree' % not valid anymore '-tmw' % not valid anymore '-toks' % ? '-tree' % debug info for the mlint parsing tree '-ty' % display the line numbers where each of the file's identifiers are used '-ud' % debug info for the mlint parsing tree '-yacc' % ONLY: !mlint FILE -yacc. The core function mlintmex returns a long string with embedded newlines to separate the messages. Wrapping all that is the mlintrpt function, which calls mlint/checkcode internally. However, using mlint still works even today. In R2011b (Matlab 7.13) its official function name has changed to checkcode, although this was never documented in the release notes for some reason. Wrapping the core mlintmex function is the mlint m-function ( %matlabroot%/toolbox/matlab/codetools/mlint.m) that calls mlintmex internally. However, the name and interface of the mlintmex function have remained unchanged over the years. In recent releases, mlintmex, just like many other core mex files, was ported into a core Matlab library ( libmwbuiltins.dll on Windows). For many years mlint relied on a mex file ( %matlabroot%/toolbox/matlab/codetools/x*), which is basically just a wrapper for mlint.dll where the core algorithm resides. Naturally, there is (and has always been) an undocumented back door.įrom its earliest beginnings, mlint has relied on C code (presumably modeled after lint). Unfortunately, to this day (R2013a), there is no documented manner of programmatically separating mlint warnings and errors, nor for accessing any of the multitude of features that are readily available in mlint. Since its development (in R14 I believe), and especially since its incorporation in Matlab’s Editor in R2006a (Matlab 7.2), mlint has become a very important tool for reporting potential problems in m-files. Mlint, Matlab’s static code-analysis parser, was written by Stephen Johnson (the original developer of the enormously successful lint parser for C/C++ back in 1977), when he was lured by MathWorks in 2002 to develop a similar tool for Matlab. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |