This commit is contained in:
Martin Ettl 2018-02-25 16:38:51 +01:00
commit defb74c0fe
2 changed files with 637 additions and 320 deletions

View File

@ -22,7 +22,7 @@
<location filename="about.ui" line="81"/>
<source>Copyright © 2007-2018 Cppcheck team.</source>
<oldsource>Copyright © 2007-2017 Cppcheck team.</oldsource>
<translation type="unfinished"></translation>
<translation>Copyright © 2007-2018 Cppcheck team.</translation>
</message>
<message>
<location filename="about.ui" line="91"/>
@ -167,7 +167,7 @@ Parameters: -l(line) (file)
<message>
<location filename="librarydialog.ui" line="36"/>
<source>Save as</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="librarydialog.ui" line="62"/>
@ -250,27 +250,27 @@ Parameters: -l(line) (file)
<location filename="librarydialog.cpp" line="107"/>
<location filename="librarydialog.cpp" line="144"/>
<source>Cppcheck</source>
<translation type="unfinished">Cppcheck</translation>
<translation>Cppcheck</translation>
</message>
<message>
<location filename="librarydialog.cpp" line="96"/>
<source>Can not open file %1.</source>
<translation type="unfinished"></translation>
<translation> %1</translation>
</message>
<message>
<location filename="librarydialog.cpp" line="108"/>
<source>Failed to load %1. %2.</source>
<translation type="unfinished"></translation>
<translation>(%1.%2)</translation>
</message>
<message>
<location filename="librarydialog.cpp" line="145"/>
<source>Can not save file %1.</source>
<translation type="unfinished"></translation>
<translation> %1</translation>
</message>
<message>
<location filename="librarydialog.cpp" line="157"/>
<source>Save the library as</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@ -288,17 +288,18 @@ Parameters: -l(line) (file)
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt; memcmp(x, y, i == 123); // last argument should not have a bool value&lt;/pre&gt;
&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;
&lt;p&gt; &apos;!&apos; bool値は許可されていますか&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;
&lt;p&gt;? &apos;!&apos; &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;:&lt;/p&gt;
&lt;pre&gt; memcmp(x, y, i == 123); // 最後の引数はbool値を許可しない &lt;/pre&gt;
&lt;pre&gt; memcmp(x, y, i == 123); // 最後の引数は、ブール型であってはならない
&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="libraryeditargdialog.ui" line="28"/>
<source>Not bool</source>
<translation type="unfinished">bool値</translation>
<translatorcomment></translatorcomment>
<translation>bool値</translation>
</message>
<message>
<location filename="libraryeditargdialog.ui" line="35"/>
@ -394,7 +395,7 @@ Parameters: -l(line) (file)
<message>
<location filename="libraryeditargdialog.ui" line="310"/>
<source>Valid values</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@ -477,7 +478,7 @@ Parameters: -l(line) (file)
<location filename="mainwindow.ui" line="143"/>
<source>&amp;C standard</source>
<oldsource>C standard</oldsource>
<translation type="unfinished">C標準</translation>
<translation>&amp;C標準</translation>
</message>
<message>
<location filename="mainwindow.ui" line="167"/>
@ -519,7 +520,7 @@ Parameters: -l(line) (file)
<location filename="mainwindow.ui" line="253"/>
<source>Analyze files</source>
<oldsource>Check files</oldsource>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="256"/>
@ -536,7 +537,7 @@ Parameters: -l(line) (file)
<location filename="mainwindow.ui" line="271"/>
<source>Analyze directory</source>
<oldsource>Check directory</oldsource>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="274"/>
@ -567,7 +568,7 @@ Parameters: -l(line) (file)
<location filename="mainwindow.ui" line="310"/>
<source>Stop analysis</source>
<oldsource>Stop checking</oldsource>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="313"/>
@ -646,17 +647,17 @@ Parameters: -l(line) (file)
<message>
<location filename="mainwindow.ui" line="592"/>
<source>Show Cppcheck results</source>
<translation type="unfinished"></translation>
<translation>Cppcheck結果を表示する</translation>
</message>
<message>
<location filename="mainwindow.ui" line="604"/>
<source>Clang</source>
<translation type="unfinished"></translation>
<translation>Clang</translation>
</message>
<message>
<location filename="mainwindow.ui" line="607"/>
<source>Show Clang results</source>
<translation type="unfinished"></translation>
<translation>Clangの結果を表示する</translation>
</message>
<message>
<location filename="mainwindow.ui" line="615"/>
@ -802,7 +803,8 @@ Parameters: -l(line) (file)
<message>
<location filename="mainwindow.ui" line="131"/>
<source>A&amp;nalyze</source>
<translation type="unfinished"></translation>
<translation>A&amp;
A&amp;</translation>
</message>
<message>
<location filename="mainwindow.ui" line="217"/>
@ -813,22 +815,22 @@ Parameters: -l(line) (file)
<location filename="mainwindow.ui" line="283"/>
<source>&amp;Reanalyze modified files</source>
<oldsource>&amp;Recheck modified files</oldsource>
<translation type="unfinished">(&amp;R) </translation>
<translation>(&amp;R)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="295"/>
<source>Reanal&amp;yze all files</source>
<translation type="unfinished"></translation>
<translation>(&amp;y)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="360"/>
<source>Style war&amp;nings</source>
<translation type="unfinished"></translation>
<translation>(&amp;n)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="378"/>
<source>E&amp;rrors</source>
<translation type="unfinished"></translation>
<translation>(&amp;E)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="394"/>
@ -898,7 +900,7 @@ Parameters: -l(line) (file)
<message>
<location filename="mainwindow.ui" line="465"/>
<source>Sh&amp;ow Scratchpad...</source>
<translation type="unfinished"></translation>
<translation>(&amp;o)...</translation>
</message>
<message>
<location filename="mainwindow.ui" line="470"/>
@ -918,82 +920,82 @@ Parameters: -l(line) (file)
<message>
<location filename="mainwindow.ui" line="515"/>
<source>&amp;Warnings</source>
<translation type="unfinished"></translation>
<translation>(&amp;W)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="533"/>
<source>Per&amp;formance warnings</source>
<translation type="unfinished"></translation>
<translation>(&amp;f)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="559"/>
<source>&amp;Information</source>
<translation type="unfinished"></translation>
<translation>(&amp;I)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="574"/>
<source>&amp;Portability</source>
<translation type="unfinished"></translation>
<translation>(&amp;P)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="674"/>
<source>P&amp;latforms</source>
<translation type="unfinished"></translation>
<translation>(&amp;l)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="688"/>
<source>C++&amp;11</source>
<translation type="unfinished"></translation>
<translation>C++11(&amp;1)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="699"/>
<source>C&amp;99</source>
<translation type="unfinished"></translation>
<translation>C99(&amp;9)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="707"/>
<source>&amp;Posix</source>
<translation type="unfinished"></translation>
<translation>Posix(&amp;P)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="715"/>
<source>C&amp;11</source>
<translation type="unfinished"></translation>
<translation>C11(&amp;1)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="723"/>
<source>&amp;C89</source>
<translation type="unfinished"></translation>
<translation>C89(&amp;C)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="731"/>
<source>&amp;C++03</source>
<translation type="unfinished"></translation>
<translation>C++03(&amp;C)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="752"/>
<source>&amp;Library Editor...</source>
<translation type="unfinished"></translation>
<translation>(&amp;L)...</translation>
</message>
<message>
<location filename="mainwindow.ui" line="763"/>
<source>&amp;Auto-detect language</source>
<translation type="unfinished"></translation>
<translation>(&amp;A)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="771"/>
<source>&amp;Enforce C++</source>
<translation type="unfinished"></translation>
<translation>C++ (&amp;E)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="779"/>
<source>E&amp;nforce C</source>
<translation type="unfinished"></translation>
<translation>C (&amp;n)</translation>
</message>
<message>
<location filename="mainwindow.ui" line="790"/>
<source>C++14</source>
<translation type="unfinished">C++14</translation>
<translation>C++14</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="322"/>
@ -1020,7 +1022,7 @@ This is probably because the settings were changed between the Cppcheck versions
<message>
<location filename="mainwindow.cpp" line="572"/>
<source>C/C++ Source, Compile database, Visual Studio (%1 %2 *.sln *.vcxproj)</source>
<translation type="unfinished"></translation>
<translation>C/C++Visual Studioソリューション(%1 %2 *.sln *.vcxproj)</translation>
</message>
<message>
<source>Select directory to check</source>
@ -1042,7 +1044,7 @@ This is probably because the settings were changed between the Cppcheck versions
<message>
<location filename="mainwindow.cpp" line="621"/>
<source>Select configuration</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="651"/>
@ -1106,12 +1108,12 @@ Do you want to proceed checking without using any of these project files?</sourc
<message>
<location filename="mainwindow.cpp" line="791"/>
<source>Unknown element</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="794"/>
<source>Unknown issue</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="799"/>
@ -1131,7 +1133,7 @@ Do you want to proceed checking without using any of these project files?</sourc
<message>
<location filename="mainwindow.cpp" line="895"/>
<source>Failed to load %1. Your Cppcheck installation is broken. You can use --data-dir=&lt;directory&gt; at the command line to specify where this file is located. Please note that --data-dir is supposed to be used by installation scripts and therefore the GUI does not start when it is used, all that happens is that the setting is configured.</source>
<translation type="unfinished"></translation>
<translation>%1 Cppcheck --data-dir=&lt;directory&gt; --data-dir GUI版ではサポートされていません調</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1077"/>
@ -1224,56 +1226,60 @@ Do you want to stop the checking and exit Cppcheck?</source>
<message>
<location filename="mainwindow.cpp" line="491"/>
<source>No suitable files found to analyze!</source>
<translation type="unfinished"></translation>
<translation>!</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="570"/>
<source>Select files to analyze</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="584"/>
<source>Select directory to analyze</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="621"/>
<source>Select the configuration that will be analyzed</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="673"/>
<source>Found project files from the directory.
Do you want to proceed analysis without using any of these project files?</source>
<translation type="unfinished"></translation>
<translation>
使?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1187"/>
<source>Analyzer is running.
Do you want to stop the analysis and exit Cppcheck?</source>
<translation type="unfinished"></translation>
<translation>
Cppcheckを終了しますか?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1253"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation type="unfinished"></translation>
<translation>XML (*.xml);; (*.txt);;CSVファイル (*.csv)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1450"/>
<source>Build dir &apos;%1&apos; does not exist, create it?</source>
<translation type="unfinished"></translation>
<translation>&apos;%1&apos;?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1467"/>
<source>Failed to import &apos;%1&apos;, analysis is stopped</source>
<translation type="unfinished"></translation>
<translation>&apos;%1&apos;()</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1500"/>
<source>Project files (*.cppcheck)</source>
<translation type="unfinished"></translation>
<translation> (*.cppcheck)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1502"/>
@ -1325,7 +1331,7 @@ Options:
-d &lt;directory&gt; Specify the directory that was checked to generate the results xml specified with -l
-v, --version Show program version
--data-dir=&lt;directory&gt; Specify directory where GUI datafiles are located (translations, cfg)</oldsource>
<translation type="unfinished">Cppcheck GUI.
<translation>Cppcheck GUI.
:
cppcheck-gui [OPTIONS] [files paths]
@ -1336,7 +1342,7 @@ Options:
-l &lt;file&gt; XMLファイルを開く
-d &lt;directory&gt; -l XMLファイルを生成する
-v, --version
--data-dir=&lt;directory&gt; GUI (cfg)</translation>
--data-dir=&lt;directory&gt; GUI (cfg)</translation>
</message>
<message>
<location filename="main.cpp" line="120"/>
@ -1353,7 +1359,7 @@ Options:
<message>
<location filename="platforms.cpp" line="37"/>
<source>Native</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="platforms.cpp" line="38"/>
@ -1411,12 +1417,12 @@ Options:
<message>
<location filename="projectfiledialog.ui" line="24"/>
<source>Paths and Defines</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="30"/>
<source>Import Project (Visual studio / compile database)</source>
<translation type="unfinished"></translation>
<translation>(Visual studio / compile database)</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="163"/>
@ -1441,17 +1447,17 @@ Options:
<location filename="projectfiledialog.ui" line="60"/>
<location filename="projectfiledialog.ui" line="312"/>
<source>...</source>
<translation type="unfinished"></translation>
<translation>...</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="69"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;You have a choice:&lt;/p&gt;&lt;p&gt; * Analyze all Debug and Release configurations&lt;/p&gt;&lt;p&gt; * Only analyze the first matching Debug configuration&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;:&lt;/p&gt;&lt;p&gt; * Debug Release&lt;/p&gt;&lt;p&gt; * Debug &lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="72"/>
<source>Analyze all Visual Studio configurations</source>
<translation type="unfinished"></translation>
<translation>Visual Studioの全ての設定をチェックする</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="86"/>
@ -1484,7 +1490,7 @@ Options:
<message>
<location filename="projectfiledialog.ui" line="176"/>
<source>Include Paths:</source>
<translation type="unfinished"></translation>
<translation>:</translation>
</message>
<message>
<source>Includes</source>
@ -1507,22 +1513,22 @@ Options:
<message>
<location filename="projectfiledialog.ui" line="279"/>
<source>Root path:</source>
<translation type="unfinished"></translation>
<translation>:</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="291"/>
<source>Warning tags (separated by semicolon)</source>
<translation type="unfinished"></translation>
<translation>()</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="303"/>
<source>Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc)</source>
<translation type="unfinished"></translation>
<translation>Cppcheck (, , )</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="322"/>
<source>Libraries</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="358"/>
@ -1547,47 +1553,47 @@ Options:
<message>
<location filename="projectfiledialog.ui" line="465"/>
<source>Addons</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="471"/>
<source>Y2038</source>
<translation type="unfinished"></translation>
<translation>Y2038</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="478"/>
<source>Thread safety</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="485"/>
<source>Coding standards</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="492"/>
<source>Cert</source>
<translation type="unfinished"></translation>
<translation>CERT</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="513"/>
<source>Extra Tools</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="519"/>
<source>It is common best practice to use several tools.</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="526"/>
<source>Clang analyzer</source>
<translation type="unfinished"></translation>
<translation>Clang Analyzer</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="533"/>
<source>Clang-tidy</source>
<translation type="unfinished"></translation>
<translation>Clang-tidy</translation>
</message>
<message>
<location filename="projectfiledialog.ui" line="153"/>
@ -1605,12 +1611,12 @@ Options:
<message>
<location filename="projectfiledialog.cpp" line="247"/>
<source>Select Cppcheck build dir</source>
<translation type="unfinished"></translation>
<translation>Cppcheckビルドディレクトリ</translation>
</message>
<message>
<location filename="projectfiledialog.cpp" line="283"/>
<source>Visual Studio (*.sln *.vcxproj);;Compile database (compile_commands.json)</source>
<translation type="unfinished"></translation>
<translation>Visual Studio (*.sln *.vcxproj);; (compile_commands.json)</translation>
</message>
<message>
<location filename="projectfiledialog.cpp" line="497"/>
@ -1625,12 +1631,12 @@ Options:
<message>
<location filename="projectfiledialog.cpp" line="172"/>
<source>Clang-tidy (not found)</source>
<translation type="unfinished"></translation>
<translation>Clang-tidy ()</translation>
</message>
<message>
<location filename="projectfiledialog.cpp" line="281"/>
<source>Import Project</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="projectfiledialog.cpp" line="517"/>
@ -1691,12 +1697,12 @@ Options:
<message>
<location filename="cppchecklibrarydata.cpp" line="33"/>
<source>line %1: Unhandled element %2</source>
<translation type="unfinished"></translation>
<translation> %1: 扱われていない要素(Unhandled element) %2</translation>
</message>
<message>
<location filename="projectfiledialog.cpp" line="144"/>
<source> (Not found)</source>
<translation type="unfinished"></translation>
<translation>()</translation>
</message>
</context>
<context>
@ -1762,12 +1768,12 @@ Options:
<message>
<location filename="resultstree.cpp" line="245"/>
<source>note</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultstree.cpp" line="608"/>
<source>Recheck</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultstree.cpp" line="609"/>
@ -1787,7 +1793,7 @@ Options:
<message>
<location filename="resultstree.cpp" line="612"/>
<source>Copy message id</source>
<translation type="unfinished"></translation>
<translation>idをコピー</translation>
</message>
<message>
<location filename="resultstree.cpp" line="613"/>
@ -1802,7 +1808,7 @@ Options:
<message>
<location filename="resultstree.cpp" line="615"/>
<source>Suppress selected id(s)</source>
<translation type="unfinished"></translation>
<translation>idを抑制</translation>
</message>
<message>
<location filename="resultstree.cpp" line="616"/>
@ -1813,12 +1819,12 @@ Options:
<location filename="resultstree.cpp" line="656"/>
<location filename="resultstree.cpp" line="1341"/>
<source>Tag</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultstree.cpp" line="658"/>
<source>No tag</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultstree.cpp" line="701"/>
@ -1832,7 +1838,9 @@ Options:
Configure the editor application for Cppcheck in preferences/Applications.</source>
<oldsource>Configure the text file viewer program in Cppcheck preferences/Applications.</oldsource>
<translation type="unfinished"></translation>
<translation>
Cppcheckの</translation>
</message>
<message>
<location filename="resultstree.cpp" line="716"/>
@ -1875,7 +1883,7 @@ Please select the directory where file is located.</source>
<message>
<location filename="resultstree.cpp" line="1341"/>
<source>Id</source>
<translation type="unfinished">ID</translation>
<translation>Id</translation>
</message>
<message>
<location filename="resultstree.cpp" line="1341"/>
@ -1885,7 +1893,7 @@ Please select the directory where file is located.</source>
<message>
<location filename="resultstree.cpp" line="1341"/>
<source>Since date</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultstree.cpp" line="290"/>
@ -1928,12 +1936,12 @@ Please select the directory where file is located.</source>
<message>
<location filename="resultsview.ui" line="82"/>
<source>Analysis Log</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultsview.ui" line="104"/>
<source>Warning Details</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultsview.cpp" line="156"/>
@ -1988,7 +1996,7 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="resultsview.cpp" line="329"/>
<source>XML format version 1 is no longer supported.</source>
<translation type="unfinished"></translation>
<translation>XML 1 </translation>
</message>
<message>
<location filename="resultsview.cpp" line="388"/>
@ -2003,27 +2011,27 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="resultsview.cpp" line="393"/>
<source>First included by</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultsview.cpp" line="396"/>
<source>Id</source>
<translation type="unfinished">ID</translation>
<translation>ID</translation>
</message>
<message>
<location filename="resultsview.cpp" line="443"/>
<source>Clear Log</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultsview.cpp" line="444"/>
<source>Copy this Log entry</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="resultsview.cpp" line="445"/>
<source>Copy complete Log</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@ -2031,7 +2039,7 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="scratchpad.ui" line="14"/>
<source>Scratchpad</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="scratchpad.ui" line="48"/>
@ -2079,7 +2087,7 @@ To toggle what kind of errors are shown, open view menu.</source>
<location filename="settings.ui" line="114"/>
<source>Force checking all #ifdef configurations</source>
<oldsource>Check all #ifdef configurations</oldsource>
<translation type="unfinished"> #ifdef </translation>
<translation> #ifdef </translation>
</message>
<message>
<location filename="settings.ui" line="121"/>
@ -2109,7 +2117,7 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="settings.ui" line="156"/>
<source>Show statistics on check completion</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="settings.ui" line="176"/>
@ -2119,38 +2127,38 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="settings.ui" line="287"/>
<source>Addons</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="settings.ui" line="293"/>
<source>Python binary (leave this empty to use python in the PATH)</source>
<translation type="unfinished"></translation>
<translation>Pythonインタプリタの場所(PATHから検索)</translation>
</message>
<message>
<location filename="settings.ui" line="302"/>
<location filename="settings.ui" line="345"/>
<source>...</source>
<translation type="unfinished"></translation>
<translation>...</translation>
</message>
<message>
<location filename="settings.ui" line="326"/>
<source>Clang</source>
<translation type="unfinished"></translation>
<translation>Clang</translation>
</message>
<message>
<location filename="settings.ui" line="332"/>
<source>Clang path (leave empty to use system PATH)</source>
<translation type="unfinished"></translation>
<translation>Clangの場所(PATHから検索)</translation>
</message>
<message>
<location filename="settings.ui" line="355"/>
<source>Visual Studio headers</source>
<translation type="unfinished"></translation>
<translation>Visual Studioのヘッダ</translation>
</message>
<message>
<location filename="settings.ui" line="361"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Paths to Visual Studio headers, separated by semicolon &apos;;&apos;.&lt;/p&gt;&lt;p&gt;You can open a Visual Studio command prompt, write &amp;quot;SET INCLUDE&amp;quot;. Then copy/paste the paths.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Visual Studioのヘッダーファイル(&apos;;&apos;)&lt;/p&gt;&lt;p&gt;Visual Studio &amp;quot;SET INCLUDE&amp;quot;. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>Paths</source>
@ -2229,7 +2237,7 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="settingsdialog.cpp" line="224"/>
<source> [Default]</source>
<translation type="unfinished"></translation>
<translation>[]</translation>
</message>
<message>
<location filename="settingsdialog.cpp" line="249"/>
@ -2239,12 +2247,12 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="settingsdialog.cpp" line="304"/>
<source>Select python binary</source>
<translation type="unfinished"></translation>
<translation>pythonの場所の選択</translation>
</message>
<message>
<location filename="settingsdialog.cpp" line="312"/>
<source>Select clang path</source>
<translation type="unfinished"></translation>
<translation>clangのパスの選択</translation>
</message>
<message>
<source>Select include directory</source>
@ -2341,12 +2349,12 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="stats.ui" line="343"/>
<source>History</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="stats.ui" line="349"/>
<source>File:</source>
<translation type="unfinished"></translation>
<translation>:</translation>
</message>
<message>
<location filename="stats.ui" line="387"/>
@ -2356,7 +2364,7 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="stats.ui" line="394"/>
<source>Pdf Export</source>
<translation type="unfinished"></translation>
<translation>PDF </translation>
</message>
<message>
<location filename="statsdialog.cpp" line="111"/>
@ -2411,7 +2419,7 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="statsdialog.cpp" line="150"/>
<source>Export PDF</source>
<translation type="unfinished"></translation>
<translation>PDF </translation>
</message>
<message>
<location filename="statsdialog.cpp" line="172"/>
@ -2426,12 +2434,12 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="statsdialog.cpp" line="175"/>
<source>Include paths</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="statsdialog.cpp" line="176"/>
<source>Defines</source>
<translation type="unfinished"></translation>
<translation>(define)</translation>
</message>
<message>
<location filename="statsdialog.cpp" line="178"/>
@ -2457,18 +2465,18 @@ To toggle what kind of errors are shown, open view menu.</source>
<message>
<location filename="statsdialog.cpp" line="64"/>
<source>File: </source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="statsdialog.cpp" line="64"/>
<source>No cppcheck build dir</source>
<translation type="unfinished"></translation>
<translation>cppcheckビルドディレクトリがありません</translation>
</message>
<message>
<location filename="statsdialog.cpp" line="139"/>
<location filename="statsdialog.cpp" line="183"/>
<source>Warnings</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="statsdialog.cpp" line="141"/>

View File

@ -2,9 +2,9 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<book>
<bookinfo>
<title>Cppcheck 1.73 dev</title>
<title>Cppcheck 1.82</title>
<date>2015-09-09</date>
<date>2018-01-21</date>
</bookinfo>
<chapter>
@ -30,11 +30,79 @@
<para>Cppcheckに限界があることをご理解ください。Cppcheckの報告しているエラーに稀に間違いのあることがあります。また、Cppcheck が検出しないバグが残っていることもあります。</para>
<para>ソフトウェアを注意深くテストすれば、Cppcheckを使うより、より多くのバグを検出することができるでしょう。ソフトウェアを注意深く実装すれば、Cppcheckを使うより、より多くのバグを検出することができるでしょう。しかし、あなたのソフトウェアを実装するときやテストするときに見逃したバグのいくつかを Cppcheckが検出できるでしょう。</para>
<para>ソフトウェアを注意深くテストすれば、Cppcheckを使うより、より多くのバグを検出できるでしょう。ソフトウェアを注意深く実装すれば、Cppcheckを使うより、より多くのバグを検出できるでしょう。しかし、あなたのソフトウェアを実装するときやテストするときに見逃したバグのいくつかを Cppcheckが検出できるでしょう。</para>
</chapter>
<chapter>
<title>はじめ方</title>
<title>GUIでのはじめ方</title>
<para>GUIの起動</para>
<section>
<title>新しいプロジェクト(New Project)</title>
<para>新しプロジェクトのファイルの作成は必要ではありませんが、最初のステップに最適です。ファイル(<literal>File</literal>)と新しいプロジェクトファイル(<literal>New project file</literal>)を通じて学べます。</para>
</section>
<section>
<title>新しいプロジェクトNew Project - パスPathsと定義Defines</title>
<para>あなたのプロジェクトはどのようなプロジェクトでしょうか。あなたのプロジェクトがVisual Studioのプロジェクトの場合、または(cmake/qbs/等の)コンパイルデータベースqが精製できる場合、あなたはプロジェクトをインポートimportできます。</para>
<para>そうではない場合には、そのプロジェクトのパスと定義をマニュアルで調整します。次の図は、Visual Studio のプロジェクトファイルをインポートした場合のスクリーンショットです。</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/gui-newproject-pathsanddefines.png"/>
</imageobject>
</mediaobject>
</section>
<section>
<title>新しいプロジェクトNew Project - プロジェクトProject</title>
<para>プロジェクトタブ(Project tab)では、ビルドディレクトリ(<literal>Cppcheck build dir</literal>)を設定しましょう。これはCppcheckが様々な分析する情報を保管するために使用します。プログラム全体の解析、インクリメンタル解析、統計などです。それぞれのプロジェクトは、それぞれのビルドディレクトリを持ちます。次のスクリーンショットはビルドディレクトリを<literal>cppcheck-build-dir</literal>と設定しています。このパスはプロジェクトファイルからの相対パスです。</para>
<para>あなたは、あなた使用する全てのライブラリーを選択すべきです。次のスクリーンショットではmicrosoft_sal と windowsライブラリーを選択しています。ライブラリーについてはこのマニュアルを参照してして下さい。</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/gui-newproject-project.png"/>
</imageobject>
</mediaobject>
</section>
<section>
<title>新しいプロジェクトNew Project - アドオンAddons</title>
<para>ここでは 除外タブ(<literal>Exclude</literal>)と抑制タブ(<literal>Suppressions</literal>)をスキップします。これは結果をあとで微調整するために使います。</para>
<para>アドオンタブ(Addons)であなたは別の分析を追加できます。このアドオンにはpythonが必要です。</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/gui-newproject-addons.png"/>
</imageobject>
</mediaobject>
</section>
<section>
<title>解析(Analyze)</title>
<para>ダイアログの<literal>OK</literal>ボタンをクリックします。解析がすぐに始まります。</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/gui-results.png"/>
</imageobject>
</mediaobject>
<para>全ての警告が有効になり、やや賑やかになります。あなたが注意しない様々な警告があり得ます。これは簡単に修正できます。メッセージを右クリックして、隠す(<literal>Hide</literal>)または抑制( <literal>Suppress</literal>を選びます。メッセージの隠しは永久ではありません。これは次の解析でまた表示されます。メッセージの抑制は、永久です。抑制されたidはプロジェクトファイルに保存されるので、これらは二度と表示されません。</para>
</section>
</chapter>
<chapter>
<title>コマンドラインでの始め方</title>
<section>
<title>最初のテスト</title>
@ -73,6 +141,20 @@ Checking path/file2.cpp...
2/2 files checked 100% done</programlisting>
</section>
<section>
<title>マニュアルでファイルをチェックまたはプロジェクトファイルの使用</title>
<para>Cppcheckでは、ファイルやパスを指定する事でファイルチェックを指定できます。一方ででプロジェクトファイル(cmake/visual studio)を使用できます。</para>
<para>プロジェクトファイルの使用は早急に始められます、というのもあなたが設定してする項目が少なくなるからです。</para>
<para>マニュアルでのファイルチェックは、解析をより細かく制御できます。</para>
<para>どちらのアプローチが良い結果になるかはわかりません。両方の方法を試して下さい。両方のアプローチを使用するとより多くののバグを見つけられる結果が得られるかもしれません。</para>
<para>以降の章でより詳細を説明します。</para>
</section>
<section>
<title>チェックからファイルやフォルダを除外する</title>
@ -85,16 +167,10 @@ Checking path/file2.cpp...
<para>第二の方法は、<parameter class="command">-i</parameter>オプションと共に除外したいファイルやフォルダを指定することです。次のコマンドでは<filename class="directory">src/c</filename>以下のファイルをチェックしません。</para>
<programlisting>cppcheck -isrc/c src</programlisting>
</section>
<section>
<title>インクルードパス指定</title>
<para>このオプションは現在<parameter class="command">--project</parameter>オプションと同時に使用できません。また、このオプションが有効なのは、インプットディレクトリが提供するされたときです。複数のディレクトリを無視するためには、<parameter class="command">-i</parameter>を複数回使用します。次のコマンドではsrc/b と src/c 以下のファイルをチェックしません。</para>
<para>インクルードパスを追加するには<parameter class="command">-I</parameter>オプションに続けてパスを指定します。</para>
<para>Cppcheckのプリプロセッサは基本的に他のプリプロセッサと同様にインクルードを扱います。しかし、その他のプリプロセッサはヘッダファイルが見つからない場合に停止するのとは違って、cppcheckはただ単に、メッセージ情報を表示してソースコードの解析を続けます。</para>
<para>cppcheckは常にソースコード全体を確認する必要がないので、このような仕様になっています。実際に、全てのインクルードパスを与えないことを推奨しています。もちろん、クラスのメンバーの実装を確認した上でクラスの宣言をCppcheckでチェックするのは有用ではありますが、標準ライブラリのヘッダーをCppcheckに確認させるのは有用ではありません。というのは、チェックにかかる時間が長くなり、あまりよくない結果が表示されるからです。そのような場合、.cfg ファイル (後述します)によってcppcheckに関数や型の実装の情報を提供する方がよいでしょう。</para>
<programlisting>cppcheck -isrc/b -isrc/c</programlisting>
</section>
<section>
@ -104,7 +180,7 @@ Checking path/file2.cpp...
<variablelist>
<varlistentry>
<term>error</term>
<term>error(エラー)</term>
<listitem>
<para>バグが検出されたときに使用します。</para>
@ -112,7 +188,7 @@ Checking path/file2.cpp...
</varlistentry>
<varlistentry>
<term>warning</term>
<term>warning(警告)</term>
<listitem>
<para>防衛的プログラミングでバグを避けるための提案です。</para>
@ -243,12 +319,65 @@ cppcheck --enable=all</programlisting>
</section>
</chapter>
<chapter>
<title>Project(プロジェクト)</title>
<para>CMakeやVisual Studioを使っているとき、あなたは<literal>--project</literal>を使ってプロジェクトを解析できます。</para>
<para>これでカンタンにチェックでき、結果も得られます。あなたに必要な設定項目はありません。しかしこれが最も良い結果を得る方法とは限りません。私たちは、このプロジェクトファイルを利用する方法と、<literal>--project</literal>を利用しない方法を試してよいオプションを選ぶようにお勧めします。</para>
<section>
<title>CMake</title>
<para>Cppcheckはコンパイルデータベースを理解します。あなたはこれをCMakeで生成できます。</para>
<para>例:</para>
<programlisting>$ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .</programlisting>
<para><literal>compile_commands.json</literal>ファイルが現在のディレクトリに生成されます。</para>
<para>それからCppcheckをこのように実行します。:</para>
<programlisting>$ cppcheck --project=compile_commands.json</programlisting>
</section>
<section>
<title>Visual Studio</title>
<para>あなたは個々にのプロジェクトファイル(*.vcxproj)でCppcheckを実行できますし、ソルーション全体(*.sln)でも実行できます。</para>
<programlisting># run cppcheck on a whole solution
$ cppcheck --project=foobar.sln
# run cppcheck on a individual project
$ cppcheck --project=foobar.vcxproj</programlisting>
<para>Visual Studio内でcppcheckを実行するための、Visual Studioプラグインもあります。</para>
</section>
</chapter>
<chapter id="preprocessor-configurations">
<title>プリプロセッサの設定</title>
<para>Cppcheckはデフォルトでプリプロセッサのデファインのコンパイルスイッチ設定の組み合わせを全てチェックします。(ただし、これらのうち #error を除く)</para>
<para>あなたが <literal>--project</literal>を使用した場合、Cppcheckはプロジェクトファイルからプリプロセッサーの設定を読み取ります。</para>
<para>これを変更するには -D を使います。また -D を使用した場合、cppcheckは与えられたコンパイルスイッチだけが有効でその他は設定されていないとしてチェックします。これは、コンパイラのように動作します。また、 <literal>--force</literal> や <literal><literal>--max-configs</literal></literal> を使用すると、コンパイルスイッチの組み合わせの上限を上書きしてチェックすることができます。</para>
<para>そうでなければ、あなたはインクルードパスやディレクティブを設定したくなるでしょう。</para>
<section>
<title>ディレクティブ</title>
<para>ここに2つの設定があるファイルがあります(Aが定義された場合と定義されていない場合):</para>
<programlisting>#ifdef A
x = y;
#else
x = z;
#endif</programlisting>
<para>Cppcheckはデフォルトでプリプロセッサのデファインのコンパイルスイッチ設定の組み合わせを全てチェックします。(ただし、これらのうち #error を除く)そのため上のコードは、Aが定義された場合とAが定義されていない場合の両方を解析します。</para>
<para>これを変更するには -D を使います。また -D を使用した場合、cppcheckは与えられたコンパイルスイッチだけが有効でその他は設定されていないとしてチェックします。これは、コンパイラのように動作します。また、 <literal>--force</literal> や <literal>--max-configs</literal> を使用すると、コンパイルスイッチの組み合わせの上限を上書きしてチェックすることができます。</para>
<programlisting># 全てのコンパイルスイッチの組み合わせをチェックする。
cppcheck file.c
@ -264,20 +393,29 @@ cppcheck -DA --force file.c</programlisting>
<programlisting>cppcheck -UX file.c</programlisting>
<para>これはXが定義されていないことを意味します。Cppcheck は Xが定義されている組み合わせをチェックしません。</para>
</section>
<section>
<title>インクルードパス指定</title>
<para>インクルードパスを追加するには<parameter class="command">-I</parameter>オプションに続けてパスを指定します。</para>
<para>Cppcheckのプリプロセッサは基本的に他のプリプロセッサと同様にインクルードを扱います。しかし、その他のプリプロセッサはヘッダファイルが見つからない場合に停止するのとは違って、cppcheckはただ単に、メッセージ情報を表示してソースコードの解析を続けます。</para>
<para>cppcheckは常にソースコード全体を確認する必要がないので、このような仕様になっています。実際に、全てのインクルードパスを与えないことを推奨しています。もちろん、クラスのメンバーの実装を確認した上でクラスの宣言をCppcheckでチェックするのは有用ではありますが、標準ライブラリのヘッダーをCppcheckに確認させるのは有用ではありません。というのは、チェックにかかる時間が長くなり、あまりよくない結果が表示されるからです。そのような場合、.cfg ファイル (後述します)によってcppcheckに関数や型の実装の情報を提供する方がよいでしょう。</para>
</section>
</chapter>
<chapter>
<title>XML出力</title>
<para>Cppcheckは出力を<literal>XML</literal>形式に変更できます。XML出力には古い<literal>XML</literal> 形式(version 1) と新しい<literal>XML</literal> 形式(version 2)があります。可能であれば、新しい形式をご利用ください。</para>
<para>Cppcheckは出力を<literal>XML</literal>形式に変更できます。<parameter>--xml</parameter> オプションでフォーマットを指定します。</para>
<para>古い形式は後方互換性のためだけに残してあります。現在、変更の予定はありませんが、いつかは古い形式をサポートしなくなります。<parameter>--xml</parameter> オプションでフォーマットを指定します。</para>
<para>ファイルをチェックし、<literal>XML</literal>形式で出力するコマンドのサンプルです。:</para>
<para>新しい形式は古い形式にあったいくつかの問題を解消しています。新しい形式も、おそらくいつかは、新しい属性や要素を追加するなど変更されるかもしれません。Cppcheckでファイルをチェックし、新しい<literal>XML</literal>形式で出力するコマンドのサンプルです。:</para>
<programlisting>cppcheck --xml file1.cpp</programlisting>
<programlisting>cppcheck --xml-version=2 file1.cpp</programlisting>
<para>ここにバージョン2の出力の例を挙げます。:</para>
<para>これが出力例です。:</para>
<programlisting>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;results version=&quot;2&quot;&gt;
@ -285,7 +423,7 @@ cppcheck -DA --force file.c</programlisting>
&lt;errors&gt;
&lt;error id=&quot;someError&quot; severity=&quot;error&quot; msg=&quot;short error text&quot;
verbose=&quot;long error text&quot; inconclusive=&quot;true&quot; cwe=&quot;312&quot;&gt;
&lt;location file=&quot;file.c&quot; line=&quot;1&quot;/&gt;
&lt;location file0=&quot;file.c&quot; file=&quot;file.h&quot; line=&quot;1&quot;/&gt;
&lt;/error&gt;
&lt;/errors&gt;
&lt;/results&gt;</programlisting>
@ -362,6 +500,14 @@ cppcheck -DA --force file.c</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><sgmltag class="attribute">file0</sgmltag></term>
<listitem>
<para>ソースファイルの名前(オプション)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><sgmltag class="attribute">line</sgmltag></term>
@ -471,6 +617,57 @@ gui/test.cpp,16,error,mismatchAllocDealloc,Mismatching allocation and deallocati
<para>その他エスケープシーケンス \b (バックスペース), \n (改行), \r (改ページ) , \t (タブ) がサポートされています。</para>
</chapter>
<chapter>
<title>Misra</title>
<para>Cppcheckは<literal>MISRA</literal> C 2012 向けのチェッカのアドオンを持っています。</para>
<para><literal>MISRA</literal>ルールテキストの公開は禁止されています。そのため<literal>MISRA</literal>ルールテキストはこのアドオンから直接利用できません。その代わりにこのアドオンは<literal>Misra</literal> PDF ファイルまたはテキストファイルのどちらかからルールテキストを読み込めます。</para>
<section>
<title>要求事項</title>
<para>Cppcheck MISRA アドオンには次のものが必要です。:</para>
<itemizedlist>
<listitem>
<para>Python (2系 または 3系)</para>
</listitem>
<listitem>
<para><literal>MISRA</literal> PDF/Text ファイル(ルールテキスト)</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>MISRA PDF</title>
<para>もしあなたのコード<literal>MISRA</literal>規格に合致していることを望んでいるなら、あなたは<literal>MISRA</literal> PDFを持っているでしょう。</para>
<para>しかしながら、MISRA PDF が直接このアドオンから使用するには、<literal>xpdf</literal>パッケージを持っている場合に限ります。これはクロスプラットフォームのオープンソースパッケージです。</para>
</section>
<section>
<title>MISRA テキストファイル</title>
<para>もしあなたが<literal>xpdf</literal>を持っているなら、テキストファイルはコマンドラインから簡単に生成できます。 (<literal>pdftotext</literal> は<literal>xpdf</literal>に含まれています。):</para>
<programlisting>pdftotext misra-c-2012.pdf output.txt</programlisting>
<para>その他のpdfからtextに変換するソフトでもうまくいくでしょう。</para>
<para>テキストファイルをマニュアルで作成してするには、MISRA PDFの Appendix A &quot;Summary of guidelines&quot; をコピーペーストします。フォーマット:</para>
<programlisting>Appendix A Summary of guidelines
Rule 1.1
Rule text
Rule 1.2
Rule text
...</programlisting>
</section>
</chapter>
<chapter>
<title>出力の抑制</title>
@ -520,7 +717,7 @@ uninitvar</programlisting>
<section>
<title>インライン出力抑制</title>
<para>エラー出力の抑制をソースコー中に直接、コメントの形で記載することもできます。このコメントには特別なキーワードを含めて記載します。ただし、インライン出力を抑制するコメントをソースコードに追加すると、ソースコードの可読性が少し悪くなってしまうかもしれません。</para>
<para>エラー出力の抑制をソースコー中に直接、コメントの形で記載することもできます。このコメントには特別なキーワードを含めて記載します。ただし、インライン出力を抑制するコメントをソースコードに追加すると、ソースコードの可読性が少し悪くなってしまうかもしれません。</para>
<para>このソースコードは通常エラメッセージを出力する例です。:</para>
@ -553,15 +750,19 @@ Checking test.c...
<chapter>
<title>ライブラリ設定</title>
<para>windows, posix, gtk, qt,他の外部のライブラリを使用した場合、<literal>Cppcheck</literal>は外部の関数がどのようなものであるかがわかりません。<literal>Cppcheck</literal> はそのため、メモリリークやバッファオーバーフロー、ヌルポインタのデリファレンスの可能性といったさまざまな問題が検出できません。これを解決するには設定ファイル(.cfg file)を使用します。</para>
<para>WinAPI, POSIX, gtk, Qtなど他の外部のライブラリを使用した場合、<literal>Cppcheck</literal>は外部の関数がどのようなものであるかがわかりません。<literal>Cppcheck</literal> はそのため、メモリリークやバッファオーバーフロー、ヌルポインタのデリファレンスの可能性といったさまざまな問題が検出できません。これを解決するには設定ファイル(.cfg file)を使用します。</para>
<para>もしあなたが有名なライブラリの設定ファイルを作成したときには、私達のサイトにアップロードしてくれると非常に助かります。</para>
<para>Cppcheckはいくつかのライブラリ用の設定を持っています。これらは次のようにしてロードできます。cppcheckは C または C++言語用の標準ライブラリの設定 <literal>std.cfg</literal>はいつもロードします。ご注意ください。もしあなたが有名なライブラリの設定ファイルを作成した場合や更新した場合には、私達のサイトにアップロードしてくれると非常に助かります。</para>
<section>
<title>カスタム設定ファイル(.cfg file)の使用</title>
<para>あなたのプロジェクト専用の設定ファイルを作成し、使用することができます。そのためには、<literal>--check-library</literal> と<literal>--enable=information</literal> を使用して設定のためのヒントを入手します。</para>
<para>設定ファイルの編集に、<literal>Library Editor</literal>の使用をお勧めします、これは<literal>Cppcheck GUI</literal>に含まれています。これは<literal>View</literal>メニューで使用できます。すべての設定がこのマニュアルに載っていません。</para>
<para>この設定ファイル<literal>.cfg</literal>のフォーマットに質問がある場合、フォーラム(http://sourceforge.net/p/cppcheck/discussion/)で質問してください。</para>
<para>コマンドラインのcppcheck はカスタマイズした設定ファイル(.cfg files)を作業パスから読み込もうとします。作業パスはcppcheckを実行しているパスですでそこに設定ファイルがあると考えます。</para>
<para>GUIのcppcheckはプロジェクトのファイルパスから設定ファイルを読み込もうとします。カスタマイズした設定ファイル(.cfg file)は <literal>プロジェクトファイルの編集</literal> ダイアログで確認できます。このタイアログを表示させるには<literal>ファイル</literal> メニューから開いてください。</para>
@ -570,7 +771,7 @@ Checking test.c...
<section>
<title>メモリーリソースのリーク</title>
<para>Cppcheck はリークのチェックについての設定できます。</para>
<para>Cppcheck はリークのチェックが調整できます。言い換えれば、あなたはメモリーやリソースを割り当てる関数またはその割り当てを回収する関数を指定できます。</para>
<section>
<title>alloc と dealloc</title>
@ -582,12 +783,12 @@ Checking test.c...
HPEN pen = CreatePen(PS_SOLID, 1, RGB(255,0,0));
}</programlisting></para>
<para>このサンプルには、リーソースのリークがあります。<literal>CreatePen()</literal>はWindowsの関数でpenを作成します。しかし、Cppcheck はこの関数が返す値を解放しなければならないことがわかりません。そのためエラーメッセージは表示されません。:</para>
<para>上のコード例はリソースリークの欠陥があります。 - <literal>CreatePen()</literal> は WinAPI 関数でpenを作成します。しかし、Cppcheckは関数からの返り値が解放されていなければならないと仮定しません。そのためエラーメッセージは表示されません。:</para>
<programlisting># cppcheck pen1.c
Checking pen1.c...</programlisting>
<para>もし、windowsの設定ファイルを<literal>Cppcheck</literal>に提供すれば、この問題を指摘することができるようになります。:</para>
<para>もしあなたが設定ファイルを与えれば、<literal>Cppcheck</literal>はバグを検出します。:</para>
<programlisting># cppcheck --library=windows.cfg pen1.c
Checking pen1.c...
@ -602,6 +803,8 @@ Checking pen1.c...
&lt;dealloc&gt;DeleteObject&lt;/dealloc&gt;
&lt;/resource&gt;
&lt;/def&gt;</programlisting>
<para>このアロケート関数とデアロケート関数はグループにまとめられています。それぞれのグループは<literal>&lt;resource&gt;</literal> や <literal>&lt;memory&gt;</literal> タグ中で定義されており、その<literal>&lt;dealloc&gt;</literal>関数によって特定されます。これは、<literal>&lt;dealloc&gt;</literal>タグでオーバーラップしたグループはマージされます。</para>
</section>
<section>
@ -617,14 +820,13 @@ Checking pen1.c...
<para>もし設定ファイルがなく、Cppcheckが<literal>dostuff</literal>の仕様を把握していなければ、Cppcheckは<literal>dostuff</literal>がメモリーについて配慮しており、メモリーリークは発生しないと仮定します。</para>
<para><literal>dostuff</literal>がメモリーについて配慮せず、解放などを行なっていないことを指定するためには、<literal>leak-ignore</literal>を使用します。:</para>
<para><literal>dostuff</literal>がメモリーについて配慮せず、解放などを行なっていないことを指定するためには、<literal>leak-ignore</literal>を<literal>&lt;function&gt;</literal> タグ中で使います。:</para>
<programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;function name=&quot;dostuff&quot;&gt;
&lt;leak-ignore/&gt;
&lt;arg nr=&quot;1&quot;/&gt;
&lt;arg nr=&quot;2&quot;/&gt;
&lt;/function&gt;
&lt;/def&gt;</programlisting>
@ -633,18 +835,62 @@ Checking pen1.c...
<programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;memory&gt;
&lt;alloc&gt;malloc&lt;/alloc&gt;
&lt;dealloc&gt;free&lt;/dealloc&gt;
&lt;use&gt;dostuff&lt;/use&gt;
&lt;/memory&gt;
&lt;/def&gt;</programlisting>
<para>なお、この<literal><literal>&lt;use&gt;</literal></literal>設定には論理的には全く無意味です。この設定がない場合でも同じエラーが表示されます。これは<literal>--check-library</literal>のinformationメッセージを減らすために使用します。</para>
<para>なお、この<literal>&lt;use&gt;</literal>の設定は論理的に全く無意味です。この設定がない場合でも同じエラーが表示されます。これは<literal>--check-library</literal>のinformationメッセージを減らすために使用します。</para>
</section>
</section>
<section>
<title>関数引数: 未初期化メモリ</title>
<title>関数の動作</title>
<para>関数の動作や関数の使用方法を指定するのに、<literal>&lt;function&gt;</literal>タグが使えます。関数は、その名前によって特定されます。この名前は、<literal>name</literal> 属性とその引数によって指定されます。この名前はコンマで区切られた関数名のリストです。名前空間やクラス中の関数の場合には、完全修飾名で指定されます。例: <literal>&lt;function name=&quot;memcpy,std::memcpy&quot;&gt;</literal>もしテンプレート関数がある場合、インスタンス化した名前を提供してします。<literal>&lt;function name=&quot;dostuff&lt;int&gt;&quot;&gt;</literal>.</para>
<section>
<title>関数引き数</title>
<para>関数がとる引数は、<literal>&lt;arg&gt;</literal>タグで指定できます。引数のそれぞれは、引数の順番1始まりを<literal>nr</literal>属性で示します。<literal>nr=&quot;any&quot;</literal> は任意の引き数を表します。また、<literal>nr=&quot;variadic&quot;</literal>は可変長引数を表します。オプション引数は、デフォルト値で指定します。: <literal>default=&quot;value&quot;</literal>. それぞれの引数に対する設定は、全ての引数に対する指定を上書きします。</para>
<section>
<title>非ブール</title>
<para>ここで誤った比較のあるサンプルプログラムがあります。:</para>
<programlisting>void test()
{
if (MemCmp(buffer1, buffer2, 1024==0)) {}
}</programlisting>
<para><literal>Cppcheck</literal>は、この関数にブール値を渡してよいと仮定します。:</para>
<programlisting># cppcheck notbool.c
Checking notbool.c...</programlisting>
<para>もしあなたが設定ファイルを与えれば、Cppcheckはバグを検出します。:</para>
<programlisting># cppcheck --library=notbool.cfg notbool.c
Checking notbool.c...
[notbool.c:5]: (error) Invalid MemCmp() argument nr 3. 非ブール値が求められています。</programlisting>
<para>ここで最小のnotbool.cfgを用意しました。</para>
<para><programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;function name=&quot;MemCmp&quot;&gt;
&lt;arg nr=&quot;1&quot;/&gt;
&lt;arg nr=&quot;2&quot;/&gt;
&lt;arg nr=&quot;3&quot;&gt;
&lt;not-bool/&gt;
&lt;/arg&gt;
&lt;/function&gt;
&lt;/def&gt;</programlisting></para>
</section>
<section>
<title>未初期化メモリ</title>
<para>ここにサンプルのプログラムがあります。:</para>
@ -660,12 +906,14 @@ Checking pen1.c...
<programlisting># cppcheck uninit.c
Checking uninit.c...</programlisting>
<para>もし、windowsの設定ファイルをCppcheckに提供すれば、この問題を指摘することができるようになります。:</para>
<para>もしあなたが設定ファイルを与えれば、Cppcheckはバグを検出します。:</para>
<programlisting># cppcheck --library=windows.cfg uninit.c
Checking uninit.c...
[uninit.c:5]: (error) Uninitialized variable: buffer2</programlisting>
<para>注意:これは、ポインタが示すメモリ領域が初期化されていなければならないことを意味しています。</para>
<para>これが最小限の<literal>windows.cfg</literal>ファイルです。:</para>
<para><programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
@ -681,7 +929,7 @@ Checking uninit.c...
</section>
<section>
<title>関数引数: ヌルポインタ</title>
<title>ヌルポインタ</title>
<para>Cppcheckは、関数にヌルポインタを渡してもよいと仮定しています。ここにサンプルのプログラムがあります。:</para>
@ -695,12 +943,14 @@ Checking uninit.c...
<programlisting># cppcheck null.c
Checking null.c...</programlisting>
<para>もし、windowsの設定ファイルを<literal>Cppcheck</literal>に提供すれば、この問題を指摘することができるようになります。:</para>
<para>もしあなたが設定ファイルを与えれば、<literal>Cppcheck</literal>はバグを検出します。:</para>
<programlisting>cppcheck --library=windows.cfg null.c
Checking null.c...
[null.c:3]: (error) Null pointer dereference</programlisting>
<para>注意:<literal>&lt;not-uninit&gt;</literal>は値について意味しています。初期化されていないメモリが関数に渡されています。</para>
<para>これが最小限の<literal>windows.cfg</literal> ファイルです:</para>
<programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
@ -716,7 +966,7 @@ Checking null.c...
</section>
<section>
<title>関数引数: フォーマット文字列</title>
<title>フォーマット文字列</title>
<para>フォーマット文字列を扱う関数を定義できます。例:</para>
@ -740,7 +990,7 @@ Checking formatstring.c...</programlisting>
&lt;formatstr/&gt;
&lt;/arg&gt;
&lt;/function&gt;
&lt;/def&gt;</programlisting>これで、Cppcheckはエラーを報告することができるようになりました。:</para>
&lt;/def&gt;</programlisting>これで、Cppcheckはエラーを報告できるようになりました。:</para>
<programlisting>cppcheck --library=test.cfg formatstring.c
Checking formatstring.c...
@ -760,7 +1010,7 @@ Checking formatstring.c...
</section>
<section>
<title>関数引数: 値の範囲</title>
<title>値の範囲</title>
<para>有効な値の範囲が定義できます。想像してください。:</para>
@ -783,11 +1033,11 @@ Checking valuerange.c...</programlisting>
&lt;valid&gt;0:1023&lt;/valid&gt;
&lt;/arg&gt;
&lt;/function&gt;
&lt;/def&gt;</programlisting>これで、Cppcheckはエラーを報告することができるようになりました。:</para>
&lt;/def&gt;</programlisting>これで、Cppcheckはエラーを報告できるようになりました。:</para>
<programlisting>cppcheck --library=test.cfg range.c
Checking range.c...
[range.c:3]: (error) Invalid do_something() argument nr 1. The value is 1024 but the valid values are '0-1023'.</programlisting>
[range.c:3]: (error) Invalid do_something() argument nr 1. この値は1024ですが、妥当な値は0から1023までです。</programlisting>
<para>validの要素で次のような表現が利用できます。:</para>
@ -799,7 +1049,7 @@ Checking range.c...
</section>
<section>
<title>関数引数: 最小サイズ</title>
<title>最小サイズ</title>
<para>いくつかの関数はバッファーを引数にとります。バッファの最小サイズを指定することができます。(要素数ではなくバイト数です。)想像してください。:</para>
@ -824,7 +1074,7 @@ Checking minsize.c...</programlisting>
&lt;/arg&gt;
&lt;arg nr=&quot;2&quot;/&gt;
&lt;/function&gt;
&lt;/def&gt;</programlisting>これで、Cppcheckはこのエラーを報告することができるようになりました。:</para>
&lt;/def&gt;</programlisting>これで、Cppcheckはこのエラーを報告できるようになりました。:</para>
<programlisting>cppcheck --library=1.cfg minsize.c
Checking minsize.c...
@ -854,7 +1104,7 @@ Checking minsize.c...
<term>sizeof</term>
<listitem>
<para>バッファーのサイズがその他の引数のバッファーのサイズより大きくなればなりません。例: std.cfg のstrcnpyの設定を参照してください</para>
<para>バッファーのサイズがその他の引数のバッファーのサイズより大きくなればなりません。例posix.cfgのmemccpyの設定をみてください。</para>
</listitem>
</varlistentry>
@ -868,6 +1118,22 @@ Checking minsize.c...
</variablelist>
</section>
<section>
<title>strz</title>
<para>この設定は、Cppcheckで現在使用できません。しかし、これであなたは引数が0終端文字列でなければならないということができます。</para>
<para><programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;function name=&quot;do_something&quot;&gt;
&lt;arg nr=&quot;1&quot;&gt;
&lt;strz/&gt;
&lt;/arg&gt;
&lt;/function&gt;
&lt;/def&gt;</programlisting></para>
</section>
</section>
<section>
<title>noreturn</title>
@ -907,6 +1173,8 @@ Checking noreturn.c...
&lt;def&gt;
&lt;function name=&quot;ZeroMemory&quot;&gt;
&lt;noreturn&gt;false&lt;/noreturn&gt;
&lt;arg nr=&quot;1&quot;/&gt;
&lt;arg nr=&quot;2&quot;/&gt;
&lt;/function&gt;
&lt;/def&gt;</programlisting>
</section>
@ -931,7 +1199,7 @@ Checking useretval.c...</programlisting>
<programlisting># cppcheck --library=lib.cfg --enable=warning useretval.c
Checking useretval.c...
[noreturn.c:3]: (warning) Return value of function strcmp() is not used.</programlisting>
[useretval.c:3]: (warning) Return value of function strcmp() is not used.</programlisting>
<para>これが最小限の<literal>lib.cfg</literal> ファイルです。:</para>
@ -939,73 +1207,53 @@ Checking useretval.c...
&lt;def&gt;
&lt;function name=&quot;strcmp&quot;&gt;
&lt;use-retval/&gt;
&lt;arg nr=&quot;1&quot;/&gt;
&lt;arg nr=&quot;2&quot;/&gt;
&lt;/function&gt;
&lt;/def&gt;</programlisting>
</section>
<section>
<title>define</title>
<title>pure関数(pure)とconst関数</title>
<para>ライブラリはマクロプリプロセッサのdefineを使用することができます。例:</para>
<para>これらは、GCC関数属性のpureとconstに対応します。</para>
<programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;define name=&quot;NULL_VALUE&quot; value=&quot;0&quot;/&gt;
&lt;/def&gt;</programlisting>
<para>pure関数は、値を返す以外の効果を持ちません。そしてその返り値はその関数の引数とグローバル変数によってのみ決まります。</para>
<para>プリプロセッサの段階でソースコード中に &quot;NULL_VALUE&quot; が現れるごとに、&quot;0&quot;で置き換えます。</para>
</section>
<para>const関数は、値を返す以外の効果を持ちません。そしてその返り値はその関数の引数によってのみ決まります。</para>
<section>
<title>podtype</title>
<para>ここにサンプルのプログラムがあります。:</para>
<para>多くのソースコードで、プラットフォームに依存しない型をtypedefによって定義しています。&quot;podtype&quot;のタグによって、cppcheckがこれらのサポートするために必要な情報を提供できます。このような情報のない場合、cppcheckは次の例でみるような &quot;uint16_t&quot; 型を理解できません。</para>
<programlisting>void f(int x)
{
if (calculate(x) == 213) {
<programlisting>void test() {
uint16_t a;
} else if (calculate(x) == 213) {
// 到達不能コード
}
}</programlisting>
<para>そのため、未使用変数である、'a'が未使用であるとのメッセージが表示されません。</para>
<para>もし<literal>calculate()</literal> がconst関数であれば、<literal>calculate(x)</literal>は両方の条件で同じ値を返します。というのも、同じパラメータを引数にしているからです。</para>
<programlisting># cppcheck --enable=style unusedvar.cpp
Checking unusedvar.cpp...</programlisting>
<para>Cppcheck は通常、その結果が異なると仮定するため、Cppcheckはこのコード例に警告を出しません。:</para>
<para>もし uint16_t が以下のように定義されていた場合、結果にメッセージが反映されます。</para>
<programlisting># cppcheck const.c
Checking const.c...</programlisting>
<para>もし適切な<literal>const.cfg</literal> が提供されていましたら、このバグは検出されます。:</para>
<programlisting># cppcheck --enable=style --library=const const.c
Checking const.c...
[const.c:7]: (style) Expression is always false because 'else if' condition matches previous condition at line 5.</programlisting>
<para>これが最小限の<literal>const.cfg</literal> ファイルです。:</para>
<programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;podtype name=&quot;uint16_t&quot; sign=&quot;u&quot; size=&quot;2&quot;/&gt;
&lt;/def&gt;</programlisting>
<para>型のサイズはバイトサイズで指定します。符号の &quot;sign&quot; 属性は 符号ありの &quot;s&quot; か 符号無し &quot;u&quot; のどちらかです。これらの属性はオプションです。このライブラリを使用しますと、cppcheckはメッセージを表示できるようになります。</para>
<programlisting># cppcheck --library=lib.cfg --enable=style unusedvar.cpp
Checking unusedvar.cpp...
[unusedvar.cpp:2]: (style) Unused variable: a</programlisting>
</section>
<section>
<title>container</title>
<para>C++ ライブラリの多くや STL 自身は、非常によく似た機能性をもつコンテナを提供する。ライブラリによってその動作をcppcheckに伝えることができる。それぞれのコンテナの設定にはユニークなIDが必要とします。コンテナの設定には、startPatternを加えることができます(オプション)。この startPatternはToken::Match パターンとendPattern に有効でなけばなりません。また、このendPatternはリンクしているトークンと比較されるものです。オブション属性の&quot;inherits&quot;は事前に定義されたコンテナのIDをとります。</para>
<para>&lt;container&gt;タグの内部で、&lt;size&gt;、&lt;access&gt;、&lt;other&gt;を選択して使用して関数を定義できます。これらのタグはそれぞれ、&quot;resize&quot; やその結果を与えるような動作を指定することができます。その例 &quot;end-iterator&quot;を示します。</para>
<para>次の例は、std::vectorの為の定義を示しています。std::vectorは&quot;stdContainer&quot;の定義に基づいていますが、ここには表示していません。:</para>
<programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;container id=&quot;stdVector&quot; startPattern=&quot;std :: vector &amp;lt;&quot; inherits=&quot;stdContainer&quot;&gt;
&lt;size&gt;
&lt;function name=&quot;push_back&quot; action=&quot;push&quot;/&gt;
&lt;function name=&quot;pop_back&quot; action=&quot;pop&quot;/&gt;
&lt;/size&gt;
&lt;access indexOperator=&quot;array-like&quot;&gt;
&lt;function name=&quot;at&quot; yields=&quot;at_index&quot;/&gt;
&lt;function name=&quot;front&quot; yields=&quot;item&quot;/&gt;
&lt;function name=&quot;back&quot; yields=&quot;item&quot;/&gt;
&lt;/access&gt;
&lt;/container&gt;
&lt;function name=&quot;calculate&quot;&gt;
&lt;const/&gt;
&lt;arg nr=&quot;1&quot;/&gt;
&lt;/function&gt;
&lt;/def&gt;</programlisting>
</section>
@ -1035,11 +1283,72 @@ Checking unusedvar.cpp...
<para>この関数は第二引数にポインタを取ります。このポインタはヌルポインタであってはなりません。また、このポインタは初期化されたデータを指していなければなりません。<literal>&lt;not-null&gt;</literal> と <literal>&lt;not-uninit&gt;</literal> は正しく使用されています。さらにいえば、このポインタは0終端文字列(zero-terminated string)でなければなりません。そのため&lt;strz&gt;が使用されています。</para>
</section>
</section>
<section>
<title>全ての引数に対する指定</title>
<title>define</title>
<para>引数の数に <literal>-1</literal>を指定すると、チェック時にその関数の全ての引数に適用されます。それぞれの引数に対する設定は、全ての引数に対する指定を上書きします。</para>
<para>ライブラリはマクロプリプロセッサのdefineを使用することができます。例:</para>
<programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;define name=&quot;NULL_VALUE&quot; value=&quot;0&quot;/&gt;
&lt;/def&gt;</programlisting>
<para>プリプロセッサの段階でソースコード中に &quot;NULL_VALUE&quot; が現れるごとに、&quot;0&quot;で置き換えます。</para>
</section>
<section>
<title>podtype</title>
<para>多くのソースコードで、プラットフォームに依存しない型をtypedefによって定義しています。&quot;podtype&quot;のタグによって、cppcheckがこれらをサポートするために必要な情報を提供できます。このような情報のない場合、cppcheckは次の例でみるような &quot;uint16_t&quot; 型を理解できません。</para>
<programlisting>void test() {
uint16_t a;
}</programlisting>
<para>そのため、未使用変数である、'a'が未使用であるとのメッセージが表示されません。</para>
<programlisting># cppcheck --enable=style unusedvar.cpp
Checking unusedvar.cpp...</programlisting>
<para>もし uint16_t が以下のように定義されていた場合、結果にメッセージが反映されます。</para>
<programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;podtype name=&quot;uint16_t&quot; sign=&quot;u&quot; size=&quot;2&quot;/&gt;
&lt;/def&gt;</programlisting>
<para>型のサイズはバイトサイズで指定します。符号の &quot;sign&quot; 属性は 符号ありの &quot;s&quot; か 符号無し &quot;u&quot; のどちらかです。これらの属性はオプションです。このライブラリを使用しますと、cppcheckはメッセージを表示できるようになります。</para>
<programlisting># cppcheck --library=lib.cfg --enable=style unusedvar.cpp
Checking unusedvar.cpp...
[unusedvar.cpp:2]: (style) Unused variable: a</programlisting>
</section>
<section>
<title>コンテナ(container)</title>
<para>C++ ライブラリの多くや STL 自身は、非常によく似た機能性をもつコンテナを提供します。ライブラリによってその動作をcppcheckに伝えられます。それぞれのコンテナの設定にはユニークなIDが必要とします。コンテナの設定には、startPatternを加えることができます(オプション)。この startPatternはToken::Match パターンとendPattern に有効でなけばなりません。また、このendPatternはリンクしているトークンと比較されるものです。オブション属性の&quot;inherits&quot;は事前に定義されたコンテナのIDをとります。</para>
<para>&lt;container&gt;タグの内部で、&lt;size&gt;、&lt;access&gt;、&lt;other&gt;を選択して使用して関数を定義できます。これらのタグはそれぞれ、&quot;resize&quot; やその結果を与えるような動作を指定することができます。その例 &quot;end-iterator&quot;を示します。</para>
<para>次の例は、std::vectorの為の定義を示しています。std::vectorは&quot;stdContainer&quot;の定義に基づいていますが、ここには表示していません。:</para>
<programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;def&gt;
&lt;container id=&quot;stdVector&quot; startPattern=&quot;std :: vector &amp;lt;&quot; inherits=&quot;stdContainer&quot;&gt;
&lt;size&gt;
&lt;function name=&quot;push_back&quot; action=&quot;push&quot;/&gt;
&lt;function name=&quot;pop_back&quot; action=&quot;pop&quot;/&gt;
&lt;/size&gt;
&lt;access indexOperator=&quot;array-like&quot;&gt;
&lt;function name=&quot;at&quot; yields=&quot;at_index&quot;/&gt;
&lt;function name=&quot;front&quot; yields=&quot;item&quot;/&gt;
&lt;function name=&quot;back&quot; yields=&quot;item&quot;/&gt;
&lt;/access&gt;
&lt;/container&gt;
&lt;/def&gt;</programlisting>
</section>
</chapter>