diff --git a/Makefile b/Makefile index daed0997479..a9790c594e8 100644 --- a/Makefile +++ b/Makefile @@ -646,7 +646,7 @@ $(libcppdir)/platform.o: lib/platform.cpp externals/tinyxml2/tinyxml2.h lib/conf $(libcppdir)/preprocessor.o: lib/preprocessor.cpp externals/simplecpp/simplecpp.h lib/checkers.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/refthunk.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h $(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/preprocessor.cpp -$(libcppdir)/programmemory.o: lib/programmemory.cpp lib/astutils.h lib/calculate.h lib/checkers.h lib/config.h lib/errortypes.h lib/infer.h lib/library.h lib/mathlib.h lib/platform.h lib/programmemory.h lib/refthunk.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/valueptr.h lib/vfvalue.h +$(libcppdir)/programmemory.o: lib/programmemory.cpp lib/astutils.h lib/calculate.h lib/checkers.h lib/config.h lib/errortypes.h lib/infer.h lib/library.h lib/mathlib.h lib/platform.h lib/programmemory.h lib/refthunk.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/valueptr.h lib/vf_common.h lib/vfvalue.h $(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/programmemory.cpp $(libcppdir)/regex.o: lib/regex.cpp lib/config.h lib/regex.h diff --git a/gui/cppcheck_de.ts b/gui/cppcheck_de.ts index ee401f8c2a4..03a71c8cf8a 100644 --- a/gui/cppcheck_de.ts +++ b/gui/cppcheck_de.ts @@ -5,32 +5,27 @@ About - About Cppcheck Über Cppcheck - Version %1 Version %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - Ein Werkzeug zur statischen C/C++-Code-Analyse. - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. Copyright © 2007-%1 Cppcheck-Team. - This program is licensed under the terms of the GNU General Public License version 3 Dieses Programm ist unter den Bedingungen @@ -38,13 +33,11 @@ der GNU General Public License Version 3 lizenziert - Visit Cppcheck homepage at %1 Besuchen Sie die Cppcheck-Homepage unter %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> <html><head/><body><p>Vielen Dank den Bibliotheken die wir nutzen:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> @@ -54,13 +47,11 @@ der GNU General Public License Version 3 lizenziert ApplicationDialog - Add an application Anwendung hinzufügen - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -87,25 +78,21 @@ Parameter: -l(line) (file) - &Name: &Name: - &Executable: &Ausführbare Datei: - &Parameters: &Parameter: - Browse Suchen @@ -201,19 +188,16 @@ Parameter: -l(line) (file) HelpDialog - Cppcheck GUI help Cppcheck GUI Hilfe - Contents Inhalt - Index Index @@ -231,19 +215,16 @@ Parameter: -l(line) (file) LibraryAddFunctionDialog - Add function Funktion hinzufügen - Function name(s) Funktionsname(n) - Number of arguments Anzahl Argumente @@ -252,103 +233,86 @@ Parameter: -l(line) (file) LibraryDialog - Library Editor Bibliothekseditor - Open Öffnen - Save Speichern - Save as Speichern unter - Functions Funktionen - Sort Sortiere - Add Hinzufügen - Filter: Filter: - Comments Kommentare - noreturn Zurückkehrend - False Ja - True Nein - Unknown Unbekannt - return value must be used Rückgabewert muss genutzt werden - ignore function in leaks checking Ignoriere Funktion in Speicherleck-Prüfung - Arguments Argumente - Edit Bearbeiten @@ -392,13 +356,11 @@ Parameter: -l(line) (file) LibraryEditArgDialog - Edit argument Argument bearbeiten - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -414,13 +376,11 @@ Parameter: -l(line) (file) - Not bool Nicht boolsch - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -436,99 +396,78 @@ Parameter: -l(line) (file) - Not null Nicht Null - Not uninit Nicht uninitialisiert - String String - Format string Formatstring - Min size of buffer Minimale Puffergröße - - Type Typ - - None Keine - - argvalue Argumentwert - - mul Multiplikation - - strlen strlen - - Arg Argument 1 - - Arg2 Argument 2 - and und - Valid values Zulässige Werte @@ -541,171 +480,140 @@ Parameter: -l(line) (file) - Standard Standard - &File &Datei - &View &Ansicht - &Toolbars &Symbolleisten - A&nalyze A&nalysieren - C++ standard C++-Standard - &C standard &C-Standard - &Edit &Bearbeiten - &License... &Lizenz... - A&uthors... &Autoren... - &About... Ü&ber... - &Files... &Dateien... - - Analyze files Analysiere Dateien - Ctrl+F Strg+F - &Directory... &Verzeichnis... - - Analyze directory Analysiere Verzeichnis - Ctrl+D Strg+D - Ctrl+R Strg+R - &Stop &Stoppen - - Stop analysis Analyse abbrechen - Esc Esc - &Save results to file... &Ergebnisse in Datei speichern... - Ctrl+S Strg+S - &Quit &Beenden - &Clear results Ergebnisse &löschen - &Preferences &Einstellungen - - Show errors Zeige Fehler @@ -713,8 +621,6 @@ Parameter: -l(line) (file) - - Show warnings Zeige Warnungen @@ -722,14 +628,11 @@ Parameter: -l(line) (file) - - Show performance warnings Zeige Performance-Warnungen - Show &hidden Zeige &versteckte @@ -741,411 +644,342 @@ Parameter: -l(line) (file) - Show information messages Zeige Informationsmeldungen - Show portability warnings Zeige Portabilitätswarnungen - Show Cppcheck results Zeige Cppcheck-Ergebnisse - Clang Clang - Show Clang results Zeige Clang-Ergebnisse - &Filter &Filter - Filter results Gefilterte Ergebnisse - Windows 32-bit ANSI Windows 32-bit, ANSI - Windows 32-bit Unicode Windows 32-bit, Unicode - Unix 32-bit Unix 32-bit - Unix 64-bit Unix 64-bit - Windows 64-bit Windows 64-bit - &Print... Drucken... - Print the Current Report Aktuellen Bericht ausdrucken - Print Pre&view... Druckvorschau - Open a Print Preview Dialog for the Current Results Druckvorschaudialog für aktuelle Ergebnisse öffnen - Open library editor Bibliothekseditor öffnen - &Check all Alle &auswählen - Checking for updates - Hide Verstecken - - Report - Filter Filter - &Reanalyze modified files Veränderte Dateien neu analysieren - Reanal&yze all files Alle Dateien erneut anal&ysieren - Ctrl+Q - Style war&nings Stilwar&nungen - E&rrors F&ehler - &Uncheck all Alle a&bwählen - Collapse &all Alle &reduzieren - &Expand all Alle &erweitern - &Standard &Standard - Standard items Standardeinträge - Toolbar Symbolleiste - &Categories &Kategorien - Error categories Fehler-Kategorien - &Open XML... Öffne &XML... - Open P&roject File... Pr&ojektdatei öffnen... - Ctrl+Shift+O - Sh&ow Scratchpad... &Zeige Schmierzettel... - &New Project File... &Neue Projektdatei... - Ctrl+Shift+N - &Log View &Loganzeige - Log View Loganzeige - C&lose Project File Projektdatei &schließen - &Edit Project File... Projektdatei &bearbeiten... - &Statistics &Statistik - &Warnings &Warnungen - Per&formance warnings Per&formance-Warnungen - &Information &Information - &Portability &Portabilität - P&latforms P&lattformen - C++&11 C++&11 - C&99 C&99 - &Posix Posix - C&11 C&11 - &C89 &C89 - &C++03 &C++03 - &Library Editor... &Bibliothekseditor - &Auto-detect language Sprache &automatisch erkennen - &Enforce C++ C++ &erzwingen - E&nforce C C e&rzwingen - C++14 C++14 - Reanalyze and check library Neu analysieren und Bibliothek prüfen - Check configuration (defines, includes) Prüfe Konfiguration (Definitionen, Includes) - C++17 C++17 - C++20 C++20 - Compliance report... - Normal @@ -1163,63 +997,52 @@ Parameter: -l(line) (file) - Autosar - EULA... - Thread Details - Show thread details - &Contents &Inhalte - Categories Kategorien - - Show style warnings Zeige Stilwarnungen - Open the help contents Öffnet die Hilfe-Inhalte - F1 F1 - &Help &Hilfe @@ -1675,31 +1498,26 @@ Options: NewSuppressionDialog - New suppression Neue Fehlerunterdrückung - Error ID Fehler-ID - File name Dateiname - Line number Zeilennummer - Symbol name Symbolname @@ -1741,31 +1559,26 @@ Options: ProjectFile - Project File Projektdatei - Paths and Defines Pfade und Definitionen - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Importiere Projekt (Visual Studio / Compile-Datenbank / Borland C++-Builder 6) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Definitionen müssen mit einem Semikolon getrennt werden. Beispiel: DEF1;DEF2=5;DEF3=int - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. Hinweis: Legen Sie eigene .cfg-Dateien in den Ordner der Projektdatei. Dann sollten sie oben sichtbar werden. @@ -1775,59 +1588,48 @@ Options: - MISRA rule texts MISRA-Regeltexte - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> <html><head/><body><p>Text aus Anhang A &quot;Summary of guidelines&quot; aus der MISRA-C-2012-PDF in eine Textdatei einfügen.</p></body></html> - ... ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> <html><head/><body><p>Sie haben die Auswahl:</p><p> * Alle Debug- und Release-Konfigurationen analysieren</p><p> * Nur die erste passende Debug-Konfiguration analysieren</p><p><br/></p></body></html> - - Browse... Durchsuchen... - Analyze all Visual Studio configurations Alle Visual-Studio-Konfigurationen analysieren - Selected VS Configurations Ausgewählte VS-Konfiguration - Paths: Pfade: - - Add... Hinzufügen... @@ -1835,9 +1637,6 @@ Options: - - - Edit Bearbeiten @@ -1846,365 +1645,300 @@ Options: - - - - Remove Entfernen - Undefines: Un-Definitionen: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 Un-Definitionen müssen Semikolon-getrennt sein. Beispiel: UNDEF1;UNDEF2;UNDEF3 - Include Paths: Includepfade: - Up Auf - Down Ab - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Platform Plattform - - Analysis Analyse - This is a workfolder that Cppcheck will use for various purposes. - Clang (experimental) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) Prüfe Code in ungenutzten Templates (normalerweise AN, theoretisch können Warnungen in ungenutzten Templates gefahrlos ignoriert werden) - Max CTU depth Maximale CTU-Tiefe - Max recursion in template instantiation - Warning options Warnoptionen - Root path: Wurzelverzeichnis: - Filepaths in warnings will be relative to this path - Warning tags (separated by semicolon) Warnungs-Tags (Semikolon-getrennt) - Enable inline suppressions Inline-Fehlerunterdrückung aktivieren - 2025 - Misra C++ - 2008 - Cert C Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting - External tools Externe Werkzeuge - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) Cppcheck-Arbeitsverzeichnis (Vollständige Programmanalyse, inkrementelle Analyse, Statistiken, etc.) - Types and Functions - Libraries Bibliotheken - Parser - Cppcheck (built in) - Check that each class has a safe public interface - Limit analysis - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... - Suppressions Fehlerunterdrückungen - Add Hinzufügen - - Addons Add-Ons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 Y2038 - Thread safety Threadsicherheit - Coding standards Programmierstandards - Misra C Misra C - 2012 - - 2023 - Cert C++ Cert C++ - Bug hunting (Premium) @@ -2218,7 +1952,6 @@ Options: - Defines: Definitionen: @@ -2837,25 +2570,21 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde - Results Berichte - Critical errors Kritische Fehler - Analysis Log Analyseprotokoll - Warning Details Warnungs-Details @@ -2864,31 +2593,26 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde ScratchPad - Scratchpad Schmierzettel - Copy or write some C/C++ code here: Kopieren oder schreiben Sie C/C++-Code hierher: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": Optional einen Dateinamen (hauptsächlich für automatische Spracherkennung) eingeben und auf "Prüfe" klicken: - filename Dateiname - Check Prüfe @@ -2897,25 +2621,21 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde Settings - Preferences Einstellungen - General Allgemein - Add... Hinzufügen... - Number of threads: Anzahl der Threads: @@ -2925,67 +2645,56 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde - Force checking all #ifdef configurations Erzwinge Prüfung aller #ifdef-Konfigurationen - Show full path of files Vollständigen Dateipfad anzeigen - Show "No errors found" message when no errors found "Keine Fehler gefunden"-Meldung anzeigen, wenn keine Fehler gefunden werden - Display error Id in column "Id" Zeige Meldungs-Id in Spalte "Id" - Enable inline suppressions Inline-Fehlerunterdrückung aktivieren - Check for inconclusive errors also Auch nach unklaren Fehlern suchen - Show statistics on check completion Zeige Statistiken nach Prüfungsabschluss - Check for updates Auf Updates prüfen - Show internal warnings in log Interne Warnungen im Log anzeigen - Addons Add-Ons - Python binary (leave this empty to use python in the PATH) Python-Binärdatei (Python aus PATH wird genutzt, wenn leer) @@ -2993,143 +2702,117 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde - - - ... ... - MISRA addon MISRA-Addon - MISRA rule texts file MISRA-Regeltext-Datei - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> <html><head/><body><p>Text aus Anhang A &quot;Summary of guidelines&quot; aus der MISRA-C-2012-PDF in eine Textdatei einfügen.</p></body></html> - Clang Clang - Clang path (leave empty to use system PATH) Clang-Verzeichnis (PATH wird genutzt, wenn leer) - Visual Studio headers Visual-Studio-Header - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> <html><head/><body><p>Pfade zu Visual-Studio-Headern, Semikolon-getrennt.</p><p>Sie können eine Visual-Studio-Kommandozeile öffnen, &quot;SET INCLUDE&quot; eingeben und dann die Pfade hier reinkopieren.</p></body></html> - Code Editor Code-Editor - Code Editor Style Code-Editor-Stil - System Style Systemstil - Default Light Style Heller Standardstil - Default Dark Style Dunkler Standardstil - Custom Benutzerdefiniert - Remove Entfernen - Max count: Maximalzahl: - Applications Anwendungen - - Edit... Bearbeiten... - Set as default Als Standard festlegen - Reports Berichte - Save all errors when creating report Alle Fehler beim Erstellen von Berichten speichern - Save full path to files in reports Vollständigen Dateipfad in Berichten speichern - Language Sprache @@ -3186,8 +2869,6 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde - - Statistics @@ -3195,135 +2876,113 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde - Project Projekt - Project: Projekt: - Paths: Pfade: - Include paths: Include-Pfade: - Defines: Definitionen: - Undefines: Un-Definitionen: - Previous Scan Vorherige Prüfung - Path Selected: Ausgewählte Pfade: - Number of Files Scanned: Anzahl der geprüften Dateien: - Scan Duration: Prüfungsdauer: - Errors: Fehler: - Warnings: Warnungen: - Stylistic warnings: Stilwarnungen: - Portability warnings: Portabilitätswarnungen: - Performance issues: Performance-Probleme: - Information messages: Informationsmeldungen: - Active checkers: Aktive Checker: - Checkers Checker - History Verlauf - File: Datei: - Copy to Clipboard In die Zwischenablage kopieren - Pdf Export PDF-Export @@ -3473,7 +3132,6 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde ThreadDetails - Thread Details diff --git a/gui/cppcheck_es.ts b/gui/cppcheck_es.ts index b2080055651..4a1930f129d 100644 --- a/gui/cppcheck_es.ts +++ b/gui/cppcheck_es.ts @@ -5,45 +5,38 @@ About - About Cppcheck Acerca de Cppcheck - Version %1 Versión %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - Una utilidad para el análisis estático de código C/C++. - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. Copyright © 2007-2021 el equipo de cppcheck. - This program is licensed under the terms of the GNU General Public License version 3 Este programa está licenciado bajo los términos de GNU General Public License versión 3 - Visit Cppcheck homepage at %1 Visita el sitio de Cppcheck en %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> @@ -53,13 +46,11 @@ of the GNU General Public License version 3 ApplicationDialog - Add an application Añade una aplicación - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -75,25 +66,21 @@ Parameters: -l(line) (file) - &Name: &Nombre: - &Executable: &Ejecutable: - &Parameters: &Parámetros: - Browse Buscar @@ -138,19 +125,16 @@ Parameters: -l(line) (file) HelpDialog - Cppcheck GUI help - Contents - Index @@ -168,19 +152,16 @@ Parameters: -l(line) (file) LibraryAddFunctionDialog - Add function Añadir función - Function name(s) Nombre(s) de la función - Number of arguments Número de argumentos @@ -189,103 +170,86 @@ Parameters: -l(line) (file) LibraryDialog - Library Editor Editor de bibliotecas - Open Abrir - Save Guardar - Save as - Functions Funciones - Sort - Add Añadir - Filter: - Comments - noreturn - False Falso - True Verdadero - Unknown Desconocido - return value must be used - ignore function in leaks checking - Arguments Argumentos - Edit Editar @@ -331,13 +295,11 @@ Parameters: -l(line) (file) LibraryEditArgDialog - Edit argument Editar argumento - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -348,13 +310,11 @@ Parameters: -l(line) (file) - Not bool No bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -365,99 +325,78 @@ Parameters: -l(line) (file) - Not null No null - Not uninit No uninit - String String - Format string - Min size of buffer - - Type Tipo - - None Ninguno - - argvalue - - mul - - strlen - - Arg - - Arg2 - and - Valid values Valores válidos @@ -470,189 +409,155 @@ Parameters: -l(line) (file) - &File &Archivo - &View &Ver - &Toolbars &Herramientas - &Help &Ayuda - C++ standard C++ estándar - &C standard C standard C estándar - &Edit &Editar - Standard Estándar - Categories Categorías - &License... &Licencia... - A&uthors... A&utores... - &About... &Acerca de... - &Files... &Ficheros... - - Analyze files Check files Comprobar archivos - Ctrl+F Ctrl+F - &Directory... &Carpeta... - - Analyze directory Check directory Comprobar carpeta - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop &Detener - - Stop analysis Stop checking Detener comprobación - Esc Esc - &Save results to file... &Guardar los resultados en el fichero... - Ctrl+S Ctrl+S - &Quit &Salir - &Clear results &Limpiar resultados - &Preferences &Preferencias - - Show style warnings Mostrar advertencias de estilo - - Show errors Mostrar errores @@ -665,468 +570,389 @@ Parameters: -l(line) (file) - Show information messages Mostrar mensajes de información - Show portability warnings Mostrar advertencias de portabilidad - Show Cppcheck results - Clang - Show Clang results - &Filter &Filtro - Filter results Resultados del filtro - Windows 32-bit ANSI Windows 32-bit ANSI - Windows 32-bit Unicode Windows 32-bit Unicode - Unix 32-bit Unix 32-bit - Unix 64-bit Unix 64-bit - Windows 64-bit Windows 64-bit - &Print... Im&primir... - Print the Current Report Imprimir el informe actual - Print Pre&view... Pre&visualización de impresión... - Open a Print Preview Dialog for the Current Results Abre el diálogo de previsualización de impresión para el informe actual - Open library editor Abrir el editor de bibliotecas - &Check all &Seleccionar todo - Checking for updates - Hide Ocultar - - Report - A&nalyze - Filter Filtro - &Reanalyze modified files &Recheck modified files - Reanal&yze all files - Ctrl+Q - Style war&nings - E&rrors - &Uncheck all &Deseleccionar todo - Collapse &all Contraer &todo - &Expand all &Expandir todo - &Standard &Estándar - Standard items Elementos estándar - &Contents &Contenidos - Open the help contents Abrir la ayuda de contenidos - F1 F1 - Toolbar Barra de herramientas - &Categories &Categorías - Error categories Categorías de error - &Open XML... &Abrir XML... - Open P&roject File... Abrir P&royecto... - Ctrl+Shift+O - Sh&ow Scratchpad... - &New Project File... &Nuevo Proyecto... - Ctrl+Shift+N - &Log View &Visor del log - Log View Visor del log - C&lose Project File C&errar Proyecto - &Edit Project File... &Editar Proyecto... - &Statistics &Estadísticas - &Warnings - Per&formance warnings - &Information - &Portability - P&latforms - C++&11 - C&99 - &Posix - C&11 - &C89 - &C++03 - &Library Editor... - &Auto-detect language - &Enforce C++ - E&nforce C - C++14 C++14 - Reanalyze and check library - Check configuration (defines, includes) - C++17 C++17 - C++20 C++20 - Compliance report... - Normal - Autosar - EULA... - Thread Details - Show thread details - - Show warnings Mostrar advertencias @@ -1134,14 +960,11 @@ Parameters: -l(line) (file) - - Show performance warnings Mostrar advertencias de rendimiento - Show &hidden Mostrar &ocultos @@ -1570,31 +1393,26 @@ Options: NewSuppressionDialog - New suppression - Error ID - File name - Line number - Symbol name @@ -1636,135 +1454,111 @@ Options: ProjectFile - Project File Archivo de proyecto - Paths and Defines - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. Nota: Ponga sus propios archivos .cfg en la misma carpeta que el proyecto. Debería verlos arriba. - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... - Misra C - 2012 - - 2023 - MISRA rule texts - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> - - Browse... - Analyze all Visual Studio configurations - Selected VS Configurations - Paths: Rutas: - - Add... Añadir... @@ -1772,9 +1566,6 @@ Options: - - - Edit Editar @@ -1783,327 +1574,269 @@ Options: - - - - Remove Eliminar - Undefines: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 - Include Paths: - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Types and Functions - - Analysis - This is a workfolder that Cppcheck will use for various purposes. - Parser - Cppcheck (built in) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - Check that each class has a safe public interface - Limit analysis - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) - Max CTU depth - Enable inline suppressions Habilitar supresiones inline - 2025 - Misra C++ - 2008 - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting - External tools - Up Subir - Down Bajar - Platform - Clang (experimental) - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - Max recursion in template instantiation - Warning options - Root path: - Filepaths in warnings will be relative to this path - Warning tags (separated by semicolon) - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) - Libraries - Suppressions Supresiones - Add Añadir - - Addons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 - Thread safety - Coding standards - Cert C++ - Bug hunting (Premium) - Defines: Definiciones: @@ -2626,25 +2359,21 @@ Por favor comprueba que la ruta a la aplicación y los parámetros son correctos ResultsView - Results Resultados - Critical errors - Analysis Log - Warning Details @@ -2751,31 +2480,26 @@ Para cambiar el tipo de comportamiento, abra el menú Ver. ScratchPad - Scratchpad Scratchpad - Copy or write some C/C++ code here: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": - filename nombre de archivo - Check Comprobar @@ -2784,13 +2508,11 @@ Para cambiar el tipo de comportamiento, abra el menú Ver. Settings - Preferences Preferencias - General General @@ -2800,55 +2522,46 @@ Para cambiar el tipo de comportamiento, abra el menú Ver. - Force checking all #ifdef configurations Forzar comprobación de todas las configuraciones #ifdef - Display error Id in column "Id" Mostrar el Id del error en la columna "Id" - Enable inline suppressions Habilitar supresiones inline - Check for inconclusive errors also - Show statistics on check completion - Check for updates - Show internal warnings in log - Addons - Python binary (leave this empty to use python in the PATH) @@ -2856,167 +2569,137 @@ Para cambiar el tipo de comportamiento, abra el menú Ver. - - - ... - MISRA addon - MISRA rule texts file - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Clang - Clang path (leave empty to use system PATH) - Visual Studio headers - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> - Code Editor - Code Editor Style - System Style - Default Light Style - Default Dark Style - Custom - Add... Añadir... - Max count: - - Edit... Editar... - Set as default Definir por defecto - Language Idioma - Number of threads: Número de hilos: - Show full path of files Mostrar la ruta completa de los ficheros - Show "No errors found" message when no errors found Mostrar el mensaje "No se han encontrado errores" - Remove Eliminar - Applications Aplicaciones - Reports Informes - Save all errors when creating report Guardar todos los errores cuando se cree el informe - Save full path to files in reports Guardar la ruta completa en los ficheros de informes @@ -3073,8 +2756,6 @@ Para cambiar el tipo de comportamiento, abra el menú Ver. - - Statistics @@ -3082,135 +2763,113 @@ Para cambiar el tipo de comportamiento, abra el menú Ver. - Project Proyecto - Project: Proyecto: - Paths: Rutas: - Include paths: Incluye las rutas: - Defines: Definiciones: - Undefines: - Previous Scan Análisis anterior - Path Selected: Ruta seleccionada: - Number of Files Scanned: Número de archivos analizados: - Scan Duration: Duración del análisis: - Errors: Errores: - Warnings: Advertencias: - Stylistic warnings: Advertencias de estilo: - Portability warnings: Advertencias de portabilidad: - Performance issues: Problemas de rendimiento: - Information messages: Mensajes de información: - Active checkers: - Checkers - History - File: - Copy to Clipboard Copiar al portapapeles - Pdf Export @@ -3360,7 +3019,6 @@ Para cambiar el tipo de comportamiento, abra el menú Ver. ThreadDetails - Thread Details diff --git a/gui/cppcheck_fi.ts b/gui/cppcheck_fi.ts index 0600febbd04..1bae417cbde 100644 --- a/gui/cppcheck_fi.ts +++ b/gui/cppcheck_fi.ts @@ -5,32 +5,27 @@ About - About Cppcheck Tietoa ohjelmasta Cppcheck - Version %1 Versio %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - Työkalu C/C++ koodin staattiseen analysointiin. - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. Copyright (C) 2007-2021 Daniel Marjamäki ja cppcheck tiimi. - This program is licensed under the terms of the GNU General Public License version 3 Tämä ohjelma on lisensoitu GNU General @@ -38,13 +33,11 @@ Public lisenssin version 3 alaisuuteen - Visit Cppcheck homepage at %1 Cppcheckin kotisivu löytyy osoitteesta %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> @@ -54,13 +47,11 @@ Public lisenssin version 3 alaisuuteen ApplicationDialog - Add an application Lisää uusi ohjelma - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -76,25 +67,21 @@ Parameters: -l(line) (file) - &Name: - &Executable: - &Parameters: - Browse Selaa @@ -141,19 +128,16 @@ Parameters: -l(line) (file) HelpDialog - Cppcheck GUI help - Contents - Index @@ -171,19 +155,16 @@ Parameters: -l(line) (file) LibraryAddFunctionDialog - Add function - Function name(s) - Number of arguments @@ -192,103 +173,86 @@ Parameters: -l(line) (file) LibraryDialog - Library Editor - Open - Save - Save as - Functions - Sort - Add - Filter: - Comments - noreturn - False - True - Unknown - return value must be used - ignore function in leaks checking - Arguments - Edit @@ -334,13 +298,11 @@ Parameters: -l(line) (file) LibraryEditArgDialog - Edit argument - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -351,13 +313,11 @@ Parameters: -l(line) (file) - Not bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -368,99 +328,78 @@ Parameters: -l(line) (file) - Not null - Not uninit - String - Format string - Min size of buffer - - Type - - None - - argvalue - - mul - - strlen - - Arg - - Arg2 - and - Valid values @@ -473,175 +412,144 @@ Parameters: -l(line) (file) - A&nalyze - Standard Vakio - &File &Tiedosto - &View &Näytä - &Toolbars - C++ standard - &C standard C standard - &Edit &Muokkaa - &License... &Lisenssi... - A&uthors... &Tekijät... - &About... &Tietoa ohjelmasta Cppcheck... - &Files... &Tiedostot... - - Analyze files Check files - Ctrl+F Ctrl+F - &Directory... &Hakemisto... - - Analyze directory Check directory - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop &Pysäytä - - Stop analysis Stop checking - Esc Esc - &Save results to file... &Tallenna tulokset tiedostoon... - Ctrl+S Ctrl+S - &Quit &Lopeta - &Clear results &Tyhjennä tulokset - &Preferences &Asetukset - - Show errors @@ -649,8 +557,6 @@ Parameters: -l(line) (file) - - Show warnings @@ -658,14 +564,11 @@ Parameters: -l(line) (file) - - Show performance warnings - Show &hidden @@ -677,474 +580,394 @@ Parameters: -l(line) (file) - Show information messages - Show portability warnings - Show Cppcheck results - Clang - Show Clang results - &Filter - Filter results - Windows 32-bit ANSI - Windows 32-bit Unicode - Unix 32-bit - Unix 64-bit - Windows 64-bit - &Print... - Print the Current Report - Print Pre&view... - Open a Print Preview Dialog for the Current Results - Open library editor - &Check all &Valitse kaikki - Checking for updates - Hide - - Report - Filter - &Reanalyze modified files &Recheck modified files - Reanal&yze all files - Ctrl+Q - Style war&nings - E&rrors - &Uncheck all &Poista kaikista valinta - Collapse &all &Pienennä kaikki - &Expand all &Laajenna kaikki - &Standard - Standard items - Toolbar - &Categories - Error categories - &Open XML... - Open P&roject File... - Ctrl+Shift+O - Sh&ow Scratchpad... - &New Project File... - Ctrl+Shift+N - &Log View - Log View - C&lose Project File - &Edit Project File... - &Statistics - &Warnings - Per&formance warnings - &Information - &Portability - P&latforms - C++&11 - C&99 - &Posix - C&11 - &C89 - &C++03 - &Library Editor... - &Auto-detect language - &Enforce C++ - E&nforce C - C++14 - Reanalyze and check library - Check configuration (defines, includes) - C++17 - C++20 - Compliance report... - Normal - Autosar - EULA... - Thread Details - Show thread details - &Contents - Categories - - Show style warnings - Open the help contents - F1 - &Help &Ohje @@ -1564,31 +1387,26 @@ Options: NewSuppressionDialog - New suppression - Error ID - File name - Line number - Symbol name @@ -1610,91 +1428,75 @@ Options: ProjectFile - Project File - Paths and Defines - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. - MISRA rule texts - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> - - Browse... - Analyze all Visual Studio configurations - Selected VS Configurations - Paths: - - Add... @@ -1702,9 +1504,6 @@ Options: - - - Edit @@ -1713,371 +1512,305 @@ Options: - - - - Remove - Undefines: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 - Include Paths: - Up - Down - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Platform - - Analysis - This is a workfolder that Cppcheck will use for various purposes. - Clang (experimental) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) - Max CTU depth - Max recursion in template instantiation - Warning options - Root path: - Filepaths in warnings will be relative to this path - Warning tags (separated by semicolon) - Enable inline suppressions - 2025 - Misra C++ - 2008 - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting - External tools - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) - Types and Functions - Libraries - Parser - Cppcheck (built in) - Check that each class has a safe public interface - Limit analysis - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... - Suppressions - Add - - Addons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 - Thread safety - Coding standards - Misra C - 2012 - - 2023 - Cert C++ - Bug hunting (Premium) - Defines: @@ -2684,25 +2417,21 @@ Määrittääksesi minkä tyyppisiä virheitä näytetään, avaa näkymä valik - Results Tulokset - Critical errors - Analysis Log - Warning Details @@ -2711,31 +2440,26 @@ Määrittääksesi minkä tyyppisiä virheitä näytetään, avaa näkymä valik ScratchPad - Scratchpad - Copy or write some C/C++ code here: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": - filename - Check @@ -2744,92 +2468,77 @@ Määrittääksesi minkä tyyppisiä virheitä näytetään, avaa näkymä valik Settings - Preferences Asetukset - General Yleiset - Add... - Number of threads: Säikeiden lukumäärä: - Force checking all #ifdef configurations Check all #ifdef configurations Tarkista kaikki #ifdef kombinaatiot - Show full path of files Näytä tiedostojen täysi polku - Show "No errors found" message when no errors found Näytä "virheitä ei löytynyt"-viesti jos virheitä ei löydy - Display error Id in column "Id" - Enable inline suppressions - Check for inconclusive errors also - Show statistics on check completion - Check for updates - Show internal warnings in log - Addons - Python binary (leave this empty to use python in the PATH) @@ -2837,143 +2546,117 @@ Määrittääksesi minkä tyyppisiä virheitä näytetään, avaa näkymä valik - - - ... - MISRA addon - MISRA rule texts file - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Clang - Clang path (leave empty to use system PATH) - Visual Studio headers - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> - Code Editor - Code Editor Style - System Style - Default Light Style - Default Dark Style - Custom - Remove - Max count: - Applications Ohjelmat - - Edit... - Set as default - Reports Raportit - Save all errors when creating report Tallenna kaikki virheet raporttia luodessa - Save full path to files in reports Tallenna tiedostojen koko polku raportteihin - Language @@ -3026,8 +2709,6 @@ Määrittääksesi minkä tyyppisiä virheitä näytetään, avaa näkymä valik - - Statistics @@ -3035,135 +2716,113 @@ Määrittääksesi minkä tyyppisiä virheitä näytetään, avaa näkymä valik - Project - Project: - Paths: - Include paths: - Defines: - Undefines: - Previous Scan - Path Selected: - Number of Files Scanned: - Scan Duration: - Errors: - Warnings: - Stylistic warnings: - Portability warnings: - Performance issues: - Information messages: - Active checkers: - Checkers - History - File: - Copy to Clipboard - Pdf Export @@ -3313,7 +2972,6 @@ Määrittääksesi minkä tyyppisiä virheitä näytetään, avaa näkymä valik ThreadDetails - Thread Details diff --git a/gui/cppcheck_fr.ts b/gui/cppcheck_fr.ts index 7ac6f3ae89a..1b00ebc1594 100644 --- a/gui/cppcheck_fr.ts +++ b/gui/cppcheck_fr.ts @@ -5,25 +5,21 @@ About - About Cppcheck A propos - Version %1 Version %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - Un outil d'analyse statique de code C/C++. - This program is licensed under the terms of the GNU General Public License version 3 Ce programme est sous licence GNU @@ -31,20 +27,17 @@ General Public License version 3 - Visit Cppcheck homepage at %1 Visitez le site Cppcheck : %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. @@ -54,13 +47,11 @@ General Public License version 3 ApplicationDialog - Add an application Ajouter une application - Browse Parcourir @@ -76,19 +67,16 @@ General Public License version 3 - &Executable: &Exécutable : - &Parameters: &Paramètres : - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -114,7 +102,6 @@ Paramètres : -l(ligne) (fichier) - &Name: &Nom : @@ -141,19 +128,16 @@ Paramètres : -l(ligne) (fichier) HelpDialog - Cppcheck GUI help - Contents - Index @@ -167,19 +151,16 @@ Paramètres : -l(ligne) (fichier) LibraryAddFunctionDialog - Add function Ajouter une fonction - Function name(s) Nom(s) de la fonction - Number of arguments Nombre d'arguments @@ -188,79 +169,66 @@ Paramètres : -l(ligne) (fichier) LibraryDialog - Library Editor - Open - Save Sauvegarder - Functions - Add Ajouter - noreturn - False - True - Unknown - return value must be used - ignore function in leaks checking - Arguments - Edit Editer @@ -277,25 +245,21 @@ Paramètres : -l(ligne) (fichier) - Sort - Filter: - Comments - Save as @@ -324,13 +288,11 @@ Paramètres : -l(ligne) (fichier) LibraryEditArgDialog - Edit argument - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -341,13 +303,11 @@ Paramètres : -l(ligne) (fichier) - Not bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -358,99 +318,78 @@ Paramètres : -l(ligne) (fichier) - Not null - Not uninit - String - Format string - Min size of buffer - - Type - - None - - argvalue - - mul - - strlen - - Arg - - Arg2 - and - Valid values @@ -459,219 +398,182 @@ Paramètres : -l(ligne) (fichier) MainWindow - Checking for updates - Hide Cacher - &File &Fichier - &View &Affichage - - Report - &Help &Aide - &Edit &Édition - Standard Standard - &License... &Licence... - A&uthors... A&uteurs... - &About... À &Propos... - &Files... &Fichiers... - Ctrl+F - &Directory... &Répertoires... - Ctrl+D - Ctrl+R - &Stop &Arrêter - Esc - &Save results to file... &Sauvegarder les résultats dans un fichier... - Ctrl+S - &Quit &Quitter - &Clear results &Effacer les résultats - &Preferences &Préférences - &Check all &Tout cocher - &Uncheck all &Tout décocher - Collapse &all &Tout réduire - &Expand all &Tout dérouler - &Contents &Contenus - Open the help contents Ouvir l'aide - F1 - Compliance report... - Normal - Autosar - EULA... - Thread Details - Show thread details @@ -713,116 +615,95 @@ Paramètres : -l(ligne) (fichier) - &Toolbars &Boite à outils - Categories Catégories - - Show style warnings Afficher les avertissements de style - - Show errors Afficher les erreurs - &Standard - Standard items - Toolbar - &Categories - Error categories - &Open XML... &Ouvrir un fichier XML... - Open P&roject File... Ouvrir un P&rojet... - &New Project File... &Nouveau Projet... - &Log View &Journal - Log View Journal - C&lose Project File F&ermer le projet - &Edit Project File... &Editer le projet - &Statistics Statistiques - - Show warnings Afficher les avertissements @@ -830,14 +711,11 @@ Paramètres : -l(ligne) (fichier) - - Show performance warnings Afficher les avertissements de performance - Show &hidden @@ -849,13 +727,11 @@ Paramètres : -l(ligne) (fichier) - Show information messages Afficher les messages d'information - Show portability warnings Afficher les problèmes de portabilité @@ -995,13 +871,11 @@ This is probably because the settings were changed between the Cppcheck versions - &Filter &Filtre - Filter results @@ -1039,37 +913,31 @@ Do you want to remove the file from the recently used projects -list? - Filter Filtre - Windows 32-bit ANSI - Windows 32-bit Unicode - Unix 32-bit - Unix 64-bit - Windows 64-bit @@ -1080,7 +948,6 @@ Do you want to remove the file from the recently used projects -list? - C++ standard @@ -1143,31 +1010,26 @@ Do you want to remove the file from the recently used projects -list? - &Print... &Imprimer... - Print the Current Report Imprimer le rapport - Print Pre&view... Apercu d'impression... - Open a Print Preview Dialog for the Current Results - Open library editor @@ -1207,30 +1069,23 @@ Options: - - Analyze files - - Analyze directory - &Reanalyze modified files - - Stop analysis @@ -1317,169 +1172,141 @@ Do you want to stop the analysis and exit Cppcheck? - A&nalyze - &C standard - Reanal&yze all files - Ctrl+Q - Style war&nings - E&rrors - Ctrl+Shift+O - Sh&ow Scratchpad... - Ctrl+Shift+N - &Warnings - Per&formance warnings - &Information - &Portability - Show Cppcheck results - Clang - Show Clang results - P&latforms - C++&11 - C&99 - &Posix - C&11 - &C89 - &C++03 - &Library Editor... - &Auto-detect language - &Enforce C++ - E&nforce C - C++14 @@ -1490,25 +1317,21 @@ Do you want to stop the analysis and exit Cppcheck? - Reanalyze and check library - Check configuration (defines, includes) - C++17 - C++20 @@ -1535,31 +1358,26 @@ Do you want to proceed? NewSuppressionDialog - New suppression - Error ID - File name - Line number - Symbol name @@ -1581,27 +1399,22 @@ Do you want to proceed? ProjectFile - Project File Fichier Projet - Paths: Chemins : - Defines: - - Add... Ajouter... @@ -1609,9 +1422,6 @@ Do you want to proceed? - - - Edit Editer @@ -1620,433 +1430,356 @@ Do you want to proceed? - - - - Remove Supprimer - Up Monter - Down Descendre - Suppressions Suppressions - Add Ajouter - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. - ... - Include Paths: - Paths and Defines - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> - Analyze all Visual Studio configurations - Root path: - Warning tags (separated by semicolon) - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) - Selected VS Configurations - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Types and Functions - Libraries - Parser - Cppcheck (built in) - Check that each class has a safe public interface - Limit analysis - - Addons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 - Thread safety - Coding standards - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Bug hunting - - Browse... - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int - Platform - This is a workfolder that Cppcheck will use for various purposes. - Clang (experimental) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - Max recursion in template instantiation - Warning options - Filepaths in warnings will be relative to this path - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... - Enable inline suppressions - Misra C - 2012 - - 2023 - 2025 - MISRA rule texts - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Misra C++ - 2008 - Cert C++ - Safety profiles (defined in C++ core guidelines) - Bug hunting (Premium) - External tools - Import Project (Visual studio / compile database/ Borland C++ Builder 6) - Undefines: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 - - Analysis - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) - Max CTU depth @@ -2563,7 +2296,6 @@ Please select the default editor application in preferences/Applications.ResultsView - Results Résultats @@ -2648,19 +2380,16 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage. - Critical errors - Analysis Log - Warning Details @@ -2684,31 +2413,26 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage.ScratchPad - Scratchpad - filename - Check - Copy or write some C/C++ code here: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": @@ -2717,147 +2441,122 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage.Settings - Preferences Préférences - General Général - Number of threads: Nombre de fils : - Max count: - Show full path of files Montrer le chemin complet des fichiers - Show "No errors found" message when no errors found Afficher un message "Pas d'erreur trouvée" lorsque aucune erreur est trouvée - Check for updates - Applications Applications - Reports Rapports - Save all errors when creating report Sauvegarder toutes les erreurs lorsqu'un rapport est créé - Save full path to files in reports Sauvegarder le chemin complet des fichiers dans les rapports - Add... Ajouter... - Force checking all #ifdef configurations - Enable inline suppressions - Language Langue - Remove Supprimer - - Edit... Editer... - Set as default - Display error Id in column "Id" Afficher l'identifiant d'erreur Id dans la colonne "Id" - Check for inconclusive errors also - Show internal warnings in log Montrer les avertissements internes dans le journal - Show statistics on check completion - Addons - Python binary (leave this empty to use python in the PATH) @@ -2865,87 +2564,71 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage. - - - ... - Clang - Clang path (leave empty to use system PATH) - Visual Studio headers - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> - MISRA addon - MISRA rule texts file - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Code Editor - Code Editor Style - Default Light Style - Default Dark Style - Custom - System Style @@ -2998,8 +2681,6 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage. - - Statistics @@ -3007,111 +2688,93 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage. - Project Projet - Project: Projet : - Paths: Chemins : - Include paths: Inclure les chemins : - Defines: - Previous Scan Analyse précédente - Path Selected: Chemin sélectionné : - Number of Files Scanned: Nombre de fichiers analysés : - Scan Duration: Durée de l'analyse : - Errors: Erreurs : - Warnings: Avertissements - Stylistic warnings: Avertissements de style - Portability warnings: Avertissements de portabilité - Performance issues: Problème de performance - Information messages: Messages d'information : - Active checkers: - Checkers - Copy to Clipboard Copier vers le presse-papier @@ -3238,7 +2901,6 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage. - Pdf Export @@ -3249,13 +2911,11 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage. - History - File: @@ -3271,7 +2931,6 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage. - Undefines: @@ -3285,7 +2944,6 @@ Pour configurer les erreurs affichées, ouvrez le menu d'affichage.ThreadDetails - Thread Details diff --git a/gui/cppcheck_it.ts b/gui/cppcheck_it.ts index 4d0823a7053..3d28f005ee7 100644 --- a/gui/cppcheck_it.ts +++ b/gui/cppcheck_it.ts @@ -5,32 +5,27 @@ About - About Cppcheck Informazioni su Cppcheck - Version %1 Versione %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - Uno strumento per l'analisi statica di codice C/C++ - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. Copyright © 2007-2021 il team Cppcheck. - This program is licensed under the terms of the GNU General Public License version 3 Questo programma è rilasciato sotto i termini @@ -38,13 +33,11 @@ della GNU General Public License versione 3 - Visit Cppcheck homepage at %1 Visita la pagina iniziale di Cppcheck all'indirizzo: %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> @@ -54,13 +47,11 @@ della GNU General Public License versione 3 ApplicationDialog - Add an application Aggiungi un'applicazione - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -87,25 +78,21 @@ Parametri: -l(line) (file) - &Name: &Nome: - &Executable: &Eseguibile: - &Parameters: &Parametri: - Browse Esplora @@ -150,19 +137,16 @@ Parametri: -l(line) (file) HelpDialog - Cppcheck GUI help - Contents - Index @@ -180,19 +164,16 @@ Parametri: -l(line) (file) LibraryAddFunctionDialog - Add function - Function name(s) - Number of arguments @@ -201,103 +182,86 @@ Parametri: -l(line) (file) LibraryDialog - Library Editor - Open - Save - Save as - Functions - Sort - Add - Filter: - Comments - noreturn - False - True - Unknown - return value must be used - ignore function in leaks checking - Arguments - Edit Modifica @@ -343,13 +307,11 @@ Parametri: -l(line) (file) LibraryEditArgDialog - Edit argument - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -360,13 +322,11 @@ Parametri: -l(line) (file) - Not bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -377,99 +337,78 @@ Parametri: -l(line) (file) - Not null - Not uninit - String - Format string - Min size of buffer - - Type - - None - - argvalue - - mul - - strlen - - Arg - - Arg2 - and - Valid values @@ -482,175 +421,144 @@ Parametri: -l(line) (file) - A&nalyze - Standard Standard - &File &File - &View &Visualizza - &Toolbars &Barre degli strumenti - C++ standard - &C standard C standard - &Edit &Modifica - &License... &Licenza... - A&uthors... A&utori... - &About... I&nformazioni su... - &Files... &File... - - Analyze files Check files Scansiona i file - Ctrl+F Ctrl+F - &Directory... &Cartella... - - Analyze directory Check directory Scansiona la cartella - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop &Ferma - - Stop analysis Stop checking Ferma la scansione - Esc Esc - &Save results to file... &Salva i risultati nel file... - Ctrl+S Ctrl+S - &Quit &Esci - &Clear results &Cancella i risultati - &Preferences &Preferenze - - Show errors Mostra gli errori @@ -658,8 +566,6 @@ Parametri: -l(line) (file) - - Show warnings Mostra gli avvisi @@ -667,14 +573,11 @@ Parametri: -l(line) (file) - - Show performance warnings Mostra gli avvisi sulle prestazioni - Show &hidden Mostra &i nascosti @@ -686,474 +589,394 @@ Parametri: -l(line) (file) - Show information messages Mostra messaggi di informazione - Show portability warnings Mostra gli avvisi sulla portabilità - Show Cppcheck results - Clang - Show Clang results - &Filter &Filtro - Filter results Filtra i risultati - Windows 32-bit ANSI Windows 32-bit, ANSI - Windows 32-bit Unicode Windows 32-bit, Unicode - Unix 32-bit Unix 32-bit - Unix 64-bit Unix 64-bit - Windows 64-bit Windows 64-bit - &Print... - Print the Current Report - Print Pre&view... - Open a Print Preview Dialog for the Current Results - Open library editor - &Check all &Seleziona tutto - Checking for updates - Hide Nascondi - - Report - Filter Filtro - &Reanalyze modified files &Recheck modified files - Reanal&yze all files - Ctrl+Q - Style war&nings - E&rrors - &Uncheck all &Deseleziona tutto - Collapse &all Riduci &tutto - &Expand all &Espandi tutto - &Standard &Standard - Standard items Oggetti standard - Toolbar Barra degli strumenti - &Categories &Categorie - Error categories Categorie di errore - &Open XML... &Apri XML... - Open P&roject File... Apri file di p&rogetto... - Ctrl+Shift+O - Sh&ow Scratchpad... - &New Project File... &Nuovo file di progetto... - Ctrl+Shift+N - &Log View &Visualizza il rapporto - Log View Visualizza il rapporto - C&lose Project File C&hiudi il file di progetto - &Edit Project File... &Modifica il file di progetto... - &Statistics &Statistiche - &Warnings - Per&formance warnings - &Information - &Portability - P&latforms - C++&11 - C&99 - &Posix - C&11 - &C89 - &C++03 - &Library Editor... - &Auto-detect language - &Enforce C++ - E&nforce C - C++14 C++14 - Reanalyze and check library - Check configuration (defines, includes) - C++17 C++17 - C++20 C++20 - Compliance report... - Normal - Autosar - EULA... - Thread Details - Show thread details - &Contents &Contenuti - Categories Categorie - - Show style warnings Mostra gli avvisi sullo stile - Open the help contents Apri i contenuti di aiuto - F1 F1 - &Help &Aiuto @@ -1583,31 +1406,26 @@ Options: NewSuppressionDialog - New suppression - Error ID - File name - Line number - Symbol name @@ -1649,135 +1467,111 @@ Options: ProjectFile - Project File File di progetto - Paths and Defines - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... - Misra C - 2012 - - 2023 - MISRA rule texts - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> - - Browse... - Analyze all Visual Studio configurations - Selected VS Configurations - Paths: Percorsi: - - Add... Aggiungi... @@ -1785,9 +1579,6 @@ Options: - - - Edit Modifica @@ -1796,327 +1587,269 @@ Options: - - - - Remove Rimuovi - Undefines: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 - Include Paths: - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Types and Functions - - Analysis - This is a workfolder that Cppcheck will use for various purposes. - Parser - Cppcheck (built in) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - Check that each class has a safe public interface - Limit analysis - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) - Max CTU depth - Enable inline suppressions Abilita le soppressioni - 2025 - Misra C++ - 2008 - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting - External tools - Up Su - Down Giù - Platform - Clang (experimental) - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - Max recursion in template instantiation - Warning options - Root path: - Filepaths in warnings will be relative to this path - Warning tags (separated by semicolon) - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) - Libraries - Suppressions - Add - - Addons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 - Thread safety - Coding standards - Cert C++ - Bug hunting (Premium) - Defines: Definizioni: @@ -2736,25 +2469,21 @@ Per vedere il tipo di errori che sono mostrati, apri il menu Visualizza. - Results Risultati - Critical errors - Analysis Log - Warning Details @@ -2763,31 +2492,26 @@ Per vedere il tipo di errori che sono mostrati, apri il menu Visualizza.ScratchPad - Scratchpad Blocchetto per appunti - Copy or write some C/C++ code here: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": - filename Nome file - Check Scansiona @@ -2796,25 +2520,21 @@ Per vedere il tipo di errori che sono mostrati, apri il menu Visualizza.Settings - Preferences Preferenze - General Generale - Add... Aggiungi... - Number of threads: Numero di threads: @@ -2824,67 +2544,56 @@ Per vedere il tipo di errori che sono mostrati, apri il menu Visualizza. - Force checking all #ifdef configurations Forza la scansione di tutte le configurazioni #ifdef - Show full path of files Mostra tutto il percorso dei files - Show "No errors found" message when no errors found Mostra il messaggio "Nessun errore trovato" quando nessun errore è stato trovato - Display error Id in column "Id" Mostra l'id dell'errore nella colonna "Id" - Enable inline suppressions Abilita le soppressioni - Check for inconclusive errors also - Show statistics on check completion - Check for updates - Show internal warnings in log - Addons - Python binary (leave this empty to use python in the PATH) @@ -2892,143 +2601,117 @@ Per vedere il tipo di errori che sono mostrati, apri il menu Visualizza. - - - ... - MISRA addon - MISRA rule texts file - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Clang - Clang path (leave empty to use system PATH) - Visual Studio headers - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> - Code Editor - Code Editor Style - System Style - Default Light Style - Default Dark Style - Custom - Remove Rimuovi - Max count: - Applications Applicazioni - - Edit... Modifica... - Set as default Imposta come predefinito - Reports Rapporti - Save all errors when creating report Salva tutti gli errori quando viene creato il rapporto - Save full path to files in reports Salva tutto il percorso ai files nei rapporti - Language Lingua @@ -3085,8 +2768,6 @@ Per vedere il tipo di errori che sono mostrati, apri il menu Visualizza. - - Statistics @@ -3094,135 +2775,113 @@ Per vedere il tipo di errori che sono mostrati, apri il menu Visualizza. - Project Progetto - Project: Progetto: - Paths: Percorsi: - Include paths: Percorsi di inclusione: - Defines: Definizioni: - Undefines: - Previous Scan Precedente Scansione - Path Selected: Selezionato percorso: - Number of Files Scanned: Numero di Files Scansionati: - Scan Duration: Durata della scansione: - Errors: Errori: - Warnings: Avvisi: - Stylistic warnings: Avvisi sullo stile: - Portability warnings: Avvisi sulla portabilità: - Performance issues: Casi sulla performance: - Information messages: Messaggi di informazione: - Active checkers: - Checkers - History - File: - Copy to Clipboard Copia negli Appunti - Pdf Export @@ -3372,7 +3031,6 @@ Per vedere il tipo di errori che sono mostrati, apri il menu Visualizza.ThreadDetails - Thread Details diff --git a/gui/cppcheck_ja.ts b/gui/cppcheck_ja.ts index 75b2bad9985..a14c7bd01a7 100644 --- a/gui/cppcheck_ja.ts +++ b/gui/cppcheck_ja.ts @@ -5,45 +5,38 @@ About - About Cppcheck cppcheckについて - Version %1 Version %1 - Cppcheck - A tool for static C/C++ code analysis. CppcheckはC/C++ 静的コード解析ツールです. - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. Copyright © 2007-%1 Cppcheck team. - This program is licensed under the terms of the GNU General Public License version 3 本ソフトウェアはGNU General Public License Version3 ライセンスの元で配布されます - Visit Cppcheck homepage at %1 Cppcheckのホームページはこちら %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> <html><head/><body><p>ライブラリの開発者に感謝を捧げます:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> @@ -53,13 +46,11 @@ of the GNU General Public License version 3 ApplicationDialog - Add an application アプリケーションの追加 - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -86,25 +77,21 @@ Parameters: -l(line) (file) - &Name: 表示名(&N): - &Executable: 実行ファイルのパス(&E): - &Parameters: パラメータ(&P): - Browse 参照 @@ -204,19 +191,16 @@ Parameters: -l(line) (file) HelpDialog - Cppcheck GUI help Cppcheck GUI ヘルプ - Contents 目次 - Index インデックス @@ -234,19 +218,16 @@ Parameters: -l(line) (file) LibraryAddFunctionDialog - Add function 関数の追加 - Function name(s) 関数の名称 - Number of arguments 引数の数 @@ -255,103 +236,86 @@ Parameters: -l(line) (file) LibraryDialog - Library Editor ライブラリエディタ - Open 開く - Save 保存する - Save as 別名で保存する - Functions 関数 - Sort ソート - Add 追加 - Filter: フィルタ: - Comments コメント - noreturn noreturn(返り値なし) - False False(偽) - True True(真) - Unknown Unknown(不明) - return value must be used 返り値は使用されなければならない - ignore function in leaks checking リークの解析中に無視する関数 - Arguments Arguments(引数) - Edit 編集 @@ -397,13 +361,11 @@ Parameters: -l(line) (file) LibraryEditArgDialog - Edit argument 引数の編集 - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -419,14 +381,12 @@ Parameters: -l(line) (file) - Not bool 非ブール型 非bool値 - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -442,99 +402,78 @@ Parameters: -l(line) (file) - Not null 非NULL - Not uninit 未初期化 - String 文字列 - Format string フォーマット文字列 - Min size of buffer バッファの最小サイズ - - Type Type(型) - - None None(無) - - argvalue argvalue(引数の値) - - mul mul(積) - - strlen strlen(文字数) - - Arg Arg(引数) - - Arg2 Arg2(第二引数) - and and(和) - Valid values 妥当な値 @@ -547,189 +486,155 @@ Parameters: -l(line) (file) - &File ファイル(&F) - &View 表示(&V) - &Toolbars ツールバー(&T) - &Help ヘルプ(&H) - C++ standard C++標準 - &C standard C standard &C標準 - &Edit 編集(&E) - Standard 言語規格 - Categories カテゴリ - &License... ライセンス(&L)... - A&uthors... 作者(&u)... - &About... Cppcheckについて(&A)... - &Files... ファイル選択(&F)... - - Analyze files Check files ファイルをチェックする - Ctrl+F Ctrl+F - &Directory... ディレクトリ選択(&D)... - - Analyze directory Check directory ディレクトリをチェックする - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop 停止(&S) - - Stop analysis Stop checking チェックを停止する - Esc Esc - &Save results to file... 結果をファイルに保存(&S)... - Ctrl+S Ctrl+S - &Quit 終了(&Q) - &Clear results 結果をクリア(&C) - &Preferences 設定(&P) - - Show style warnings スタイル警告を表示 - - Show errors エラーを表示 @@ -742,129 +647,107 @@ Parameters: -l(line) (file) - Show information messages 情報メッセージを表示 - Show portability warnings 移植可能性の問題を表示 - Show Cppcheck results Cppcheck結果を表示する - Clang Clang - Show Clang results Clangの結果を表示 - &Filter フィルター(&F) - Filter results フィルタ結果 - Windows 32-bit ANSI Windows 32-bit ANSIエンコード - Windows 32-bit Unicode Windows 32-bit Unicode - Unix 32-bit Unix 32-bit - Unix 64-bit Unix 64-bit - Windows 64-bit Windows 64-bit - &Print... 印刷(&P)... - Print the Current Report 現在のレポートを印刷 - Print Pre&view... 印刷プレビュー(&v)... - Open a Print Preview Dialog for the Current Results 現在のレポートをプレビュー表示 - Open library editor ライブラリエディタを開く - C&lose Project File プロジェクトを閉じる(&l) - &Edit Project File... プロジェクトの編集(&E)... - &Statistics 統計情報(&S) - - Show warnings 警告を表示 @@ -872,329 +755,273 @@ Parameters: -l(line) (file) - - Show performance warnings パフォーマンス警告を表示 - Show &hidden 非表示を表示(&h) - &Check all すべてのエラーを表示(&C) - Checking for updates 更新の確認 - Hide 非表示 - - Report レポート - A&nalyze チェック(&n) - Filter フィルター - &Reanalyze modified files &Recheck modified files 変更ありファイルを再解析(&R) - Reanal&yze all files 全ファイル再解析(&y) - Ctrl+Q Ctrl+Q - Style war&nings スタイル警告(&n) - E&rrors エラー(&r) - &Uncheck all すべてのエラーを非表示(&U) - Collapse &all ツリーを折り畳む(&a) - &Expand all ツリーを展開(&E) - &Standard 言語規格(&S) - Standard items 標準項目 - &Contents コンテンツ(&C) - Open the help contents ヘルプファイルを開く - F1 F1 - Toolbar ツールバー - &Categories カテゴリ(&C) - Error categories エラーカテゴリ - &Open XML... XMLを開く(&O)... - Open P&roject File... プロジェクトを開く(&R)... - Ctrl+Shift+O Ctrl+Shift+O - Sh&ow Scratchpad... スクラッチパッドを表示(&o)... - &New Project File... 新規プロジェクト(&N)... - Ctrl+Shift+N Ctrl+Shift+N - &Log View ログを表示(&L) - Log View ログ表示 - &Warnings 警告(&W) - Per&formance warnings パフォーマンス警告(&f) - &Information 情報(&I) - &Portability 移植可能性(&P) - P&latforms プラットフォーム(&l) - C++&11 C++11(&1) - C&99 C99(&9) - &Posix Posix(&P) - C&11 C11(&1) - &C89 C89(&C) - &C++03 C++03(&C) - &Library Editor... ライブラリエディタ(&L)... - &Auto-detect language 自動言語検出(&A) - &Enforce C++ C++ 強制(&E) - E&nforce C C 強制(&n) - C++14 C++14 - Reanalyze and check library ライブラリを再チェックする - Check configuration (defines, includes) チェックの設定(define、インクルード) - C++17 C++17 - C++20 C++20 - Compliance report... コンプライアンスレポート... - Normal ノーマル @@ -1220,25 +1047,21 @@ Parameters: -l(line) (file) - Autosar AUTOSAR - EULA... EULA... - Thread Details スレッド詳細 - Show thread details スレッド詳細を表示 @@ -1710,31 +1533,26 @@ Options: NewSuppressionDialog - New suppression 新しい指摘の抑制 - Error ID エラーID - File name ファイル名 - Line number 行数 - Symbol name シンボル名 @@ -1776,33 +1594,28 @@ Options: ProjectFile - Project File プロジェクトファイル - Paths and Defines パスと定義 - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) プロジェクトのインポート(Visual studio / compile database Borland C++ Builder 6)) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' 定義(Define)はセミコロン';'で区切る必要があります。 例: DEF1;DEF2=5;DEF3=int - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. カスタマイズした cfgファイルを同じフォルダにプロジェクトファイルとして保存してください。ここに表示できるようになります。 @@ -1812,59 +1625,48 @@ Options: - MISRA rule texts MISRA ルールテキスト - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> <html><head/><body><p>MISRA C 2012 pdfのAppendix A &quot;Summary of guidelines&quot; からテキストをコピーペーストしてください。</p></body></html> - ... ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> <html><head/><body><p>選択済み:</p><p> * 全Debug と Release設定をチェックする</p><p> * 最初にマッチした Debug 設定のみチェックする</p><p><br/></p></body></html> - - Browse... 参照... - Analyze all Visual Studio configurations Visual Studioの全ての設定をチェックする - Selected VS Configurations 選択したVS設定 - Paths: パス: - - Add... 追加... @@ -1872,9 +1674,6 @@ Options: - - - Edit 編集 @@ -1883,108 +1682,87 @@ Options: - - - - Remove 取り除く - Undefines: 定義取り消し(Undefines): - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 定義の取り消しはセミコロンで区切ります。例: UNDEF1;UNDEF2;UNDEF3 - Include Paths: インクルードパス: - Include file インクルードファイル - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">ヘッダファイルを強制的にインクルードします</span></p></body></html> - Browse.. ブラウズ.. - Types and Functions 型と関数 - - Analysis チェック - This is a workfolder that Cppcheck will use for various purposes. Cppcheckがさまざまな目的で使用するワークディレクトリ。 - Parser パーサー - Cppcheck (built in) Cppcheckビルトイン - Check level チェックレベル - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. #R 限定的 -- 開発者が直接的に結果を得るための解析を意味します。解析は限定的で高速ですがより少ない結果になります。 - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. #N 通常 -- CIでの通常の解析を意味します。解析が合理的な時間内に完了すべきです。 - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). #E 徹底的 -- ナイトリービルド等を意味します。解析時間はより長くなることがあります (コンパイルの10倍以上時間がかかってもよい)。 - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) ヘッダファイルのコードもチェック (通常はONにしてください、制限するときのみOFF) @@ -1994,234 +1772,194 @@ Options: - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. タグが追加された場合、警告上で右クリックしてそれらのタグの中の一つを設定できます。警告を分類できます。 - Exclude source files 除外するソースファイル - Exclude folder... フォルダで除外... - Exclude file... ファイルで除外... - Check that each class has a safe public interface クラスが安全で公開されたインターフェースをもっているか確認 - Limit analysis 解析の制限 - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) 未使用テンプレートのコードもチェック (解析に時間がかかり、また正確性は低い) - Max CTU depth CTUの最大深さ - Enable inline suppressions inline抑制を有効にする - Misra C MISRA C - 2012 2012 - - 2023 2023 - 2025 2025 - Misra C++ MISRA C++ - 2008 2008 - Cert C++ Cert C++ - Safety profiles (defined in C++ core guidelines) 安全性プロファイル(C++コアガイドラインで定義) - Bug hunting (Premium) バグハンティング(プレミアム) - External tools 外部ツール - Up 上 - Down 下 - Platform プラットフォーム - Clang (experimental) Clang (実験的) - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. 可能な限りクラスが柔軟であり堅牢であることを望む場合、公開されたインターフェースが非常に堅牢です。Cppcheckは引数があらゆる値をとりうると仮定します。 - Max recursion in template instantiation テンプレートインスタンス化の最大再帰回数 - Warning options 警告オプション - Root path: ルートパス: - Filepaths in warnings will be relative to this path 警告中のファイルパスはこのパスからの相対パスになります - Warning tags (separated by semicolon) 警告タグ(セミコロン区切り) - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) Cppcheck ビルドディレクトリ (全プログラムチェック, 差分チェック, 統計等) - Libraries ライブラリ - Suppressions 指摘の抑制 - Add 追加 - - Addons アドオン - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. 注意: アドオンには<a href="https://www.python.org/">Python</a>が必要です。 - Y2038 Y2038 - Thread safety スレッドセーフ - Coding standards コーディング標準 @@ -2231,13 +1969,11 @@ Options: - Cert C CERT C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) CERT-INT35-C: int型の精度 (もしサイズが精度と一致する場合空のままにしてください) @@ -2247,13 +1983,11 @@ Options: - Autosar AUTOSAR - Bug hunting バグハント @@ -2267,7 +2001,6 @@ Options: - Defines: 定義(Defines): @@ -2822,25 +2555,21 @@ Please check the application path and parameters are correct. ResultsView - Results 結果 - Critical errors 致命的なエラー - Analysis Log チェックログ - Warning Details 警告の詳細 @@ -2950,31 +2679,26 @@ To toggle what kind of errors are shown, open view menu. ScratchPad - Scratchpad スクラッチパッド - Copy or write some C/C++ code here: ここに C/C++のコードをコピーペーストまたは記入してください: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": オプション: ファイル名を入力(言語は自動判定)して"チェック"をクリックしてください: - filename ファイル名 - Check チェック @@ -2983,25 +2707,21 @@ To toggle what kind of errors are shown, open view menu. Settings - Preferences 設定 - General 全般 - Add... 追加... - Number of threads: 解析用のスレッド数: @@ -3011,68 +2731,57 @@ To toggle what kind of errors are shown, open view menu. - Force checking all #ifdef configurations Check all #ifdef configurations すべての #ifdef をチェックする - Show full path of files ファイルのフルパスを表示 - Show "No errors found" message when no errors found エラーが無いときは"エラーなし"を表示 - Display error Id in column "Id" エラーIDを "Id" に表示する - Enable inline suppressions inline抑制を有効にする - Check for inconclusive errors also 結論のでない指摘もチェックする - Show statistics on check completion チェック完了時に統計情報を表示する - Check for updates 更新の確認 - Show internal warnings in log ログの内部警告も表示する - Addons アドオン - Python binary (leave this empty to use python in the PATH) Pythonインタプリタの場所(空白の場合システムのPATHから検索) @@ -3080,143 +2789,117 @@ To toggle what kind of errors are shown, open view menu. - - - ... ... - MISRA addon MISRAアドオン - MISRA rule texts file MISRA ルールテキストファイル - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> <html><head/><body><p>Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdfのテキストをテキストファイルにコピー</p></body></html> - Clang Clang - Clang path (leave empty to use system PATH) Clangの場所(空白の場合システムのPATHから検索) - Visual Studio headers Visual Studioのヘッダ - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> <html><head/><body><p>Visual Studioのヘッダーファイル(セミコロン区切り';')。</p><p>Visual Studio コマンドプロンプトを開き、 &quot;SET INCLUDE&quot;. と入力後、そのパスをコピーペーストしてください。</p></body></html> - Code Editor コードエディタ - Code Editor Style コードエディタスタイル - System Style システムのデフォルトのスタイル - Default Light Style ライトスタイルをデフォルトに - Default Dark Style ダークスタイルをデフォルトに - Custom カスタム - Remove 削除 - Max count: #M 最大数: - Applications アプリケーション - - Edit... 編集... - Set as default デフォルトとして設定 - Reports レポート - Save all errors when creating report レポート作成時にすべての警告/エラーを保存 - Save full path to files in reports レポートにファイルのフルパスを保存 - Language 言語 @@ -3273,8 +2956,6 @@ To toggle what kind of errors are shown, open view menu. - - Statistics @@ -3282,135 +2963,113 @@ To toggle what kind of errors are shown, open view menu. - Project プロジェクト - Project: プロジェクト: - Paths: パス: - Include paths: インクルードパス: - Defines: 定義(define): - Undefines: 定義取り消し(undef): - Previous Scan 前回の解析 - Path Selected: ディレクトリ選択: - Number of Files Scanned: 解析済みファイル数: - Scan Duration: 解析にかかった時間: - Errors: エラー: - Warnings: 警告: - Stylistic warnings: スタイル警告: - Portability warnings: 移植可能性の警告: - Performance issues: パフォーマンス警告: - Information messages: 情報メッセージ: - Active checkers: 有効なチェッカー: - Checkers チェッカー - History ヒストリー - File: ファイル: - Copy to Clipboard クリップボードにコピー - Pdf Export PDF エクスポート @@ -3560,7 +3219,6 @@ To toggle what kind of errors are shown, open view menu. ThreadDetails - Thread Details スレッド詳細 diff --git a/gui/cppcheck_ka.ts b/gui/cppcheck_ka.ts index 97fe21d6f96..04961c9e354 100644 --- a/gui/cppcheck_ka.ts +++ b/gui/cppcheck_ka.ts @@ -5,32 +5,27 @@ About - About Cppcheck Cppcheck-ის შესახებ - Version %1 ვერსია %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - ხელსაწყო სტატიკური C/C++ კოდის ანალიზისთვის. - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. Copyright © 2007-%1 Cppcheck-ის გუნდი. ყველა უფლება დაცულია. - This program is licensed under the terms of the GNU General Public License version 3 ვრცელდება GNU-ის საჯარო ლიცენზიის, @@ -38,13 +33,11 @@ of the GNU General Public License version 3 - Visit Cppcheck homepage at %1 ეწვიეთ Cppcheck-ის ვებგვერდს მისამართზე %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> <html><head/><body><p>დიდი მადლობა ამ ბიბლიოთეკებს, რომლებსაც ვიყენებთ::</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> @@ -54,13 +47,11 @@ of the GNU General Public License version 3 ApplicationDialog - Add an application აპლიკაციის დამატება - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -76,25 +67,21 @@ Parameters: -l(line) (file) - &Name: &სახელი: - &Executable: &გამშვები ფაილი: - &Parameters: &პარამეტრები: - Browse დათვალიერება @@ -192,19 +179,16 @@ Parameters: -l(line) (file) HelpDialog - Cppcheck GUI help Cppcheck-ის გრაფიკული ინტერფეისის დახმარება - Contents შემცველობა - Index ინდექსი @@ -222,19 +206,16 @@ Parameters: -l(line) (file) LibraryAddFunctionDialog - Add function ფუნქციის დამატება - Function name(s) ფუნქციის სახელ(ებ)-ი - Number of arguments არგუმენტების რაოდენობა @@ -243,103 +224,86 @@ Parameters: -l(line) (file) LibraryDialog - Library Editor ბიბლიოთეკის რედაქტორი - Open გახსნა - Save შენახვა - Save as შენახვა, როგორც - Functions ფუნქციები - Sort დალაგება - Add დამატება - Filter: ფილტრი: - Comments კომენტარები - noreturn noreturn - False მცდარი - True სიმართლე - Unknown უცნობი - return value must be used უნდა გამოიყენოთ დაბრუნებული მნიშვნელობა - ignore function in leaks checking ფუნქციების გამოტოვება გაჟონვები შემოწმებისას - Arguments არგუმენტები - Edit ჩასწორება @@ -384,13 +348,11 @@ Parameters: -l(line) (file) LibraryEditArgDialog - Edit argument არგუმენტის ჩასწორება - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -401,13 +363,11 @@ Parameters: -l(line) (file) - Not bool ლოგიკური მნ. არაა - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -418,99 +378,78 @@ Parameters: -l(line) (file) - Not null ნულოვანი არაა - Not uninit Uninit არაა - String სტრიქონი - Format string სტრიქონის ფორმატი - Min size of buffer ბუფერის მინ. ზომა - - Type ტიპი - - None არაფერი - - argvalue argvalue - - mul mul - - strlen strlen - - Arg არგ - - Arg2 Arg2 - and და - Valid values სწორი მნიშვნელობები @@ -523,175 +462,144 @@ Parameters: -l(line) (file) - A&nalyze ა&ნალიზი - Standard სტანდარტული - &File &ფაილი - &View &ხედი - &Toolbars &ხელსაწყოთა ზოლები - C++ standard C++-ის სტანდარტი - &C standard C standard &C-ის სტანდარტი - &Edit &ჩასწორება - &License... &ლიცენზია... - A&uthors... &ავტორები... - &About... &შესახებ... - &Files... ფაილ&ები... - - Analyze files Check files ფაილების ანალიზი - Ctrl+F Ctrl+F - &Directory... &საქაღალდე.... - - Analyze directory Check directory საქაღალდის ანალიზი - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop &გაჩერება - - Stop analysis Stop checking ანალიზის გაჩერება - Esc Esc - &Save results to file... შედეგები&ს შენახვა ფაილში.... - Ctrl+S Ctrl+S - &Quit გამოსვლა - &Clear results შედეგების &გასუფთავება - &Preferences &გამართვა - - Show errors შეცდომების ჩვენება @@ -699,8 +607,6 @@ Parameters: -l(line) (file) - - Show warnings გაფრთხილების ჩვენება @@ -708,14 +614,11 @@ Parameters: -l(line) (file) - - Show performance warnings წარმადობის გაფრთხილებების ჩვენება - Show &hidden დამალულის &ჩვენება @@ -727,412 +630,343 @@ Parameters: -l(line) (file) - Show information messages ინფორმაციის შეტყობინებების ჩვენება - Show portability warnings გადატანადობის გაფრთხილებების ჩვენება - Show Cppcheck results Cppcheck-ის შედეგები ჩვენება - Clang Clang - Show Clang results Clang-ის შედეგები ჩვენება - &Filter &ფილტრი - Filter results შედეგების გაფილტვრა - Windows 32-bit ANSI Windows 32-bit ANSI - Windows 32-bit Unicode Windows 32-bit Unicode - Unix 32-bit Unix 32-bit - Unix 64-bit Unix 64-bit - Windows 64-bit Windows 64-bit - &Print... &ბეჭდვა… - Print the Current Report მიმდინარე ანგარიშის დაბეჭდვა - Print Pre&view... საბეჭდის &გადახედვა... - Open a Print Preview Dialog for the Current Results მიმდინარე შედეგების დაბეჭდვის მინიატურის დიალოგის ჩვენება - Open library editor ბიბლიოთეკის რედაქტორის გახსნა - &Check all &ყველას ჩართვა - Checking for updates განახლებების შემოწმება - Hide დამალვა - - Report - Filter ფილტრი - &Reanalyze modified files &Recheck modified files ყველა შეცვლილი ფაილის თავიდან ანალი&ზი - Reanal&yze all files &ყველა ფაილის თავიდან ანალიზი - Ctrl+Q Ctrl+Q - Style war&nings ს&ტილის გაფრთხილებები - E&rrors &შეცდომები - &Uncheck all ყველას ჩამოყ&რა - Collapse &all ყველას ჩაკეცვ&ა - &Expand all &ყველას ამოკეცვა - &Standard &სტანდარტული - Standard items სტანდარტული ელემენტები - Toolbar ხელსაწყოთა ზოლი - &Categories &კატეგორიები - Error categories შეცდომის კატეგორიები - &Open XML... &XML-ის გახსნა... - Open P&roject File... პ&პროექტის ფაილის გახსნა... - Ctrl+Shift+O Ctrl+Shift+O - Sh&ow Scratchpad... ბლ&ოკნოტის ჩვენება... - &New Project File... &ახალი პროექტის ფაილი... - Ctrl+Shift+N Ctrl+Shift+N - &Log View ჟურნა&ლის ხედი - Log View ჟურნალის ხედი - C&lose Project File პროექტის ფაი&ლის დახურვა - &Edit Project File... პროექტის ფაილის ჩასწორ&ება... - &Statistics &სტატისტიკა - &Warnings &გაფრთხილებები - Per&formance warnings წარმატების გა&ფრთხილებები - &Information &ინფორმაცია - &Portability &გადატანადობა - P&latforms პ&ლატფორმები - C++&11 C++&11 - C&99 C&99 - &Posix &Posix - C&11 C&11 - &C89 &C89 - &C++03 &C++03 - &Library Editor... ბიბ&ლიოთეკის რედაქტორი... - &Auto-detect language ენის &ავტოდადგენა - &Enforce C++ ძ&ალით C++ - E&nforce C ძა&ლით C - C++14 C++14 - Reanalyze and check library ბიბლიოთეკის თავიდან ანალიზი და შემოწმება - Check configuration (defines, includes) კონფიგურაციის შემოწმება (defines, includes) - C++17 C++17 - C++20 C++20 - Compliance report... შესაბამისობის ანგარიში... - Normal ნორმალური @@ -1150,63 +984,52 @@ Parameters: -l(line) (file) - Autosar - EULA... - Thread Details - Show thread details - &Contents &შემცველობა - Categories კატეგორიები - - Show style warnings სტილის გაფრთხილების ჩვენება - Open the help contents დახმარების შემცველობის გახსნა - F1 F1 - &Help &დახმარება @@ -1674,31 +1497,26 @@ Options: NewSuppressionDialog - New suppression ახალი ჩახშობა - Error ID შეცდომის ID - File name ფაილის სახელი - Line number ხაზის ნომერი - Symbol name სიმბოლოს სახელი @@ -1740,145 +1558,120 @@ Options: ProjectFile - Project File პროექტის ფაილი - Paths and Defines ბილიკები და აღწერები - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) პროექტის შემოტანა (Visual studio / მონაცემთა ბაზი კომპილაცია / Borland C++ Builder 6) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' აღწერები წერტილმძიმით უნდა იყოს გამოყოფილი. მაგ: DEF1;DEF2=5;DEF3=int - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. შენიშვნა: ჩადეთ თქვენი .cfg ფაილები იგივე საქაღალდეში, სადაც პროექტის ფაილია. მათ ზემოთ დაინახავთ. - Clang (experimental) Clang (ექსპერიმენტული) - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) თავსართის ფაილებში არსებული კოდის შეწმება (ნაგულისხმევად, ეს ჩართულია. თუ გნებავთ შეზღუდული სწრაფი ანალიზი, მაშინ გამორთეთ ეს) - Max recursion in template instantiation - Filepaths in warnings will be relative to this path ფაილის ბილიკები ამ ბილიკის ფარდობითი იქნება - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. თუ ჭდეები დამატებულია, შეგიძლიათ, გაფრთხილებებზე მარჯვენა ღილაკით დააწკაპუნოთ და დააყენოთ ერთ-ერთი ჭდე. გაფრთხილებების კატეგორიებად დალაგება ხელით შეგიძლიათ. - Exclude source files კოდის ფაილების ამოღება - Exclude folder... საქაღალდის ამოღება... - Exclude file... ფაილის ამოღება... - MISRA rule texts MISRA-ის წესის ტექსტები - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - ... ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> - - Browse... ნუსხა... - Analyze all Visual Studio configurations ყველა Visual Studio-ის კონფიგურაციის ანალიზი - Selected VS Configurations არჩეული VS-ის კონფიგურაციები - Paths: ბილიკები: - - Add... დამატება... @@ -1886,9 +1679,6 @@ Options: - - - Edit ჩასწორება @@ -1897,311 +1687,255 @@ Options: - - - - Remove წაშლა - Undefines: წაშლილი მაკროაღწერები: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 წაშლილი მაკროაღწერები წერტილმძიმით უნდა იყოს გამოყოფილი. მაგ: UNDEF1;UNDEF2;UNDEF3 - Include Paths: ჩასმის ბილიკები: - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Types and Functions ტიპები და ფუნქციები - - Analysis ანალიზი - This is a workfolder that Cppcheck will use for various purposes. ეს სამუშაო საქაღალდეა, რომელსაც Cppcheck სხვადასხვა მიზნებისთვის გამოიყენებს. - Parser ანალიზატორი - Cppcheck (built in) Cppcheck (ჩაშენებული) - Check level შემოწმების დონე - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. ნორმალური -- ნიშნავს ნორმალურ ანალიზს CI-ში. ანალიზი მისაღებ დროში დასრულდება. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). ამომწურავი -- განკუთვნილია ღამის აგებებისთვის და ა.შ. ანალიზის დრო, შეიძლება, უფრო მეტიც იყოს (კომპილაციაზე 10x მეტი დრო ჩვეულებრივი ამბავია). - Check that each class has a safe public interface შემოწმება, აქვს თუ არა ყველა კლასს უსაფრთხო საჯარო ინტერფეისი - Limit analysis ანალიზის შეზღუდვა - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) - Max CTU depth CTU-ის მაქსიმალური სიღრმე - Enable inline suppressions შეცდომების ხაზშივე ჩახშობის ჩართვა - 2025 2025 - Misra C++ Misra C++ - 2008 2008 - Cert C Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) CERT-INT35-C: მთელი რიცხვის სიზუსტე (თუ ზომა სიზუსტეს ემთხვევა, შეგიძლიათ, ცარიელი დატოვოთ) - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting შეცდომებზე ნადირობა - External tools გარე ხელსაწყოები - Up მაღლა - Down ქვემოთ - Platform პლატფორმა - Warning options გაფრთხილების მორგება - Root path: Root ბილიკი: - Warning tags (separated by semicolon) გაფრთხილების ჭდეები (წერტილმძიმით გამოყოფილი) - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) Cppcheck-ის აგების საქაღალდე (მთელი პროგრამის ანალიზი, ინკრემენტული ანალიზი, სტატისტიკა და ა.შ.) - Libraries ბიბლიოთეკები - Suppressions ჩახშობები - Add დამატება - - Addons დამატებები - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. შენიშვნა: დამატებას დაყენებული <a href="https://www.python.org/">Python</a> სჭირდება. - Y2038 Y2038 - Thread safety ნაკადების უსაფრთხოება - Coding standards კოდირების სტანდარტები - Misra C Misra C - 2012 2012 - - 2023 2023 - Cert C++ Cert C++ - Bug hunting (Premium) შეცდომებზე ნადირობა (ფასიანი) @@ -2215,7 +1949,6 @@ Options: - Defines: მაკროაღწრები: @@ -2862,25 +2595,21 @@ To toggle what kind of errors are shown, open view menu. - Results შედეგები - Critical errors კრიტიკული შეცდომები - Analysis Log ანალიზის ჟურნალი - Warning Details გაფრთხილების დეტალები @@ -2889,31 +2618,26 @@ To toggle what kind of errors are shown, open view menu. ScratchPad - Scratchpad მონახაზი - Copy or write some C/C++ code here: დააკოპირეთ ან დაწერეთ C/C++ კოდი აქ: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": შეიყვანეთ არასავალდებულო ფაილის სახელი (ძირითადად ავტომატური ენის დადგენისთვის) და დააწკაპუნეთ ღილაკზე "შემოწმება": - filename ფაილის სახელი - Check შემოწმება @@ -2922,25 +2646,21 @@ To toggle what kind of errors are shown, open view menu. Settings - Preferences მორგება - General ზოგადი - Add... დამატება... - Number of threads: ნაკადების რაოდენობა: @@ -2950,68 +2670,57 @@ To toggle what kind of errors are shown, open view menu. - Force checking all #ifdef configurations Check all #ifdef configurations ყველა #ifdef კონფიგურაციის ნაძალადევი შემოწმება - Show full path of files ფაილების სრული ბილიკის ჩვენება - Show "No errors found" message when no errors found "შეცდომები ნაპოვნი არაა" შეტყობინების ჩვენება, როცა შეცდომები აღმოჩენილი არა - Display error Id in column "Id" სვეტში "Id" შეცდომის Id-ის ჩვენება - Enable inline suppressions შეცდომების ხაზშივე ჩახშობის ჩართვა - Check for inconclusive errors also ასევე, ნაჩვენები იქნება საკამათო შეცდომებიც - Show statistics on check completion სტატისტიკის ჩვენება შემოწმების დასრულებისას - Check for updates განახლებების შემოწმება - Show internal warnings in log ჟურნალში შიდა გაფრთხილებების ჩვენება - Addons დამატებები - Python binary (leave this empty to use python in the PATH) ბილიკი python-ის ინტერპრეტატორამდე. (PATH-ში არსებული python-ის გამოსაყენებლად ცარიელი დატოვეთ) @@ -3019,143 +2728,117 @@ To toggle what kind of errors are shown, open view menu. - - - ... ... - MISRA addon MISRA-ის დამატება - MISRA rule texts file MISRA-ის წესის ტექსტების ფაილი - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Clang Clang - Clang path (leave empty to use system PATH) ბილიკი Clang-ის ინტერპრეტატორამდე. (PATH-ში არსებულის გამოსაყენებლად ცარიელი დატოვეთ) - Visual Studio headers Visual Studio-ის თავსართები - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> - Code Editor კოდის რედაქტორი - Code Editor Style კოდის რედაქტორის სტილი - System Style სისტემის მიყოლა - Default Light Style ნაგულისხმევი ღია სტილი - Default Dark Style ნაგულისხმევი მუქი სტილი - Custom მომხმარებლის - Remove წაშლა - Max count: - Applications აპლიკაციები - - Edit... რედაქტირება... - Set as default ნაგულისხმებად დაყენება - Reports ანგარიში - Save all errors when creating report ყველა შეცდომის შენახვა ანგარიშის შექმნისას - Save full path to files in reports ფაილების სრული ბილიკის ჩვენება ანგარიშებში - Language ენა @@ -3212,8 +2895,6 @@ To toggle what kind of errors are shown, open view menu. - - Statistics @@ -3221,135 +2902,113 @@ To toggle what kind of errors are shown, open view menu. - Project პროექტი - Project: პროექტი: - Paths: ბილიკები: - Include paths: თავსართის ფაილის ბილიკები: - Defines: მაკროაღწრები: - Undefines: წაშლილი მაკროაღწერები: - Previous Scan წინა სკანირება - Path Selected: არჩეული ბილიკი: - Number of Files Scanned: დასკანერებულია ფაილების რაოდენობა: - Scan Duration: სკანირების ხანგრძლივობა: - Errors: შეცდომები: - Warnings: გაფრთხილებები: - Stylistic warnings: სტილისტური გაფრთხილებები: - Portability warnings: გადატანადობის გაფრთხილებები: - Performance issues: წარმადობის პრობლემები: - Information messages: ინფორმაციის შეტყობინებები: - Active checkers: აქტიური შემმოწმებლები: - Checkers შაში - History ისტორია - File: ფაილი: - Copy to Clipboard ბუფერში კოპირება - Pdf Export PDF-ად გატანა @@ -3499,7 +3158,6 @@ To toggle what kind of errors are shown, open view menu. ThreadDetails - Thread Details diff --git a/gui/cppcheck_ko.ts b/gui/cppcheck_ko.ts index 09f564e6380..1c240fdd60c 100644 --- a/gui/cppcheck_ko.ts +++ b/gui/cppcheck_ko.ts @@ -5,25 +5,21 @@ About - About Cppcheck Cppcheck 정보 - Version %1 버전 %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - 정적 C/C++ 코드 분석 도구. - This program is licensed under the terms of the GNU General Public License version 3 이 프로그램은 GNU General Public License version 3을 @@ -31,20 +27,17 @@ of the GNU General Public License version 3 - Visit Cppcheck homepage at %1 Cppcheck 홈페이지(%1)를 방문해보세요 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. @@ -54,13 +47,11 @@ of the GNU General Public License version 3 ApplicationDialog - Add an application 응용 프로그램 추가 - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -86,25 +77,21 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: - &Name: 이름(&N): - &Executable: 실행 파일(&E): - &Parameters: 명령행 인자(&P): - Browse 찾기 @@ -149,19 +136,16 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: HelpDialog - Cppcheck GUI help - Contents - Index @@ -179,19 +163,16 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: LibraryAddFunctionDialog - Add function - Function name(s) - Number of arguments @@ -200,79 +181,66 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: LibraryDialog - Library Editor - Open - Save - Functions - Add - noreturn - False - True - Unknown - return value must be used - ignore function in leaks checking - Arguments - Edit 편집 @@ -289,25 +257,21 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: - Sort - Filter: - Comments - Save as @@ -340,13 +304,11 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: LibraryEditArgDialog - Edit argument - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -357,13 +319,11 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: - Not bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -374,99 +334,78 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: - Not null - Not uninit - String - Format string - Min size of buffer - - Type - - None - - argvalue - - mul - - strlen - - Arg - - Arg2 - and - Valid values @@ -479,304 +418,251 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: - Checking for updates - Hide 숨기기 - &File 파일(&F) - &View 보기(&V) - &Toolbars 도구바(&T) - - Report - &Help 도움말(&H) - &Edit 편집(&E) - Standard 표준 도구 - Categories 분류 도구 - Filter 필터 도구 - &License... 저작권(&L)... - A&uthors... 제작자(&u)... - &About... 정보(&A)... - &Files... 파일(&F)... - Ctrl+F Ctrl+F - &Directory... 디렉토리(&D)... - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop 중지(&S) - Esc Esc - &Save results to file... 결과를 파일에 저장(&S)... - Ctrl+S Ctrl+S - &Quit 종료(&Q) - &Clear results 결과 지우기(&C) - &Preferences 설정(&P) - - Show style warnings 스타일 경고 표시 - - Show errors 애러 표시 - &Check all 전체 선택(&C) - &Uncheck all 전체 해제(&U) - Collapse &all 전체 접기(&A) - &Expand all 전체 펼치기(&E) - &Standard 표준 도구(&S) - Standard items 표준 아이템 - &Contents 내용(&C) - Open the help contents 도움말을 엽니다 - F1 F1 - Toolbar 도구바 - &Categories 분류 도구(&C) - Error categories 에러 종류 - &Open XML... XML 열기(&O)... - Open P&roject File... 프로젝트 파일 열기(&R)... - &New Project File... 새 프로젝트 파일(&N)... - &Log View 로그 보기(&L) - Log View 로그 보기 - C&lose Project File 프로젝트 파일 닫기(&L) - &Edit Project File... 프로젝트 파일 편집(&E)... - &Statistics 통계 보기(&S) - - Show warnings 경고 표시 @@ -784,50 +670,41 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: - - Show performance warnings 성능 경고 표시 - Show &hidden 숨기기 보기(&H) - Compliance report... - Normal - Autosar - EULA... - Thread Details - Show thread details @@ -839,55 +716,46 @@ Kate로 파일을 열고, 해당 행으로 이동하는 예제: - Show information messages 정보 표시 - Show portability warnings 이식성 경고 표시 - &Filter 필터 도구(&F) - Filter results 필터링 결과 - Windows 32-bit ANSI Windows 32-bit ANSI - Windows 32-bit Unicode Windows 32-bit Unicode - Unix 32-bit Unix 32-bit - Unix 64-bit Unix 64-bit - Windows 64-bit Windows 64-bit @@ -1152,7 +1020,6 @@ Do you want to remove the file from the recently used projects -list? - C++ standard @@ -1213,31 +1080,26 @@ Do you want to remove the file from the recently used projects -list? - &Print... - Print the Current Report - Print Pre&view... - Open a Print Preview Dialog for the Current Results - Open library editor @@ -1277,30 +1139,23 @@ Options: - - Analyze files - - Analyze directory - &Reanalyze modified files - - Stop analysis @@ -1345,169 +1200,141 @@ Do you want to stop the analysis and exit Cppcheck? - A&nalyze - &C standard - Reanal&yze all files - Ctrl+Q - Style war&nings - E&rrors - Ctrl+Shift+O - Sh&ow Scratchpad... - Ctrl+Shift+N - &Warnings - Per&formance warnings - &Information - &Portability - Show Cppcheck results - Clang - Show Clang results - P&latforms - C++&11 - C&99 - &Posix - C&11 - &C89 - &C++03 - &Library Editor... - &Auto-detect language - &Enforce C++ - E&nforce C - C++14 C++14 @@ -1518,25 +1345,21 @@ Do you want to stop the analysis and exit Cppcheck? - Reanalyze and check library - Check configuration (defines, includes) - C++17 C++17 - C++20 C++20 @@ -1563,31 +1386,26 @@ Do you want to proceed? NewSuppressionDialog - New suppression - Error ID - File name - Line number - Symbol name @@ -1629,27 +1447,22 @@ Do you want to proceed? ProjectFile - Project File 프로젝트 파일 - Defines: Defines: - Paths: 경로: - - Add... 추가... @@ -1657,9 +1470,6 @@ Do you want to proceed? - - - Edit 편집 @@ -1668,433 +1478,356 @@ Do you want to proceed? - - - - Remove 제거 - Up 위로 - Down 아래로 - Suppressions - Add - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. - ... - Include Paths: - Paths and Defines - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> - Analyze all Visual Studio configurations - Root path: - Warning tags (separated by semicolon) - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) - Selected VS Configurations - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Types and Functions - Libraries - Parser - Cppcheck (built in) - Check that each class has a safe public interface - Limit analysis - - Addons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 - Thread safety - Coding standards - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Bug hunting - - Browse... - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int - Platform - This is a workfolder that Cppcheck will use for various purposes. - Clang (experimental) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - Max recursion in template instantiation - Warning options - Filepaths in warnings will be relative to this path - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... - Enable inline suppressions Inline suppression 사용 - Misra C - 2012 - - 2023 - 2025 - MISRA rule texts - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Misra C++ - 2008 - Cert C++ - Safety profiles (defined in C++ core guidelines) - Bug hunting (Premium) - External tools - Import Project (Visual studio / compile database/ Borland C++ Builder 6) - Undefines: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 - - Analysis - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) - Max CTU depth @@ -2611,7 +2344,6 @@ Please check the application path and parameters are correct. ResultsView - Results 결과 @@ -2700,19 +2432,16 @@ To toggle what kind of errors are shown, open view menu. - Critical errors - Analysis Log - Warning Details @@ -2736,31 +2465,26 @@ To toggle what kind of errors are shown, open view menu. ScratchPad - Scratchpad - filename - Check 검사 - Copy or write some C/C++ code here: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": @@ -2769,19 +2493,16 @@ To toggle what kind of errors are shown, open view menu. Settings - Preferences 설정 - General 일반 - Number of threads: 쓰레드 수: @@ -2791,129 +2512,107 @@ To toggle what kind of errors are shown, open view menu. - Force checking all #ifdef configurations 모든 #ifdef 설정을 강제로 검사 - Show full path of files 파일의 전체 경로 표시 - Show "No errors found" message when no errors found 에러가 발견되지 않는 경우 "에러가 없습니다." 메시지 표시 - Enable inline suppressions Inline suppression 사용 - Check for updates - Add... 추가... - Remove 제거 - Applications 응용 프로그램 - - Edit... 편집... - Set as default 기본으로 지정 - Reports 보고서 - Save all errors when creating report 보고서 생성 시 모든 에러 저장 - Save full path to files in reports 보고서에 파일의 전체 경로 저장 - Language 언어 - Display error Id in column "Id" - Check for inconclusive errors also - Show internal warnings in log - Show statistics on check completion - Max count: - Addons - Python binary (leave this empty to use python in the PATH) @@ -2921,87 +2620,71 @@ To toggle what kind of errors are shown, open view menu. - - - ... - Clang - Clang path (leave empty to use system PATH) - Visual Studio headers - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> - MISRA addon - MISRA rule texts file - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Code Editor - Code Editor Style - Default Light Style - Default Dark Style - Custom - System Style @@ -3058,8 +2741,6 @@ To toggle what kind of errors are shown, open view menu. - - Statistics @@ -3067,111 +2748,93 @@ To toggle what kind of errors are shown, open view menu. - Project 프로젝트 - Project: 프로젝트: - Paths: 경로: - Include paths: Include 경로: - Defines: Defines: - Previous Scan 직전 검사 - Path Selected: 선택된 경로: - Number of Files Scanned: 검사된 파일 수: - Scan Duration: 검사 시간: - Errors: 에러: - Warnings: 경고: - Stylistic warnings: 스타일 경고: - Portability warnings: 이식성 경고: - Performance issues: 성능 경고: - Information messages: 정보 메시지: - Active checkers: - Checkers - Copy to Clipboard 클립보드에 복사 @@ -3298,7 +2961,6 @@ To toggle what kind of errors are shown, open view menu. - Pdf Export @@ -3309,13 +2971,11 @@ To toggle what kind of errors are shown, open view menu. - History - File: @@ -3331,7 +2991,6 @@ To toggle what kind of errors are shown, open view menu. - Undefines: @@ -3345,7 +3004,6 @@ To toggle what kind of errors are shown, open view menu. ThreadDetails - Thread Details diff --git a/gui/cppcheck_nl.ts b/gui/cppcheck_nl.ts index 3bab077e6e3..6a650a2c05c 100644 --- a/gui/cppcheck_nl.ts +++ b/gui/cppcheck_nl.ts @@ -5,32 +5,27 @@ About - About Cppcheck Over Cppcheck - Version %1 Versie %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - Een tool voor statische C/C++ code analyse. - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. Copyright © 2007-2021 het cppcheck team. - This program is licensed under the terms of the GNU General Public License version 3 Dit programma is beschikbaar onder te termen @@ -38,13 +33,11 @@ van de GNU General Public License versie 3 - Visit Cppcheck homepage at %1 Bezoek de Cppcheck homepage op %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> @@ -54,13 +47,11 @@ van de GNU General Public License versie 3 ApplicationDialog - Add an application Voeg een nieuwe applicatie toe - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -86,25 +77,21 @@ Parameters: -l(lijn) (bestand) - &Name: &Naam: - &Executable: &Uitvoerbaar: - &Parameters: - Browse Bladeren @@ -151,19 +138,16 @@ Parameters: -l(lijn) (bestand) HelpDialog - Cppcheck GUI help - Contents - Index @@ -181,19 +165,16 @@ Parameters: -l(lijn) (bestand) LibraryAddFunctionDialog - Add function - Function name(s) - Number of arguments @@ -202,103 +183,86 @@ Parameters: -l(lijn) (bestand) LibraryDialog - Library Editor - Open - Save Opslaan - Save as - Functions - Sort - Add - Filter: - Comments - noreturn - False - True - Unknown - return value must be used - ignore function in leaks checking - Arguments - Edit Bewerk @@ -344,13 +308,11 @@ Parameters: -l(lijn) (bestand) LibraryEditArgDialog - Edit argument - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -361,13 +323,11 @@ Parameters: -l(lijn) (bestand) - Not bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -378,99 +338,78 @@ Parameters: -l(lijn) (bestand) - Not null - Not uninit - String - Format string - Min size of buffer - - Type - - None - - argvalue - - mul - - strlen - - Arg - - Arg2 - and - Valid values @@ -483,175 +422,144 @@ Parameters: -l(lijn) (bestand) - A&nalyze - Standard Standaard - &File &Bestand - &View &Weergave - &Toolbars &Werkbalken - C++ standard C++standaard - &C standard C standard C standaard - &Edit Be&werken - &License... &Licentie... - A&uthors... A&uteurs... - &About... &Over... - &Files... &Bestanden... - - Analyze files Check files Controleer bestanden - Ctrl+F Ctrl+F - &Directory... &Mappen... - - Analyze directory Check directory Controleer Map - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop &Stop - - Stop analysis Stop checking Stop controle - Esc Esc - &Save results to file... &Resultaten opslaan... - Ctrl+S Ctrl+S - &Quit &Afsluiten - &Clear results &Resultaten wissen - &Preferences &Voorkeuren - - Show errors Toon fouten @@ -659,8 +567,6 @@ Parameters: -l(lijn) (bestand) - - Show warnings Toon waarschuwingen @@ -668,14 +574,11 @@ Parameters: -l(lijn) (bestand) - - Show performance warnings Toon presentatie waarschuwingen - Show &hidden Toon &verborgen @@ -687,474 +590,394 @@ Parameters: -l(lijn) (bestand) - Show information messages Toon informatie bericht - Show portability warnings Toon portabiliteit waarschuwingen - Show Cppcheck results - Clang - Show Clang results - &Filter &Filter - Filter results Filter resultaten - Windows 32-bit ANSI Windows 32-bit ANSI - Windows 32-bit Unicode - Unix 32-bit - Unix 64-bit - Windows 64-bit - &Print... - Print the Current Report - Print Pre&view... - Open a Print Preview Dialog for the Current Results - Open library editor - &Check all &Controleer alles - Checking for updates - Hide Verberg - - Report - Filter - &Reanalyze modified files &Recheck modified files - Reanal&yze all files - Ctrl+Q - Style war&nings - E&rrors - &Uncheck all Selecteer &niets - Collapse &all Alles Inkl&appen - &Expand all Alles &Uitklappen - &Standard &Standaard - Standard items Standaard items - Toolbar Werkbalk - &Categories &Categorieën - Error categories Foute Categorieën - &Open XML... - Open P&roject File... Open P&oject bestand... - Ctrl+Shift+O - Sh&ow Scratchpad... - &New Project File... &Nieuw Project Bestand... - Ctrl+Shift+N - &Log View &Log weergave - Log View Log weergave - C&lose Project File &Sluit Project Bestand - &Edit Project File... &Bewerk Project Bestand... - &Statistics &Statistieken - &Warnings - Per&formance warnings - &Information - &Portability - P&latforms - C++&11 - C&99 - &Posix - C&11 - &C89 - &C++03 - &Library Editor... - &Auto-detect language - &Enforce C++ - E&nforce C - C++14 - Reanalyze and check library - Check configuration (defines, includes) - C++17 - C++20 - Compliance report... - Normal - Autosar - EULA... - Thread Details - Show thread details - &Contents &Inhoud - Categories Categorieën - - Show style warnings Toon stijl waarschuwingen - Open the help contents Open de help inhoud - F1 - &Help &Help @@ -1582,31 +1405,26 @@ Options: NewSuppressionDialog - New suppression - Error ID - File name - Line number - Symbol name @@ -1628,135 +1446,111 @@ Options: ProjectFile - Project File Project Bestand - Paths and Defines - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... - Misra C - 2012 - - 2023 - MISRA rule texts - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> - - Browse... - Analyze all Visual Studio configurations - Selected VS Configurations - Paths: Paden: - - Add... Toevoegen... @@ -1764,9 +1558,6 @@ Options: - - - Edit Bewerk @@ -1775,327 +1566,269 @@ Options: - - - - Remove Verwijder - Undefines: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 - Include Paths: - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Types and Functions - - Analysis - This is a workfolder that Cppcheck will use for various purposes. - Parser - Cppcheck (built in) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - Check that each class has a safe public interface - Limit analysis - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) - Max CTU depth - Enable inline suppressions Schakel inline suppressies in - 2025 - Misra C++ - 2008 - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting - External tools - Up Omhoog - Down Omlaag - Platform - Clang (experimental) - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - Max recursion in template instantiation - Warning options - Root path: - Filepaths in warnings will be relative to this path - Warning tags (separated by semicolon) - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) - Libraries - Suppressions - Add - - Addons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 - Thread safety - Coding standards - Cert C++ - Bug hunting (Premium) - Defines: Omschrijft: @@ -2717,25 +2450,21 @@ Gebruik het uitzicht menu om te selecteren welke fouten getoond worden. - Results Resultaten - Critical errors - Analysis Log - Warning Details @@ -2744,31 +2473,26 @@ Gebruik het uitzicht menu om te selecteren welke fouten getoond worden.ScratchPad - Scratchpad Scratchpad - Copy or write some C/C++ code here: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": - filename bestandsnaam - Check Controleer @@ -2777,25 +2501,21 @@ Gebruik het uitzicht menu om te selecteren welke fouten getoond worden.Settings - Preferences Instellingen - General Algemeen - Add... Toevoegen... - Number of threads: Aantal threads: @@ -2805,68 +2525,57 @@ Gebruik het uitzicht menu om te selecteren welke fouten getoond worden. - Force checking all #ifdef configurations Check all #ifdef configurations Controleer alle #ifdef combinaties - Show full path of files Toon het volledige pad van bestanden - Show "No errors found" message when no errors found Toon "Geen fouten gevonden" indien geen fouten gevonden werden - Display error Id in column "Id" Toon fout ld in kolom "Id" - Enable inline suppressions Schakel inline suppressies in - Check for inconclusive errors also - Show statistics on check completion - Check for updates - Show internal warnings in log - Addons - Python binary (leave this empty to use python in the PATH) @@ -2874,143 +2583,117 @@ Gebruik het uitzicht menu om te selecteren welke fouten getoond worden. - - - ... - MISRA addon - MISRA rule texts file - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Clang - Clang path (leave empty to use system PATH) - Visual Studio headers - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> - Code Editor - Code Editor Style - System Style - Default Light Style - Default Dark Style - Custom - Remove Verwijder - Max count: - Applications Applicaties - - Edit... Bewerk... - Set as default Instellen als standaard - Reports Rapporten - Save all errors when creating report Alle fouten opslaan - Save full path to files in reports Volledig pad opslaan - Language Taal @@ -3063,8 +2746,6 @@ Gebruik het uitzicht menu om te selecteren welke fouten getoond worden. - - Statistics @@ -3072,135 +2753,113 @@ Gebruik het uitzicht menu om te selecteren welke fouten getoond worden. - Project Project - Project: Project: - Paths: Paden: - Include paths: Bevat paden: - Defines: Omschrijft: - Undefines: - Previous Scan Vorige scan - Path Selected: Pad Geselekteerd: - Number of Files Scanned: Aantal bestanden gescanned: - Scan Duration: Scan tijd: - Errors: Fouten: - Warnings: Waarschuwingen: - Stylistic warnings: Stilistisch waarschuwingen: - Portability warnings: Portabiliteit waarschuwingen: - Performance issues: Presentatie problemen: - Information messages: Informatie bericht: - Active checkers: - Checkers - History - File: - Copy to Clipboard Kopieer naar Clipbord - Pdf Export @@ -3350,7 +3009,6 @@ Gebruik het uitzicht menu om te selecteren welke fouten getoond worden.ThreadDetails - Thread Details diff --git a/gui/cppcheck_ru.ts b/gui/cppcheck_ru.ts index d9a1a27c0a2..abe2ae8f774 100644 --- a/gui/cppcheck_ru.ts +++ b/gui/cppcheck_ru.ts @@ -5,32 +5,27 @@ About - About Cppcheck О Cppcheck - Version %1 Версия %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - программа для статического анализа кода на языках С/С++. - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. Copyright © 2007-2021 Cppcheck team. - This program is licensed under the terms of the GNU General Public License version 3 Эта программа распространяется на @@ -38,13 +33,11 @@ of the GNU General Public License version 3 - Visit Cppcheck homepage at %1 Посетите домашнюю страницу: %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> @@ -54,13 +47,11 @@ of the GNU General Public License version 3 ApplicationDialog - Add an application Добавление приложения - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -86,25 +77,21 @@ Parameters: -l(line) (file) - &Name: &Название: - &Executable: &Программа: - &Parameters: &Параметры: - Browse Просмотреть @@ -151,19 +138,16 @@ Parameters: -l(line) (file) HelpDialog - Cppcheck GUI help - Contents - Index @@ -181,19 +165,16 @@ Parameters: -l(line) (file) LibraryAddFunctionDialog - Add function Добавить функцию - Function name(s) Имя(имена) функции - Number of arguments Количество аргументов @@ -202,103 +183,86 @@ Parameters: -l(line) (file) LibraryDialog - Library Editor Редактор библиотек - Open Открыть - Save Сохранить - Save as Сохранить как - Functions Функции - Sort Сортировать - Add Добавить - Filter: Фильтр: - Comments Комментарии - noreturn - False - True - Unknown - return value must be used должно быть использовано возвращаемое значение - ignore function in leaks checking пропускать функцию при проверке на утечки - Arguments Аргументы - Edit Изменить @@ -344,13 +308,11 @@ Parameters: -l(line) (file) LibraryEditArgDialog - Edit argument Редактировать аргумент - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -361,13 +323,11 @@ Parameters: -l(line) (file) - Not bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -378,99 +338,78 @@ Parameters: -l(line) (file) - Not null - Not uninit - String - Format string - Min size of buffer - - Type - - None - - argvalue - - mul - - strlen - - Arg - - Arg2 - and - Valid values @@ -483,175 +422,144 @@ Parameters: -l(line) (file) - A&nalyze Анализ - Standard Стандартные - &File &Файл - &View &Вид - &Toolbars &Панель инструментов - C++ standard Стандарт C++ - &C standard C standard &Стандарт C - &Edit &Правка - &License... &Лицензия... - A&uthors... &Авторы... - &About... &О программе... - &Files... &Файлы... - - Analyze files Check files Проверить файлы - Ctrl+F Ctrl+F - &Directory... &Каталог... - - Analyze directory Check directory Проверка каталога - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop Остановить - - Stop analysis Stop checking Остановить проверку - Esc Esc - &Save results to file... Сохранить отчёт в файл... - Ctrl+S Ctrl+S - &Quit Выход - &Clear results Очистить отчёт - &Preferences Параметры - - Show errors Показать ошибки @@ -659,8 +567,6 @@ Parameters: -l(line) (file) - - Show warnings Показать предупреждения @@ -668,14 +574,11 @@ Parameters: -l(line) (file) - - Show performance warnings Показать предупреждения производительности - Show &hidden Показать скрытые @@ -687,474 +590,394 @@ Parameters: -l(line) (file) - Show information messages Показать информационные сообщения - Show portability warnings Показать предупреждения переносимости - Show Cppcheck results Просмотр результатов Cppcheck - Clang Clang - Show Clang results Просмотр результатов Clang - &Filter Фильтр - Filter results Результаты фильтрации - Windows 32-bit ANSI Windows 32-bit ANSI - Windows 32-bit Unicode Windows 32-bit Unicode - Unix 32-bit Unix 32-bit - Unix 64-bit Unix 64-bit - Windows 64-bit Windows 64-bit - &Print... Печать... - Print the Current Report Напечатать текущий отчет - Print Pre&view... Предварительный просмотр... - Open a Print Preview Dialog for the Current Results Открыть диалог печати для текущих результатов - Open library editor Открыть редактор библиотек - &Check all Отметить все - Checking for updates - Hide Скрыть - - Report - Filter Фильтр - &Reanalyze modified files &Recheck modified files Заново проверить измененные файлы - Reanal&yze all files Заново проверить все файлы - Ctrl+Q - Style war&nings Стилистические предупреждения - E&rrors Ошибки - &Uncheck all Сбросить все - Collapse &all Свернуть все - &Expand all Развернуть все - &Standard Стандартные - Standard items Стандартные элементы - Toolbar Панель инструментов - &Categories Категории - Error categories Категории ошибок - &Open XML... &Открыть XML... - Open P&roject File... Открыть файл &проекта... - Ctrl+Shift+O - Sh&ow Scratchpad... Показать Блокнот - &New Project File... &Новый файл проекта... - Ctrl+Shift+N - &Log View Посмотреть &лог - Log View Посмотреть лог - C&lose Project File &Закрыть файл проекта - &Edit Project File... &Изменить файл проекта... - &Statistics &Статистика - &Warnings Предупреждения - Per&formance warnings Предупреждения производительности - &Information Информационные предупреждения - &Portability Предупреждения переносимости - P&latforms Платформы - C++&11 - C&99 - &Posix - C&11 - &C89 - &C++03 - &Library Editor... Редактор библиотеки - &Auto-detect language Автоматическое определение языка - &Enforce C++ Принудительно C++ - E&nforce C Принудительно C - C++14 C++14 - Reanalyze and check library Повторный анализ библиотеки - Check configuration (defines, includes) Проверить конфигурацию (defines, includes) - C++17 C++17 - C++20 C++20 - Compliance report... - Normal - Autosar - EULA... - Thread Details - Show thread details - &Contents Помощь - Categories Категории - - Show style warnings Показать стилистические предупреждения - Open the help contents Открыть помощь - F1 F1 - &Help Помощь @@ -1621,31 +1444,26 @@ Options: NewSuppressionDialog - New suppression Новое подавление - Error ID ID - File name Имя файла - Line number Номер строки - Symbol name Имя символа @@ -1687,87 +1505,73 @@ Options: ProjectFile - Project File Файл проекта - Paths and Defines Каталоги и определения - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) Импорт проекта (Visual studio / compile database/ Borland C++ Builder 6) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' Defines должны быть разделены точкой с запятой ';' - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. Положите свои .cfg-файлы в один каталог с файлом проекта. Вы увидите их сверху. - Clang (experimental) - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - Max recursion in template instantiation - Filepaths in warnings will be relative to this path - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... @@ -1777,59 +1581,48 @@ Options: - MISRA rule texts Файл с текстами правил MISRA - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> <html><head/><body><p>Скопируйте текст из Appendix A &quot;Summary of guidelines&quot; из фала правил MISRA C 2012 pdf в текстовый файл.</p></body></html> - ... ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> <html><head/><body><p>Выберите:</p><p> * Анализ всех конфигураций Debug и Release</p><p> * Анализ только первой подходящей конфигурации Debug</p><p><br/></p></body></html> - - Browse... Обзор... - Analyze all Visual Studio configurations Анализировать все конфигурации Visual Studio - Selected VS Configurations - Paths: Пути: - - Add... Добавить... @@ -1837,9 +1630,6 @@ Options: - - - Edit Изменить @@ -1848,317 +1638,260 @@ Options: - - - - Remove Удалить - Undefines: Удаленные макроопределения: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 Удаленные макроопределения должны быть разделены точкой с запятой, например: UNDEF1;UNDEF2;UNDEF3 - Include Paths: Пути заголовочных файлов: - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Types and Functions - - Analysis Анализ - This is a workfolder that Cppcheck will use for various purposes. - Parser - Cppcheck (built in) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - Check that each class has a safe public interface - Limit analysis - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) Проверить код в неиспользуемых шаблонах - Max CTU depth Максимальная глубина CTU - Enable inline suppressions Включить inline-подавление ошибок - 2025 - Misra C++ - 2008 - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting - External tools Внешние инструменты - Up Вверх - Down Вниз - Platform Платформа - Warning options Опции предупреждений - Root path: Корневой каталог: - Warning tags (separated by semicolon) Теги предупреждений (через ';') - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) Каталог сборки Cppcheck - Libraries Библиотеки - Suppressions Подавления - Add Добавить - - Addons Дополнения - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 - Thread safety - Coding standards Стандарты кодирования - Misra C - 2012 - - 2023 - Cert C++ - Bug hunting (Premium) - Defines: Объявленные макроопределения: @@ -2798,25 +2531,21 @@ To toggle what kind of errors are shown, open view menu. - Results Результаты - Critical errors - Analysis Log Лог анализа - Warning Details Детали предупреждения @@ -2825,31 +2554,26 @@ To toggle what kind of errors are shown, open view menu. ScratchPad - Scratchpad Блокнот - Copy or write some C/C++ code here: Исходный код C/C++: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": При необходимости введите имя файла и нажмите "Проверить": - filename имя файла - Check Проверить @@ -2858,25 +2582,21 @@ To toggle what kind of errors are shown, open view menu. Settings - Preferences Параметры - General Общие - Add... Добавить... - Number of threads: Количество потоков исполнения: @@ -2886,68 +2606,57 @@ To toggle what kind of errors are shown, open view menu. - Force checking all #ifdef configurations Check all #ifdef configurations Проверять все варианты #ifdef конфигураций - Show full path of files Показывать полные пути к файлам - Show "No errors found" message when no errors found Показывать сообщение, если ошибок не найдено - Display error Id in column "Id" Отображать номер ошибки в колонке "id" - Enable inline suppressions Включить inline-подавление ошибок - Check for inconclusive errors also Показывать также спорные ошибки - Show statistics on check completion Показывать статистику после завершения проверки - Check for updates - Show internal warnings in log Показывать внутренние предупреждения в логе - Addons Дополнения - Python binary (leave this empty to use python in the PATH) Python (оставьте пустым для использования python из PATH) @@ -2955,143 +2664,117 @@ To toggle what kind of errors are shown, open view menu. - - - ... ... - MISRA addon Дополнение MISRA - MISRA rule texts file Файл с текстами правил MISRA: - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> <html><head/><body><p>Скопируйте текст из Appendix A &quot;Summary of guidelines&quot; из фала правил MISRA C 2012 pdf в текстовый файл.</p></body></html> - Clang Clang - Clang path (leave empty to use system PATH) Clang (оставьте пустым для использования clang из PATH) - Visual Studio headers Заголовочные файлы Visual Studio - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> <html><head/><body><p>Путь до заголовочных файлов Visual Studio headers, разделенных символом ';'.</p><p>Вы можете открыть командную строку Visual Studio, ввести &quot;SET INCLUDE&quot; и скопировать пути.</p></body></html> - Code Editor Редактор - Code Editor Style Оформление - System Style - Default Light Style - Default Dark Style - Custom - Remove Удалить - Max count: - Applications Приложения - - Edit... Изменить... - Set as default Установить по умолчанию - Reports Отчёты - Save all errors when creating report Сохранять все ошибки при создании отчёта - Save full path to files in reports Сохранять полные пути к файлам в отчётах - Language Язык @@ -3148,8 +2831,6 @@ To toggle what kind of errors are shown, open view menu. - - Statistics @@ -3157,135 +2838,113 @@ To toggle what kind of errors are shown, open view menu. - Project Проект - Project: Проект: - Paths: Пути: - Include paths: Включенные пути: - Defines: Объявленные макроопределения: - Undefines: Удаленные макроопределения: - Previous Scan Последнее сканирование - Path Selected: Выбранный путь: - Number of Files Scanned: Количество просканированных файлов: - Scan Duration: Продолжительность сканирования: - Errors: Ошибки: - Warnings: Предупреждения: - Stylistic warnings: Стилистические предупреждения: - Portability warnings: Предупреждения переносимости: - Performance issues: Проблемы с производительностью: - Information messages: Информационные сообщения: - Active checkers: - Checkers - History История - File: Файл: - Copy to Clipboard Скопировать в буфер обмена - Pdf Export Экспорт PDF @@ -3435,7 +3094,6 @@ To toggle what kind of errors are shown, open view menu. ThreadDetails - Thread Details diff --git a/gui/cppcheck_sr.ts b/gui/cppcheck_sr.ts index 81da0d77edf..90e08ab1a36 100644 --- a/gui/cppcheck_sr.ts +++ b/gui/cppcheck_sr.ts @@ -5,32 +5,27 @@ About - About Cppcheck About Cppcheck - Version %1 Version %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - A tool for static C/C++ code analysis. - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. - This program is licensed under the terms of the GNU General Public License version 3 This program is licensed under the terms @@ -38,13 +33,11 @@ of the GNU General Public License version 3 - Visit Cppcheck homepage at %1 Visit Cppcheck homepage at %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> @@ -54,13 +47,11 @@ of the GNU General Public License version 3 ApplicationDialog - Add an application Add a new application - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -76,25 +67,21 @@ Parameters: -l(line) (file) - &Name: - &Executable: - &Parameters: - Browse Browse @@ -139,19 +126,16 @@ Parameters: -l(line) (file) HelpDialog - Cppcheck GUI help - Contents - Index @@ -169,19 +153,16 @@ Parameters: -l(line) (file) LibraryAddFunctionDialog - Add function - Function name(s) - Number of arguments @@ -190,103 +171,86 @@ Parameters: -l(line) (file) LibraryDialog - Library Editor - Open - Save - Save as - Functions - Sort - Add - Filter: - Comments - noreturn - False - True - Unknown - return value must be used - ignore function in leaks checking - Arguments - Edit @@ -332,13 +296,11 @@ Parameters: -l(line) (file) LibraryEditArgDialog - Edit argument - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -349,13 +311,11 @@ Parameters: -l(line) (file) - Not bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -366,99 +326,78 @@ Parameters: -l(line) (file) - Not null - Not uninit - String - Format string - Min size of buffer - - Type - - None - - argvalue - - mul - - strlen - - Arg - - Arg2 - and - Valid values @@ -471,175 +410,144 @@ Parameters: -l(line) (file) - A&nalyze - Standard Standard - &File &File - &View &View - &Toolbars - C++ standard - &C standard C standard - &Edit &Edit - &License... &License... - A&uthors... A&uthors... - &About... &About... - &Files... &Files... - - Analyze files Check files - Ctrl+F Ctrl+F - &Directory... &Directory... - - Analyze directory Check directory - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop &Stop - - Stop analysis Stop checking - Esc Esc - &Save results to file... &Save results to file... - Ctrl+S Ctrl+S - &Quit &Quit - &Clear results &Clear results - &Preferences &Preferences - - Show errors @@ -647,8 +555,6 @@ Parameters: -l(line) (file) - - Show warnings @@ -656,14 +562,11 @@ Parameters: -l(line) (file) - - Show performance warnings - Show &hidden @@ -675,474 +578,394 @@ Parameters: -l(line) (file) - Show information messages - Show portability warnings - Show Cppcheck results - Clang - Show Clang results - &Filter - Filter results - Windows 32-bit ANSI Windows 32-bit ANSI - Windows 32-bit Unicode Windows 32-bit Unicode - Unix 32-bit Unix 32-bit - Unix 64-bit Unix 64-bit - Windows 64-bit Windows 64-bit - &Print... - Print the Current Report - Print Pre&view... - Open a Print Preview Dialog for the Current Results - Open library editor - &Check all &Check all - Checking for updates - Hide - - Report - Filter - &Reanalyze modified files &Recheck modified files - Reanal&yze all files - Ctrl+Q - Style war&nings - E&rrors - &Uncheck all &Uncheck all - Collapse &all Collapse &all - &Expand all &Expand all - &Standard - Standard items - Toolbar - &Categories - Error categories - &Open XML... - Open P&roject File... - Ctrl+Shift+O - Sh&ow Scratchpad... - &New Project File... - Ctrl+Shift+N - &Log View - Log View - C&lose Project File - &Edit Project File... - &Statistics - &Warnings - Per&formance warnings - &Information - &Portability - P&latforms - C++&11 - C&99 - &Posix - C&11 - &C89 - &C++03 - &Library Editor... - &Auto-detect language - &Enforce C++ - E&nforce C - C++14 C++14 - Reanalyze and check library - Check configuration (defines, includes) - C++17 C++17 - C++20 C++20 - Compliance report... - Normal - Autosar - EULA... - Thread Details - Show thread details - &Contents - Categories - - Show style warnings - Open the help contents - F1 F1 - &Help &Help @@ -1562,31 +1385,26 @@ Options: NewSuppressionDialog - New suppression - Error ID - File name - Line number - Symbol name @@ -1628,91 +1446,75 @@ Options: ProjectFile - Project File - Paths and Defines - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. - MISRA rule texts - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> - - Browse... - Analyze all Visual Studio configurations - Selected VS Configurations - Paths: - - Add... @@ -1720,9 +1522,6 @@ Options: - - - Edit @@ -1731,371 +1530,305 @@ Options: - - - - Remove - Undefines: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 - Include Paths: - Up - Down - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Platform - - Analysis - This is a workfolder that Cppcheck will use for various purposes. - Clang (experimental) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) - Max CTU depth - Max recursion in template instantiation - Warning options - Root path: - Filepaths in warnings will be relative to this path - Warning tags (separated by semicolon) - Enable inline suppressions - 2025 - Misra C++ - 2008 - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting - External tools - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) - Types and Functions - Libraries - Parser - Cppcheck (built in) - Check that each class has a safe public interface - Limit analysis - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... - Suppressions - Add - - Addons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 - Thread safety - Coding standards - Misra C - 2012 - - 2023 - Cert C++ - Bug hunting (Premium) - Defines: @@ -2699,25 +2432,21 @@ To toggle what kind of errors are shown, open view menu. - Results Results - Critical errors - Analysis Log - Warning Details @@ -2726,31 +2455,26 @@ To toggle what kind of errors are shown, open view menu. ScratchPad - Scratchpad - Copy or write some C/C++ code here: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": - filename - Check @@ -2759,91 +2483,76 @@ To toggle what kind of errors are shown, open view menu. Settings - Preferences Preferences - General General - Add... - Number of threads: Number of threads: - Force checking all #ifdef configurations Check all #ifdef configurations - Show full path of files Show full path of files - Show "No errors found" message when no errors found Show "No errors found" message when no errors found - Display error Id in column "Id" - Enable inline suppressions - Check for inconclusive errors also - Show statistics on check completion - Check for updates - Show internal warnings in log - Addons - Python binary (leave this empty to use python in the PATH) @@ -2851,143 +2560,117 @@ To toggle what kind of errors are shown, open view menu. - - - ... - MISRA addon - MISRA rule texts file - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Clang - Clang path (leave empty to use system PATH) - Visual Studio headers - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> - Code Editor - Code Editor Style - System Style - Default Light Style - Default Dark Style - Custom - Remove - Max count: - Applications Applications - - Edit... - Set as default - Reports Reports - Save all errors when creating report Save all errors when creating report - Save full path to files in reports Save full path to files in reports - Language @@ -3040,8 +2723,6 @@ To toggle what kind of errors are shown, open view menu. - - Statistics @@ -3049,135 +2730,113 @@ To toggle what kind of errors are shown, open view menu. - Project - Project: - Paths: - Include paths: - Defines: - Undefines: - Previous Scan - Path Selected: - Number of Files Scanned: - Scan Duration: - Errors: - Warnings: - Stylistic warnings: - Portability warnings: - Performance issues: - Information messages: - Active checkers: - Checkers - History - File: - Copy to Clipboard - Pdf Export @@ -3327,7 +2986,6 @@ To toggle what kind of errors are shown, open view menu. ThreadDetails - Thread Details diff --git a/gui/cppcheck_sv.ts b/gui/cppcheck_sv.ts index 80726023e09..8dee6c25010 100644 --- a/gui/cppcheck_sv.ts +++ b/gui/cppcheck_sv.ts @@ -5,32 +5,27 @@ About - About Cppcheck Om Cppcheck - Version %1 Version %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - Ett verktyg för statisk analys av C/C++ kod. - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. Copyright © 2007-2021 Cppcheck team. - This program is licensed under the terms of the GNU General Public License version 3 This program is licensed under the terms @@ -38,13 +33,11 @@ of the GNU General Public License version 3 - Visit Cppcheck homepage at %1 Hemsida: %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> @@ -54,13 +47,11 @@ of the GNU General Public License version 3 ApplicationDialog - Add an application Lägg till program - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -86,25 +77,21 @@ Parametrar: -l(line) (file) - &Name: Namn: - &Executable: Körbar fil: - &Parameters: Parametrar: - Browse Bläddra @@ -151,19 +138,16 @@ Parametrar: -l(line) (file) HelpDialog - Cppcheck GUI help - Contents - Index @@ -181,19 +165,16 @@ Parametrar: -l(line) (file) LibraryAddFunctionDialog - Add function Lägg till funktion - Function name(s) Funktion namn - Number of arguments Antal argument @@ -202,103 +183,86 @@ Parametrar: -l(line) (file) LibraryDialog - Library Editor Library Editor - Open Öppna - Save Spara - Save as Spara som - Functions Funktioner - Sort Sortera - Add Lägg till - Filter: Filter: - Comments Kommentar - noreturn noreturn - False False - True True - Unknown Vet ej - return value must be used retur värde måste användas - ignore function in leaks checking Ignorera funktionen när cppcheck letar efter läckor - Arguments Argument - Edit Redigera @@ -344,13 +308,11 @@ Parametrar: -l(line) (file) LibraryEditArgDialog - Edit argument Konfigurera argument - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -364,13 +326,11 @@ Exempel: - Not bool Ej bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -384,99 +344,78 @@ Exempel: - Not null Ej null - Not uninit Ej uninit - String Sträng - Format string Format sträng - Min size of buffer Minsta storlek för buffer - - Type Typ - - None Ingen - - argvalue argvalue - - mul mul - - strlen strlen - - Arg Arg - - Arg2 Arg2 - and och - Valid values Tillåtna värden @@ -489,175 +428,144 @@ Exempel: - A&nalyze Analysera - Standard Standard - &File &Arkiv - &View &Visa - &Toolbars Verktygsfält - C++ standard C++ standard - &C standard C standard C standard - &Edit &Redigera - &License... &Licens... - A&uthors... &Utvecklat av... - &About... &Om... - &Files... &Filer... - - Analyze files Check files Analysera filer - Ctrl+F Ctrl+F - &Directory... &Katalog... - - Analyze directory Check directory Analysera mapp - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop &Stoppa - - Stop analysis Stop checking Stoppa analys - Esc Esc - &Save results to file... &Spara resultat till fil... - Ctrl+S Ctrl+S - &Quit &Avsluta - &Clear results &Töm resultat - &Preferences &Inställningar - - Show errors Visa fel @@ -665,8 +573,6 @@ Exempel: - - Show warnings Visa varningar @@ -674,14 +580,11 @@ Exempel: - - Show performance warnings Visa prestanda varningar - Show &hidden Visa dolda @@ -693,475 +596,395 @@ Exempel: - Show information messages Visa informations meddelanden - Show portability warnings Visa portabilitets varningar - Show Cppcheck results Visa Cppcheck resultat - Clang Clang - Show Clang results Visa Clang resultat - &Filter &Filter - Filter results Filtrera resultat - Windows 32-bit ANSI Windows 32-bit ANSI - Windows 32-bit Unicode Windows 32-bit Unicode - Unix 32-bit Unix 32-bit - Unix 64-bit Unix 64-bit - Windows 64-bit Windows 64-bit - &Print... Skriv ut... - Print the Current Report Skriv ut aktuell rapport - Print Pre&view... Förhandsgranska utskrift... - Open a Print Preview Dialog for the Current Results Öppnar förhandsgranskning för nuvarande resultat - Open library editor Öppna library editor - &Check all &Kryssa alla - Checking for updates - Hide Dölj - - Report - Filter Filter - &Reanalyze modified files &Recheck modified files Analysera om ändrade filer - Reanal&yze all files Analysera om alla filer - Ctrl+Q - Style war&nings Style varningar - E&rrors Fel - &Uncheck all Kryssa &ur alla - Collapse &all Ingen bra översättning! &Fäll ihop alla - &Expand all &Expandera alla - &Standard &Standard - Standard items Standard poster - Toolbar Verktygsfält - &Categories &Kategorier - Error categories Fel kategorier - &Open XML... &Öppna XML... - Open P&roject File... Öppna Projektfil... - Ctrl+Shift+O - Sh&ow Scratchpad... Visa Scratchpad... - &New Project File... Ny projektfil... - Ctrl+Shift+N - &Log View - Log View Logg vy - C&lose Project File Stäng projektfil - &Edit Project File... Redigera projektfil... - &Statistics Statistik - &Warnings Varningar - Per&formance warnings Optimerings varningar - &Information Information - &Portability Portabilitet - P&latforms Plattformar - C++&11 C++11 - C&99 C99 - &Posix Posix - C&11 C11 - &C89 C89 - &C++03 C++03 - &Library Editor... Library Editor... - &Auto-detect language Detektera språk automatiskt - &Enforce C++ Tvinga C++ - E&nforce C Tvinga C - C++14 C++14 - Reanalyze and check library - Check configuration (defines, includes) - C++17 C++17 - C++20 C++20 - Compliance report... - Normal - Autosar - EULA... - Thread Details - Show thread details - &Contents &Innehåll - Categories Kategorier - - Show style warnings Visa stil varningar - Open the help contents Öppna hjälp - F1 F1 - &Help &Hjälp @@ -1622,31 +1445,26 @@ Options: NewSuppressionDialog - New suppression - Error ID - File name - Line number - Symbol name @@ -1688,79 +1506,65 @@ Options: ProjectFile - Project File Projektfil - Paths and Defines Sökvägar och defines - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) Importera Projekt (Visual Studio / compile database) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' Defines separeras med semicolon ';' - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. Obs: Lägg dina egna .cfg filer i samma folder som projekt filen. De skall isåfall visas ovan. - ... ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> <html><head/><body><p>Du har ett val:</p><p> * Analysera alla Debug och Release konfigurationer</p><p> * Analysera bara den första matchande Debug konfigurationen</p><p><br/></p></body></html> - - Browse... - Analyze all Visual Studio configurations Analysera alla Visual Studio konfigurationer - Selected VS Configurations - Paths: Sökvägar: - - Add... Lägg till... @@ -1768,9 +1572,6 @@ Options: - - - Edit Redigera @@ -1779,377 +1580,310 @@ Options: - - - - Remove Ta bort - Undefines: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 - Include Paths: Include sökvägar: - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - This is a workfolder that Cppcheck will use for various purposes. - Clang (experimental) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - Max recursion in template instantiation - Filepaths in warnings will be relative to this path - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files - Exclude folder... - Exclude file... - Enable inline suppressions Använd inline suppressions - Misra C - 2012 - - 2023 - 2025 - MISRA rule texts - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Misra C++ - 2008 - Cert C++ - Safety profiles (defined in C++ core guidelines) - Bug hunting (Premium) - External tools - Up Upp - Down Ned - Platform - - Analysis - Parser - Cppcheck (built in) - Check that each class has a safe public interface - Limit analysis - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) - Max CTU depth - Warning options - Root path: Bas sökväg: - Warning tags (separated by semicolon) Varnings taggar (separerade med semikolon) - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) Cppcheck build dir (whole program analys, incremental analys, statistik, etc) - Types and Functions - Libraries Libraries - Suppressions Suppressions - Add Lägg till - - Addons Addons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 Y2038 - Thread safety Tråd säkerhet - Coding standards Kodstandarder - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Bug hunting @@ -2163,7 +1897,6 @@ Options: - Defines: Defines: @@ -2802,25 +2535,21 @@ För att ställa in vilka fel som skall visas använd visa menyn. - Results Resultat - Critical errors - Analysis Log Analys Log - Warning Details Varningsdetaljer @@ -2829,31 +2558,26 @@ För att ställa in vilka fel som skall visas använd visa menyn. ScratchPad - Scratchpad Scratchpad - Copy or write some C/C++ code here: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": - filename Filnamn - Check Analysera @@ -2862,25 +2586,21 @@ För att ställa in vilka fel som skall visas använd visa menyn. Settings - Preferences Inställningar - General Allmänt - Add... Lägg till... - Number of threads: Antal trådar: @@ -2890,68 +2610,57 @@ För att ställa in vilka fel som skall visas använd visa menyn. - Force checking all #ifdef configurations Check all #ifdef configurations Kontrollera alla #ifdef konfigurationer - Show full path of files Visa den fulla sökvägen för filer - Show "No errors found" message when no errors found Visa "Inga fel hittades" meddelande när inga fel hittas - Display error Id in column "Id" Visa meddelande id i kolumn "Id" - Enable inline suppressions Använd inline suppressions - Check for inconclusive errors also Kör inconclusive analys - Show statistics on check completion Visa statistik när analys är klar - Check for updates - Show internal warnings in log Visa interna fel i loggen - Addons Addons - Python binary (leave this empty to use python in the PATH) Python binär fil (lämna tom för att använda python i PATH) @@ -2959,143 +2668,117 @@ För att ställa in vilka fel som skall visas använd visa menyn. - - - ... ... - MISRA addon - MISRA rule texts file - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Clang Clang - Clang path (leave empty to use system PATH) Clang sökväg (lämna tom för att använda PATH) - Visual Studio headers Visual Studio headers - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> <html><head/><body><p>Sökvägar till Visual Studio headers, separerade med semikolon ';'.</p><p>Du kan öppna en Visual Studio command prompt, och skriva &quot;SET INCLUDE&quot;. Sedan kopiera och klistra in sökvägarna.</p></body></html> - Code Editor - Code Editor Style - System Style - Default Light Style - Default Dark Style - Custom - Remove Ta bort - Max count: - Applications Program - - Edit... Redigera... - Set as default Sätt förvald - Reports Rapporter - Save all errors when creating report Spara alla fel - Save full path to files in reports Spara fulla sökvägar - Language Språk @@ -3152,8 +2835,6 @@ För att ställa in vilka fel som skall visas använd visa menyn. - - Statistics @@ -3161,135 +2842,113 @@ För att ställa in vilka fel som skall visas använd visa menyn. - Project Projekt - Project: Projekt: - Paths: Sökvägar: - Include paths: Include sökvägar: - Defines: Defines: - Undefines: - Previous Scan Föregående analys - Path Selected: Vald sökväg: - Number of Files Scanned: Antal analyserade filer: - Scan Duration: Analys tid: - Errors: Fel: - Warnings: Varningar: - Stylistic warnings: Stil varningar: - Portability warnings: Portabilitets varningar: - Performance issues: Prestanda varningar: - Information messages: Informations meddelanden: - Active checkers: - Checkers - History Historik - File: Fil: - Copy to Clipboard Kopiera - Pdf Export Pdf Export @@ -3439,7 +3098,6 @@ För att ställa in vilka fel som skall visas använd visa menyn. ThreadDetails - Thread Details diff --git a/gui/cppcheck_zh_CN.ts b/gui/cppcheck_zh_CN.ts index 3bc2a493818..820d12fc119 100644 --- a/gui/cppcheck_zh_CN.ts +++ b/gui/cppcheck_zh_CN.ts @@ -5,45 +5,38 @@ About - About Cppcheck 关于 Cppcheck - Version %1 版本 %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - C/C++ 静态代码分析工具。 - Copyright © 2007-%1 Cppcheck team. Copyright © 2007-2021 Cppcheck team. 版权所有 © 2007-%1 Cppcheck 团队。 - This program is licensed under the terms of the GNU General Public License version 3 该程序在 GNU 通用公共授权版本 3 的条款下发布 - Visit Cppcheck homepage at %1 访问 Cppcheck 主页: %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> @@ -53,13 +46,11 @@ of the GNU General Public License version 3 ApplicationDialog - Add an application 添加应用程序 - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -85,25 +76,21 @@ Parameters: -l(line) (file) - &Name: 名称(&N): - &Executable: 可执行文件(&E): - &Parameters: 参数(&P): - Browse 浏览 @@ -148,19 +135,16 @@ Parameters: -l(line) (file) HelpDialog - Cppcheck GUI help Cppcheck GUI 帮助 - Contents 内容 - Index 索引 @@ -178,19 +162,16 @@ Parameters: -l(line) (file) LibraryAddFunctionDialog - Add function 添加函数 - Function name(s) 函数名 - Number of arguments 参数个数 @@ -199,103 +180,86 @@ Parameters: -l(line) (file) LibraryDialog - Library Editor 库编辑器 - Open 打开 - Save 保存 - Save as 另存为 - Functions 函数 - Sort 排序 - Add 添加 - Filter: 过滤: - Comments 注释 - noreturn 无返回 - False 否 - True 是 - Unknown 未知 - return value must be used 返回值必须被使用 - ignore function in leaks checking 在泄漏检查中忽略函数 - Arguments 参数 - Edit 编辑 @@ -341,13 +305,11 @@ Parameters: -l(line) (file) LibraryEditArgDialog - Edit argument 编辑参数 - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -363,13 +325,11 @@ Parameters: -l(line) (file) - Not bool 非布尔值 - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -385,99 +345,78 @@ Parameters: -l(line) (file) - Not null 非空 - Not uninit 非未初始化 - String 字符串 - Format string 格式化字符串 - Min size of buffer 最小缓冲区大小 - - Type 类型 - - None 无 - - argvalue argvalue - - mul mul - - strlen strlen - - Arg 参数1 - - Arg2 参数2 - and 并且 - Valid values 有效值 @@ -490,189 +429,155 @@ Parameters: -l(line) (file) - &File 文件(&F) - &View 查看(&V) - &Toolbars 工具栏(&T) - &Help 帮助(&H) - C++ standard C++ 标准 - &C standard C standard &C 标准 - &Edit 编辑(&E) - Standard 标准 - Categories 分类 - &License... 许可证(&L)... - A&uthors... 作者(&U)... - &About... 关于(&A)... - &Files... 文件(&F)... - - Analyze files Check files 分析文件 - Ctrl+F Ctrl+F - &Directory... 目录(&D)... - - Analyze directory Check directory 分析目录 - Ctrl+D Ctrl+D - Ctrl+R Ctrl+R - &Stop 停止(&S) - - Stop analysis Stop checking 停止分析 - Esc Esc - &Save results to file... 保存结果到文件(&S)... - Ctrl+S Ctrl+S - &Quit 退出(&Q) - &Clear results 清空结果(&C) - &Preferences 首选项(&P) - - Show style warnings 显示风格警告 - - Show errors 显示错误 @@ -685,129 +590,107 @@ Parameters: -l(line) (file) - Show information messages 显示信息消息 - Show portability warnings 显示可移植性警告 - Show Cppcheck results 显示 Cppcheck 结果 - Clang Clang - Show Clang results 显示 Clang 结果 - &Filter 滤器(&F) - Filter results 过滤结果 - Windows 32-bit ANSI - Windows 32-bit Unicode - Unix 32-bit - Unix 64-bit - Windows 64-bit - &Print... 打印(&P)... - Print the Current Report 打印当前报告 - Print Pre&view... 打印预览(&v)... - Open a Print Preview Dialog for the Current Results 打开当前结果的打印预览窗口 - Open library editor 打开库编辑器 - C&lose Project File 关闭项目文件(&L) - &Edit Project File... 编辑项目文件(&E)... - &Statistics 统计(&S) - - Show warnings 显示警告 @@ -815,353 +698,293 @@ Parameters: -l(line) (file) - - Show performance warnings 显示性能警告 - Show &hidden 显示隐藏项(&H) - &Check all 全部选中(&C) - Checking for updates - Hide 隐藏 - - Report - A&nalyze 分析(&A) - Filter 滤器 - &Reanalyze modified files &Recheck modified files 重新分析已修改的文件(&R) - Reanal&yze all files 重新分析全部文件(&y) - Ctrl+Q Ctrl+Q - Style war&nings 风格警告(&n) - E&rrors 编辑(&r) - &Uncheck all 全部取消选中(&U) - Collapse &all 全部折叠(&A) - &Expand all 全部展开(&E) - &Standard 标准(&S) - Standard items 标准项 - &Contents 内容(&C) - Open the help contents 打开帮助内容 - F1 F1 - Toolbar 工具栏 - &Categories 分类(&C) - Error categories 错误分类 - &Open XML... 打开 XML (&O)... - Open P&roject File... 打开项目文件(&R)... - Ctrl+Shift+O Ctrl+Shift+O - Sh&ow Scratchpad... 显示便条(&o)... - &New Project File... 新建项目文件(&N)... - Ctrl+Shift+N Ctrl+Shift+N - &Log View 日志视图(&L) - Log View 日志视图 - &Warnings 警告(&W) - Per&formance warnings 性能警告(&f) - &Information 信息(&I) - &Portability 可移植性(&P) - P&latforms 平台(&l) - C++&11 C++&11 - C&99 C&99 - &Posix &Posix - C&11 C&11 - &C89 &C89 - &C++03 &C++03 - &Library Editor... 库编辑器(&L)... - &Auto-detect language 自动检测语言(&A) - &Enforce C++ &Enforce C++ - E&nforce C E&nforce C - C++14 C++14 - Reanalyze and check library 重新分析并检查库 - Check configuration (defines, includes) 检查配置(defines, includes) - C++17 C++17 - C++20 C++20 - Compliance report... - Normal 常规 - Autosar - EULA... - Thread Details - Show thread details @@ -1628,31 +1451,26 @@ Options: NewSuppressionDialog - New suppression 新建抑制 - Error ID 错误 ID - File name 文件名 - Line number 行号 - Symbol name 符号名 @@ -1674,57 +1492,48 @@ Options: ProjectFile - Project File 项目文件 - Paths and Defines 路径和定义 - Import Project (Visual studio / compile database/ Borland C++ Builder 6) Import Project (Visual studio / compile database) 导入项目 (Visual studio / compile database/ Borland C++ Builder 6) - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int Defines must be separated by a semicolon ';' 定义必须用分号分隔。例如:DEF1;DEF2=5;DEF3=int - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. 注意:把你自己的 .cfg 文件放在和项目文件相同的文件夹中。你应该在上面看到它们。 - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. 如果添加了标记,您将能够右键单击警告并设置其中一个标记。您可以手动对警告进行分类。 - Exclude source files 排除源文件 - Exclude folder... 排除文件夹... - Exclude file... 排除文件... @@ -1734,59 +1543,48 @@ Options: - MISRA rule texts MISRA 规则文本 - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> <html><head/><body><p>从 MISRA C 2012 PDF 的附录 A &quot;指南摘要&quot; 复制/粘贴文本到一个文本文件。</p></body></html> - ... ... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> <html><head/><body><p>您有一个选择:</p><p> * 分析所有的 Debug 和 Release 配置</p><p> * 只分析第一个匹配的 Debug 配置</p><p><br/></p></body></html> - - Browse... 浏览... - Analyze all Visual Studio configurations 分析全部 Visual Studio 配置 - Selected VS Configurations 已选择的 VS 配置 - Paths: 路径: - - Add... 添加... @@ -1794,9 +1592,6 @@ Options: - - - Edit 编辑 @@ -1805,341 +1600,280 @@ Options: - - - - Remove 移除 - Undefines: 未定义: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 未定义必须用分号分隔。例如:UNDEF1;UNDEF2;UNDEF3 - Include Paths: 包含目录: - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Types and Functions 类型和函数 - - Analysis 分析 - This is a workfolder that Cppcheck will use for various purposes. 这是一个 Cppcheck 将用于各种目的的工作文件夹。 - Parser 解析器 - Cppcheck (built in) Cppcheck (内建) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - Check that each class has a safe public interface 检查每个类是否有一个安全的公共接口 - Limit analysis 极限分析 - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) Check code in unused templates (slower and less accurate analysis) 检查未使用模板中的代码(正常情况下应该是打开,但理论上可以忽略未使用模板中的警告) - Max CTU depth 最大 CTU 深度 - Enable inline suppressions 启用内联方案 - 2025 - Misra C++ - 2008 - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting - External tools 外部工具 - Up 向上 - Down 向下 - Platform 平台 - Clang (experimental) Clang (实验性的) - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. 如果你想要设计你的类尽可能的灵活和健壮,那么公共接口必须非常健壮。Cppcheck 将假设参数可以取 *任何* 值。 - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) 检查头文件中的代码(通常应该是打开的。如果您想要一个有限的快速分析,那么关掉它)) - Max recursion in template instantiation 模板实例化中的最大递归 - Warning options 警告选项 - Root path: 根路径: - Filepaths in warnings will be relative to this path 警告中的文件路径将相对于此路径 - Warning tags (separated by semicolon) 警告标志(用分号隔开) - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) Cppcheck 构建目录 (整个程序分析、增量分析、统计数据等) - Libraries 库 - Suppressions 抑制 - Add 添加 - - Addons 插件 - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. 注意:插件需要安装 <a href="https://www.python.org/">Python</a>。 - Y2038 Y2038 - Thread safety 线程安全 - Coding standards 编码标准 - Misra C - 2012 - - 2023 - Cert C++ - Bug hunting (Premium) @@ -2153,7 +1887,6 @@ Options: - Defines: 定义: @@ -2696,25 +2429,21 @@ Please check the application path and parameters are correct. ResultsView - Results 结果 - Critical errors - Analysis Log 分析日志 - Warning Details 警告详情 @@ -2825,31 +2554,26 @@ To toggle what kind of errors are shown, open view menu. ScratchPad - Scratchpad 便条 - Copy or write some C/C++ code here: 在这里复制或输入一些 C/C++ 代码: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": 可选择输入文件名 (主要用来自动语言检测) 然后点击 "检查": - filename 文件名 - Check 检查 @@ -2858,25 +2582,21 @@ To toggle what kind of errors are shown, open view menu. Settings - Preferences 首选项 - General 常规 - Add... 添加... - Number of threads: 线程个数: @@ -2886,68 +2606,57 @@ To toggle what kind of errors are shown, open view menu. - Force checking all #ifdef configurations Check all #ifdef configurations 强制检查所有 #ifdef 配置 - Show full path of files 显示文件的完整路径 - Show "No errors found" message when no errors found 当未找到错误,显示“未发现错误”消息 - Display error Id in column "Id" 在列“Id”中显示错误 Id - Enable inline suppressions 启用内联方案 - Check for inconclusive errors also 检查不确定的错误 - Show statistics on check completion 检查完成后显示统计数据 - Check for updates - Show internal warnings in log 在日志中显示内建警告 - Addons 插件 - Python binary (leave this empty to use python in the PATH) Python 二进制 (留空将使用 PATH 路径中的 python) @@ -2955,143 +2664,117 @@ To toggle what kind of errors are shown, open view menu. - - - ... ... - MISRA addon MISRA 插件 - MISRA rule texts file MISRA 规则文本文件 - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> <html><head/><body><p>从 MISRA C 2012 PDF 的附录 A &quot;指南摘要&quot; 复制/粘贴文本到一个文本文件。</p></body></html> - Clang Clang - Clang path (leave empty to use system PATH) Clang 路径 (留空将使用系统 PATH 路径) - Visual Studio headers Visual Studio 头文件 - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> <html><head/><body><p>Visual Studio 头文件路径,用分号 ';' 分割。</p><p>你可以打开一个 Visual Studio 命令提示符,输入 &quot;SET INCLUDE&quot;。然后复制/粘贴路径。</p></body></html> - Code Editor 代码编辑器 - Code Editor Style 代码编辑器风格 - System Style 系统风格 - Default Light Style 默认浅色风格 - Default Dark Style 默认深色风格 - Custom 自定义 - Remove 移除 - Max count: - Applications 应用程序 - - Edit... 编辑... - Set as default 设为默认 - Reports 报告 - Save all errors when creating report 创建报告时,保存所有错误 - Save full path to files in reports 在报告中保存文件的完整路径 - Language 语言 @@ -3148,8 +2831,6 @@ To toggle what kind of errors are shown, open view menu. - - Statistics @@ -3157,135 +2838,113 @@ To toggle what kind of errors are shown, open view menu. - Project 项目 - Project: 项目: - Paths: 路径: - Include paths: 包含路径: - Defines: 定义: - Undefines: 未定义: - Previous Scan 上一次扫描 - Path Selected: 选中的路径: - Number of Files Scanned: 扫描的文件数: - Scan Duration: 扫描时间: - Errors: 错误: - Warnings: 警告: - Stylistic warnings: Stylistic 警告: - Portability warnings: 可移植性警告: - Performance issues: 性能警告: - Information messages: 信息: - Active checkers: - Checkers - History 历史 - File: 文件: - Copy to Clipboard 复制到剪贴板 - Pdf Export 导出 PDF @@ -3435,7 +3094,6 @@ To toggle what kind of errors are shown, open view menu. ThreadDetails - Thread Details diff --git a/gui/cppcheck_zh_TW.ts b/gui/cppcheck_zh_TW.ts index b1951e9f29f..029d3bb508c 100644 --- a/gui/cppcheck_zh_TW.ts +++ b/gui/cppcheck_zh_TW.ts @@ -5,31 +5,26 @@ About - About Cppcheck 關於 Cppcheck - Version %1 版本 %1 - Cppcheck - A tool for static C/C++ code analysis. Cppcheck - 一款靜態 C/C++ 程式碼分析工具。 - Copyright © 2007-%1 Cppcheck team. 著作權 © 2007-%1 Cppcheck 團隊。 - This program is licensed under the terms of the GNU General Public License version 3 該程式是根據 GNU 通用公眾授權條款第 3 版 @@ -37,13 +32,11 @@ of the GNU General Public License version 3 - Visit Cppcheck homepage at %1 訪問 Cppcheck 主頁: %1 - <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PCRE</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PicoJSON</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">TinyXML2</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Boost</li></ul></body></html> <html><head/><body><p>Many thanks to these libraries that we use:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pcre</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">picojson</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qt</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">tinyxml2</li></ul></body></html> @@ -53,13 +46,11 @@ of the GNU General Public License version 3 ApplicationDialog - Add an application 新增應用程式 - Here you can add an application that can open error files. Specify a name for the application, the application executable and command line parameters for the application. The following texts in parameters are replaced with appropriate values when application is executed: @@ -75,25 +66,21 @@ Parameters: -l(line) (file) - &Name: 名稱(&N): - &Executable: 執行檔(&E): - &Parameters: 參數(&P): - Browse 瀏覽 @@ -153,19 +140,16 @@ Parameters: -l(line) (file) HelpDialog - Cppcheck GUI help Cppcheck GUI 幫助 - Contents 內容 - Index 索引 @@ -183,19 +167,16 @@ Parameters: -l(line) (file) LibraryAddFunctionDialog - Add function 新增函式 - Function name(s) 函式名稱 - Number of arguments 引數數量 @@ -204,103 +185,86 @@ Parameters: -l(line) (file) LibraryDialog - Library Editor 程式庫編輯器 - Open 開啟 - Save 儲存 - Save as 另存為 - Functions 函式 - Sort 排序 - Add 新增 - Filter: - Comments 註釋 - noreturn - False - True - Unknown 未知 - return value must be used - ignore function in leaks checking - Arguments 引數 - Edit 編輯 @@ -344,13 +308,11 @@ Parameters: -l(line) (file) LibraryEditArgDialog - Edit argument 編輯引數 - <html><head/><body> <p>Is bool value allowed? For instance result from comparison or from '!' operator.</p> <p>Typically, set this if the argument is a pointer, size, etc.</p> @@ -361,13 +323,11 @@ Parameters: -l(line) (file) - Not bool - <html><head/><body> <p>Is a null parameter value allowed?</p> <p>Typically this should be used on any pointer parameter that does not allow null.</p> @@ -378,99 +338,78 @@ Parameters: -l(line) (file) - Not null - Not uninit - String 字串 - Format string - Min size of buffer - - Type 型別 - - None - - argvalue - - mul - - strlen - - Arg - - Arg2 - and - Valid values 有效值 @@ -483,644 +422,532 @@ Parameters: -l(line) (file) - Checking for updates 檢查更新 - Hide 隱藏 - &File 檔案(&F) - &View 檢視(&V) - &Toolbars 工具條(&T) - - Report - &Help 幫助(&H) - A&nalyze 分析(&N) - C++ standard C++ 標準 - &C standard C 標準(&C) - &Edit 編輯(&E) - Standard 標準 - Categories 分類 - Filter 篩選 - &License... 授權(&L)... - A&uthors... 作者(&U)... - &About... 關於(&A)... - &Files... 檔案(&F)... - - Analyze files 分析檔案 - Ctrl+F Ctrl+F - &Directory... 目錄(&D)... - - Analyze directory 分析目錄 - Ctrl+D Ctrl+D - &Reanalyze modified files 重新分析已修改的檔案(&R) - Ctrl+R Ctrl+R - Reanal&yze all files 重新分析所有檔案(&Y) - &Stop 停止(&S) - - Stop analysis 停止分析 - Esc Esc - &Save results to file... 儲存結果為檔案(&S)... - Ctrl+S Ctrl+S - &Quit 退出(&Q) - Ctrl+Q Ctrl+Q - &Clear results 清除結果(&C) - &Preferences 偏好設定(&P) - Style war&nings 樣式警告(&N) - - Show style warnings 顯示樣式警告 - E&rrors 錯誤(&R) - - Show errors 顯示錯誤 - &Check all 全部檢查(&C) - &Uncheck all - Collapse &all 全部摺疊(&A) - &Expand all 全部展開(&E) - &Standard 標準(&S) - Standard items 標準項目 - &Contents 內容(&C) - Open the help contents 開啟幫助內容 - F1 F1 - Toolbar 工具條 - &Categories 分類(&C) - Error categories 錯誤分類 - &Open XML... 開啟 XML(&O)... - Open P&roject File... 開啟專案檔(&R)... - Ctrl+Shift+O Ctrl+Shift+O - Sh&ow Scratchpad... - &New Project File... 新增專案檔(&N)... - Ctrl+Shift+N Ctrl+Shift+N - &Log View 日誌檢視(&L) - Log View 日誌檢視 - C&lose Project File 關閉專案檔(&L) - &Edit Project File... 編輯專案檔(&E)... - &Statistics 統計資料(&S) - &Warnings 警告(&W) - - Show warnings 顯示警告 - Per&formance warnings 效能警告(&F) - - Show performance warnings 顯示下效能警告 - Show &hidden 顯示隱藏項目(&H) - &Information 資訊(&I) - Show information messages 顯示資訊訊息 - &Portability 可移植性(&P) - Show portability warnings 顯示可移植性警告 - Show Cppcheck results 顯示 Cppcheck 結果 - Clang Clang - Show Clang results 顯示 Clang 結果 - &Filter 篩選(&F) - Filter results 篩選結果 - Windows 32-bit ANSI Windows 32 位元 ANSI - Windows 32-bit Unicode Windows 32 位元 Unicode - Unix 32-bit Unix 32 位元 - Unix 64-bit Unix 64 位元 - Windows 64-bit Windows 64 位元 - P&latforms 平臺(&L) - C++&11 C++&11 - C&99 C&99 - &Posix - C&11 C&11 - &C89 &C89 - &C++03 &C++03 - &Print... 列印(&P)... - Print the Current Report 列印當前報告 - Print Pre&view... 列印預覽(&V)... - Open a Print Preview Dialog for the Current Results 開啟當前結果的列印預覽視窗 - &Library Editor... 程式庫編輯器(&L)... - Open library editor 開啟程式庫編輯器 - &Auto-detect language 自動偵測語言(&A) - &Enforce C++ - E&nforce C - C++14 C++14 - Reanalyze and check library 重新分析並檢查程式庫 - Check configuration (defines, includes) 檢查組態 (定義、包含) - C++17 C++17 - C++20 C++20 - Compliance report... - Normal @@ -1134,25 +961,21 @@ Parameters: -l(line) (file) - Autosar - EULA... - Thread Details - Show thread details @@ -1589,31 +1412,26 @@ Do you want to remove the file from the recently used projects -list? NewSuppressionDialog - New suppression 新建抑制 - Error ID 錯誤 ID - File name 檔案名稱 - Line number 行號 - Symbol name 符號名稱 @@ -1655,59 +1473,48 @@ Do you want to remove the file from the recently used projects -list? ProjectFile - Project File 專案檔 - Paths and Defines 路徑與定義 - Import Project (Visual studio / compile database/ Borland C++ Builder 6) 匯入專案 (Visual Studio / 編譯資料庫 / Borland C++ Builder 6) - - Browse... 瀏覽... - <html><head/><body><p>You have a choice:</p><p> * Analyze all Debug and Release configurations</p><p> * Only analyze the first matching Debug configuration</p><p><br/></p></body></html> - Analyze all Visual Studio configurations 分析所有 Visual Studio 組態 - Selected VS Configurations 選取 VS 組態 - Paths: 路徑: - - Add... 新增... @@ -1715,9 +1522,6 @@ Do you want to remove the file from the recently used projects -list? - - - Edit 編輯 @@ -1726,334 +1530,274 @@ Do you want to remove the file from the recently used projects -list? - - - - Remove 移除 - Defines: 定義: - Defines must be separated by a semicolon. Example: DEF1;DEF2=5;DEF3=int - Undefines: 未定義: - Undefines must be separated by a semicolon. Example: UNDEF1;UNDEF2;UNDEF3 - Include Paths: 包含路徑: - Up - Down - Include file - <html><head/><body><p><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Force inclusion of a header file</span></p></body></html> - Browse.. - Types and Functions 型別與函式 - Platform 平臺 - Libraries 程式庫 - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. - - Analysis 分析 - Cppcheck build dir (whole program analysis, incremental analysis, statistics, etc) - This is a workfolder that Cppcheck will use for various purposes. - Parser 剖析器 - Cppcheck (built in) Cppcheck (內建) - Clang (experimental) - Check level - Reduced -- meant for usage where developer wants results directly. Limited and faster analysis with fewer results. - Normal -- meant for normal analysis in CI. Analysis should finish in reasonable time. - Exhaustive -- meant for nightly builds etc. Analysis time can be longer (10x slower than compilation is OK). - If you want to design your classes to be as flexible and robust as possible then the public interface must be very robust. Cppcheck will asumme that arguments can take *any* value. - Check that each class has a safe public interface - Limit analysis - Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) - Check code in unused templates (should be ON normally, however in theory you can safely ignore warnings in unused templates) - Max CTU depth - Max recursion in template instantiation - Warning options 警告選項 - Root path: 根路徑: - Filepaths in warnings will be relative to this path - Warning tags (separated by semicolon) 警告標記 (由分號分隔) - If tags are added, you will be able to right click on warnings and set one of these tags. You can manually categorize warnings. - Exclude source files 排除來源檔 - Exclude folder... 排除資料夾... - Exclude file... 排除檔案... - Suppressions 抑制 - Add 新增 - Enable inline suppressions - - Addons - Note: Addons require <a href="https://www.python.org/">Python</a> being installed. - Y2038 Y2038 - Thread safety 執行緒安全 - Coding standards - Misra C - 2012 - - 2023 - 2025 - Misra C++ - 2008 @@ -2063,19 +1807,16 @@ Do you want to remove the file from the recently used projects -list? - MISRA rule texts - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - ... ... @@ -2085,49 +1826,41 @@ Do you want to remove the file from the recently used projects -list? - Cert C - CERT-INT35-C: int precision (if size equals precision, you can leave empty) - Cert C++ - Autosar - Safety profiles (defined in C++ core guidelines) - Bug hunting (Premium) - Bug hunting - External tools 外部工具 @@ -2654,25 +2387,21 @@ Please check the application path and parameters are correct. ResultsView - Results 結果 - Critical errors - Analysis Log 分析日誌 - Warning Details 警告詳細資訊 @@ -2778,31 +2507,26 @@ To toggle what kind of errors are shown, open view menu. ScratchPad - Scratchpad - Copy or write some C/C++ code here: - Optionally enter a filename (mainly for automatic language detection) and click on "Check": - filename 檔案名稱 - Check @@ -2811,147 +2535,122 @@ To toggle what kind of errors are shown, open view menu. Settings - Preferences 偏好設定 - General 一般 - Number of threads: 執行緒數量: - Max count: - Force checking all #ifdef configurations - Show full path of files 顯示檔案的完整路徑 - Show "No errors found" message when no errors found - Display error Id in column "Id" - Enable inline suppressions - Check for inconclusive errors also - Show statistics on check completion - Check for updates 檢查更新 - Show internal warnings in log 顯示日誌中的內部警告 - Applications 應用程式 - Add... 新增... - - Edit... 編輯... - Remove 移除 - Set as default 設定為預設值 - Reports 報告 - Save all errors when creating report - Save full path to files in reports 在報告中儲存檔案的完整路徑 - Language 語言 - Addons - Python binary (leave this empty to use python in the PATH) @@ -2959,87 +2658,71 @@ To toggle what kind of errors are shown, open view menu. - - - ... ... - MISRA addon - MISRA rule texts file MISRA 規則文字檔 - <html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html> - Clang Clang - Clang path (leave empty to use system PATH) - Visual Studio headers Visual Studio 標頭檔 - <html><head/><body><p>Paths to Visual Studio headers, separated by semicolon ';'.</p><p>You can open a Visual Studio command prompt, write &quot;SET INCLUDE&quot;. Then copy/paste the paths.</p></body></html> - Code Editor 程式碼編輯器 - Code Editor Style 程式碼編輯器樣式 - System Style 系統樣式 - Default Light Style - Default Dark Style - Custom 自訂 @@ -3092,8 +2775,6 @@ To toggle what kind of errors are shown, open view menu. - - Statistics @@ -3101,135 +2782,113 @@ To toggle what kind of errors are shown, open view menu. - Project 專案 - Project: 專案: - Paths: 路徑: - Include paths: 包含路徑: - Defines: 定義: - Undefines: 未定義: - Previous Scan 上一次掃描 - Path Selected: 選取的路徑: - Number of Files Scanned: 已掃描的檔案數量: - Scan Duration: 掃描時間: - Errors: 錯誤: - Warnings: 警告: - Stylistic warnings: - Portability warnings: 可移植性警告: - Performance issues: 效能議題: - Information messages: 資訊訊息: - Active checkers: - Checkers - History 歷史紀錄 - File: 檔案: - Copy to Clipboard 複製到剪貼簿 - Pdf Export Pdf 匯出 @@ -3379,7 +3038,6 @@ To toggle what kind of errors are shown, open view menu. ThreadDetails - Thread Details diff --git a/lib/checktype.cpp b/lib/checktype.cpp index 447a8924360..76f73bc5700 100644 --- a/lib/checktype.cpp +++ b/lib/checktype.cpp @@ -102,7 +102,9 @@ void CheckTypeImpl::checkTooBigBitwiseShift() const ValueFlow::Value * value = tok->astOperand2()->getValueGE(lhsbits, mSettings); if (value && mSettings.isEnabled(value, false)) tooBigBitwiseShiftError(tok, lhsbits, *value); - else if (lhstype->sign == ValueType::Sign::SIGNED) { + else if (lhstype->sign == ValueType::Sign::SIGNED && Token::Match(tok, "<<|<<=")) { + // Shifting a signed value left by its width minus one bit is undefined. A right shift by + // that many bits is defined (implementation-defined for a negative value, as any right shift). value = tok->astOperand2()->getValueGE(lhsbits-1, mSettings); if (value && mSettings.isEnabled(value, false)) tooBigSignedBitwiseShiftError(tok, lhsbits, *value); diff --git a/lib/forwardanalyzer.cpp b/lib/forwardanalyzer.cpp index 88cee242c8c..46330f41e9d 100644 --- a/lib/forwardanalyzer.cpp +++ b/lib/forwardanalyzer.cpp @@ -96,6 +96,11 @@ namespace { bool hasGoto() const { return endBlock ? ForwardTraversal::hasGoto(endBlock) : false; } + Progress progress = Progress::Continue; + // The path through this branch continues past the if + bool continues() const { + return progress != Progress::Break && !isEscape(); + } }; bool stopUpdates() { @@ -332,6 +337,25 @@ namespace { return ft; } + // Another condition-fork may continue past its if: forkDepth bounds nesting, forkBudget the + // total. <0 = off. + bool canFork() const { + assert(forkBudget != nullptr); + const int depthLimit = settings().vfOptions.maxForwardConditionForkDepth; + const int budgetLimit = settings().vfOptions.maxForwardConditionForks; + return (depthLimit < 0 || forkDepth < depthLimit) && (budgetLimit < 0 || *forkBudget < budgetLimit); + } + + // A value changed in either branch is only possible past the if, on both paths. False if + // it cannot be lowered. + static bool lowerAfterBranches(Analyzer& a, const Branch& thenBranch, const Branch& elseBranch) { + if ((thenBranch.isModified() || elseBranch.isModified()) && !a.lowerToPossible()) + return false; + if ((thenBranch.isInconclusive() || elseBranch.isInconclusive()) && !a.lowerToInconclusive()) + return false; + return true; + } + std::vector tryForkScope(Token* endBlock, bool isModified = false) const { if (analyzer->updateScope(endBlock, isModified)) { ForwardTraversal ft = fork(); @@ -778,64 +802,44 @@ namespace { return Break(); } else { const bool conditional = stopOnCondition(condTok); - // The value only flows into the then-branch when the condition can split - // it; for an opaque or correlated condition (e.g. 'if (f(x))') it does - // not, so fork in analyze-only mode: the branch's effect is still tracked - // but nothing is reported in it. + // The then-path runs on a fork, the else-path on this traversal. The value only + // flows into the then-branch when the condition can split it; for an opaque or + // correlated condition (e.g. 'if (f(x))') it does not, so the fork is analyze-only: + // the branch's effect is still tracked but nothing is reported in it. ForwardTraversal ft = fork(!analyzer->updateScope(thenBranch.endBlock, false)); - // The branch is traversed below, so don't record its boundary state here. ft.analyzer->assume(condTok, true, Analyzer::Assume::Pending); - Progress pThen = ft.updateBranch(thenBranch, depth - 1); - // Merge the fork's actions so a modification in the then-branch bubbles up - // to the enclosing branch's isModified(). + thenBranch.progress = ft.updateBranch(thenBranch, depth - 1); actions |= thenBranch.action; - - // Commit the condition as false on the main path only when the then-branch - // is dead. The else block, if any, is traversed separately (Pending); with - // no else the false path continues past the closing brace, so record the - // assumed state there (None). - if (thenBranch.isDead()) - analyzer->assume(condTok, - false, - hasElse ? Analyzer::Assume::Pending : Analyzer::Assume::None); - // The else block is traversed on the main path. If it kills the value - // (modified) the main path stops, but the then-fork may still carry the - // value forward, so defer the break until after the fork continues. - Progress pElse = Progress::Continue; - if (hasElse) - pElse = updateBranch(elseBranch, depth - 1); - if (thenBranch.isDead() || elseBranch.isDead()) { - if (conditional && stopUpdates()) - pElse = Break(Analyzer::Terminate::Conditional); - } - if (thenBranch.isModified() || elseBranch.isModified()) { - if (!ft.analyzer->lowerToPossible()) - pThen = Progress::Break; - if (pElse != Progress::Break && !analyzer->lowerToPossible()) - pElse = Break(Analyzer::Terminate::Bail); + // The condition is an assumption on the else-path only if the then-path drops + // the value. With an else block the state is recorded after it. + analyzer->assume(condTok, + false, + (thenBranch.isDead() ? Analyzer::Assume::None + : Analyzer::Assume::Quiet | Analyzer::Assume::Absolute) | + (hasElse ? Analyzer::Assume::Pending : Analyzer::Assume::None)); + if (hasElse) { + elseBranch.progress = updateBranch(elseBranch, depth - 1); + if (elseBranch.progress != Progress::Break) + analyzer->updateState(elseBranch.endBlock->previous()); } - if (thenBranch.isInconclusive() || elseBranch.isInconclusive()) { - if (!ft.analyzer->lowerToInconclusive()) - pThen = Progress::Break; - if (pElse != Progress::Break && !analyzer->lowerToInconclusive()) - pElse = Break(Analyzer::Terminate::Bail); - } - if (thenBranch.hasGoto() || elseBranch.hasGoto()) { + if ((thenBranch.isDead() || elseBranch.isDead()) && conditional && stopUpdates()) + elseBranch.progress = Break(Analyzer::Terminate::Conditional); + if (!lowerAfterBranches(*ft.analyzer, thenBranch, elseBranch)) + thenBranch.progress = Progress::Break; + if (elseBranch.progress != Progress::Break && !lowerAfterBranches(*analyzer, thenBranch, elseBranch)) + elseBranch.progress = Break(Analyzer::Terminate::Bail); + if (thenBranch.hasGoto() || elseBranch.hasGoto()) return Break(Analyzer::Terminate::Bail); - } - // Carry the then-fork forward, unless a limit is hit - then only the linear main - // path continues (no bail). forkDepth bounds nesting, forkBudget total. <0 = off. - assert(forkBudget != nullptr); - const int forkDepthLimit = settings().vfOptions.maxForwardConditionForkDepth; - const int forkBudgetLimit = settings().vfOptions.maxForwardConditionForks; - const bool depthOk = forkDepthLimit < 0 || forkDepth < forkDepthLimit; - const bool budgetOk = forkBudgetLimit < 0 || *forkBudget < forkBudgetLimit; - if (pThen != Progress::Break && !thenBranch.isEscape() && depthOk && budgetOk) { + // Carry the then-path past the if. Skip the closing brace, whose handler is for + // traversals that start inside the block; re-assume to anchor the state (and the + // block's assignments) at the block end. + if (thenBranch.continues() && canFork()) { ++(*forkBudget); ++ft.forkDepth; - ft.updateRange(thenBranch.endBlock, end, depth - 1); + ft.analyzer->assume(condTok, true, Analyzer::Assume::Quiet | Analyzer::Assume::Absolute); + ft.updateRange(tok->next(), end, depth - 1); } - if (pElse == Progress::Break) { + if (elseBranch.progress == Progress::Break) { // Only the else branch escaped; the then branch falls through, so // the scope as a whole does not always escape. if (terminate == Analyzer::Terminate::Escape && !thenBranch.isEscape()) diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index 0d84dc053a8..95d977e5f26 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -32,12 +32,15 @@ #include "utils.h" #include "valueflow.h" #include "valueptr.h" +#include "vf_common.h" #include #include #include +#include #include #include +#include #include #include #include @@ -64,12 +67,89 @@ std::size_t ExprIdToken::Hash::operator()(ExprIdToken etok) const return std::hash()(etok.getExpressionId()); } +// Does the value carry its range in intvalue? +static bool isRangeValue(const ValueFlow::Value& value) +{ + return value.isIntValue() || value.isContainerSizeValue() || value.isBufferSizeValue() || value.isIteratorValue(); +} + +// A constraint that is a lower bound: the values up to the bound are impossible +static bool isLowerBound(const ValueFlow::Value& value) +{ + return value.isImpossible() && isRangeValue(value) && value.bound == ValueFlow::Value::Bound::Upper; +} + +// A constraint that is an upper bound: the values from the bound on are impossible +static bool isUpperBound(const ValueFlow::Value& value) +{ + return value.isImpossible() && isRangeValue(value) && value.bound == ValueFlow::Value::Bound::Lower; +} + +// An impossible value of the expression, without a bound +static bool isImpossiblePoint(const ValueFlow::Value& value) +{ + return value.isImpossible() && value.bound == ValueFlow::Value::Bound::Point; +} + +// Is the value (a range when it is impossible with a bound) known to be nonzero? +static bool isTrue(const ValueFlow::Value& v) +{ + if (v.isUninitValue()) + return false; + if (v.isImpossible()) { + if (v.bound == ValueFlow::Value::Bound::Point) + return v.intvalue == 0; + // An impossible range excludes zero when it lies on one side of it + return v.isLowerEdge() ? v.rangeEdge() > 0 : v.rangeEdge() < 0; + } + return v.intvalue != 0; +} + +static bool isFalse(const ValueFlow::Value& v) +{ + if (v.isUninitValue()) + return false; + if (v.isImpossible()) + return false; + return v.intvalue == 0; +} + +// Does the value satisfy the constraint of the same type? +static bool satisfies(const ValueFlow::Value& value, const ValueFlow::Value& constraint) +{ + if (isImpossiblePoint(constraint)) + return !value.equalValue(constraint); + if (isLowerBound(constraint)) + return value.intvalue >= constraint.rangeEdge(); + if (isUpperBound(constraint)) + return value.intvalue <= constraint.rangeEdge(); + return false; +} + +static bool sameValue(const ValueFlow::Value& x, const ValueFlow::Value& y) +{ + return x == y && x.bound == y.bound; +} + +// Is the value already recorded: as the value of the expression, as one of its constraints, or as +// a constraint that the recorded value satisfies? +static bool isRecorded(const ProgramMemory::Values& values, const ValueFlow::Value& value) +{ + if (values.empty() || values.front().valueType != value.valueType) + return false; + if (!value.isImpossible()) + return values.size() == 1 && sameValue(values.front(), value); + if (!values.front().isImpossible()) + return satisfies(values.front(), value); + return std::any_of(values.cbegin(), values.cend(), [&](const ValueFlow::Value& v) { + return sameValue(v, value); + }); +} + void ProgramMemory::setValue(const Token* expr, const ValueFlow::Value& value) { if (!expr) return; - copyOnWrite(); - ValueFlow::Value subvalue = value; const Token* subexpr = solveExprValue( expr, @@ -82,19 +162,62 @@ void ProgramMemory::setValue(const Token* expr, const ValueFlow::Value& value) { return {}; }, subvalue); + if (expr != subexpr) - (*mValues)[expr] = value; + record(expr, value); if (subexpr) - (*mValues)[subexpr] = std::move(subvalue); + record(subexpr, subvalue); +} + +void ProgramMemory::record(const Token* expr, const ValueFlow::Value& value) +{ + const Values* existing = getValues(expr->exprId()); + if (existing && isRecorded(*existing, value)) + return; + copyOnWrite(); + Values& values = (*mValues)[expr]; + // A value of the expression, a first value, a value of another type or a constraint that the + // recorded value violates replaces what is recorded. A constraint joins the recorded constraints, + // merged the way Token::addValue() merges values: weaker bounds are dropped and an impossible + // value next to a bound moves the bound past it. + if (!value.isImpossible() || values.empty() || values.front().valueType != value.valueType || + !values.front().isImpossible()) { + values.assign(1, value); + } else { + if (values.size() >= ValueFlow::maxValues) + return; + values.push_back(value); + Token::removeContradictions(values); + } +} + +void ProgramMemory::setValues(const Token* expr, const Values& values) +{ + for (const ValueFlow::Value& value : values) + setValue(expr, value); +} + +// The value of the expression when it has exactly one, else nullptr. A constraint counts only when +// asked for. +static const ValueFlow::Value* singleValue(const ProgramMemory::Values& values, bool impossible) +{ + if (values.size() != 1 || (!impossible && values.front().isImpossible())) + return nullptr; + return &values.front(); } const ValueFlow::Value* ProgramMemory::getValue(nonneg int exprid, bool impossible) const +{ + const Values* values = getValues(exprid); + return values ? singleValue(*values, impossible) : nullptr; +} + +const ProgramMemory::Values* ProgramMemory::getValues(nonneg int exprid) const { const auto it = find(exprid); - const bool found = it != mValues->cend() && (impossible || !it->second.isImpossible()); - if (found) - return &it->second; - return nullptr; + if (it == mValues->cend()) + return nullptr; + return &it->second; } bool ProgramMemory::getIntValue(nonneg int exprid, MathLib::bigint& result) const @@ -135,20 +258,33 @@ bool ProgramMemory::getContainerSizeValue(nonneg int exprid, MathLib::bigint& re } return false; } -bool ProgramMemory::getContainerEmptyValue(nonneg int exprid, MathLib::bigint& result) const + +// Is the container empty according to its recorded size values? Unknown if they do not decide it. +static ValueFlow::Value containerEmptyValue(const ProgramMemory::Values& values) { - const ValueFlow::Value* value = getValue(exprid, true); - if (value && value->isContainerSizeValue()) { - if (value->isImpossible() && value->intvalue == 0) { - result = false; - return true; - } - if (!value->isImpossible()) { - result = (value->intvalue == 0); - return true; - } + for (const ValueFlow::Value& value : values) { + if (!value.isContainerSizeValue()) + continue; + if (!value.isImpossible()) + return ValueFlow::Value{value.intvalue == 0}; + if (isUpperBound(value) && value.rangeEdge() <= 0) + return ValueFlow::Value{1}; + if (isTrue(value)) + return ValueFlow::Value{0}; } - return false; + return ValueFlow::Value::unknown(); +} + +bool ProgramMemory::getContainerEmptyValue(nonneg int exprid, MathLib::bigint& result) const +{ + const Values* values = getValues(exprid); + if (!values) + return false; + const ValueFlow::Value isEmpty = containerEmptyValue(*values); + if (isEmpty.isUninitValue()) + return false; + result = isEmpty.intvalue; + return true; } void ProgramMemory::setContainerSizeValue(const Token* expr, MathLib::bigint value, bool equal) @@ -163,7 +299,7 @@ void ProgramMemory::setContainerSizeValue(const Token* expr, MathLib::bigint val void ProgramMemory::setUnknown(const Token* expr) { copyOnWrite(); - (*mValues)[expr].valueType = ValueFlow::Value::ValueType::UNINIT; + (*mValues)[expr].assign(1, ValueFlow::Value::unknown()); } bool ProgramMemory::hasValue(nonneg int exprid) const @@ -172,7 +308,7 @@ bool ProgramMemory::hasValue(nonneg int exprid) const return it != mValues->cend(); } -const ValueFlow::Value& ProgramMemory::at(nonneg int exprid) const { +const ProgramMemory::Values& ProgramMemory::at(nonneg int exprid) const { const auto it = find(exprid); if (it == mValues->cend()) { throw std::out_of_range("ProgramMemory::at"); @@ -180,7 +316,7 @@ const ValueFlow::Value& ProgramMemory::at(nonneg int exprid) const { return it->second; } -ValueFlow::Value& ProgramMemory::at(nonneg int exprid) { +ProgramMemory::Values& ProgramMemory::at(nonneg int exprid) { copyOnWrite(); const auto it = find(exprid); @@ -226,18 +362,26 @@ bool ProgramMemory::empty() const return mValues->empty(); } +// Is the expression recorded as modified with an unknown value? +static bool isUnknown(const ProgramMemory::Values& values) +{ + return !values.empty() && values.front().isUninitValue(); +} + // NOLINTNEXTLINE(performance-unnecessary-value-param) - technically correct but we are moving the given values void ProgramMemory::replace(ProgramMemory pm, bool skipUnknown) { - if (pm.empty()) + if (pm.empty() || mValues == pm.mValues) return; copyOnWrite(); + // The given memory may share its values with other memories; they must not be moved out from under them + pm.copyOnWrite(); for (auto&& p : (*pm.mValues)) { if (skipUnknown) { auto it = mValues->find(p.first); - if (it != mValues->end() && it->second.isUninitValue()) + if (it != mValues->end() && isUnknown(it->second)) continue; } (*mValues)[p.first] = std::move(p.second); @@ -268,6 +412,12 @@ static ValueFlow::Value execute(const Token* expr, const Settings& settings, const ProgramMemory::Map& vars = {}); +// All values of the expression: the constraints of a range, or the single result of execute() +static ProgramMemory::Values executeValues(const Token* expr, + ProgramMemory& pm, + const Settings& settings, + const ProgramMemory::Map& vars = {}); + static bool evaluateCondition(MathLib::bigint r, const Token* condition, ProgramMemory& pm, @@ -301,29 +451,30 @@ static bool frontIs(const std::vector& v, bool i) return !i; } -static bool isTrue(const ValueFlow::Value& v) +static bool isTrueOrFalse(const ValueFlow::Value& v, bool b) { - if (v.isUninitValue()) - return false; - if (v.isImpossible()) - return v.intvalue == 0; - return v.intvalue != 0; + if (b) + return isTrue(v); + return isFalse(v); } -static bool isFalse(const ValueFlow::Value& v) +// Is the expression with these values known to be nonzero? It is when its value is, or when one of +// its constraints excludes zero. +static bool isTrue(const ProgramMemory::Values& values) { - if (v.isUninitValue()) - return false; - if (v.isImpossible()) - return false; - return v.intvalue == 0; + return std::any_of(values.cbegin(), values.cend(), [](const ValueFlow::Value& v) { + return isTrue(v); + }); } -static bool isTrueOrFalse(const ValueFlow::Value& v, bool b) +static bool isFalse(const ProgramMemory::Values& values) { - if (b) - return isTrue(v); - return isFalse(v); + return !values.empty() && isFalse(values.front()); +} + +static bool isTrueOrFalse(const ProgramMemory::Values& values, bool b) +{ + return b ? isTrue(values) : isFalse(values); } // If the scope is a non-range for loop @@ -382,11 +533,17 @@ static void programMemoryParseCondition(ProgramMemory& pm, if (endTok && changed(vartok, tok->next(), endTok)) return; const bool impossible = (tok->str() == "==" && !then) || (tok->str() == "!=" && then); - const ValueFlow::Value& v = then ? truevalue : falsevalue; - pm.setValue(vartok, impossible ? asImpossible(v) : v); + ValueFlow::Value& v = then ? truevalue : falsevalue; + // A value with a bound is a range: record it as the range of impossible values so that it + // constrains the expression instead of standing in for its value. + if (impossible || v.bound != ValueFlow::Value::Bound::Point) + v = asImpossible(std::move(v)); + pm.setValue(vartok, v); const Token* containerTok = settings.library.getContainerFromYield(vartok, Library::Container::Yield::SIZE); - if (containerTok) - pm.setContainerSizeValue(containerTok, v.intvalue, !impossible); + if (containerTok) { + v.valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE; + pm.setValue(containerTok, v); + } } else if (Token::simpleMatch(tok, "!")) { programMemoryParseCondition(pm, tok->astOperand1(), endTok, settings, !then, findChanged); } else if (then && Token::simpleMatch(tok, "&&")) { @@ -459,7 +616,11 @@ static void fillProgramMemoryFromAssignments(ProgramMemory& pm, const Token* tok const Token* valuetok = tok2->astOperand2(); ProgramMemory local = state; // Tracked values are substituted by execute() when the expression is evaluated. - pm.setValue(vartok, execute(valuetok, local, settings, vars)); + const ProgramMemory::Values values = executeValues(valuetok, local, settings, vars); + if (values.empty()) + pm.setUnknown(vartok); + else + pm.setValues(vartok, values); } } else if (Token::simpleMatch(tok2, ")") && tok2->link() && Token::Match(tok2->link()->previous(), "assert|ASSERT ( !!)")) { @@ -544,10 +705,8 @@ void ProgramMemoryState::replace(ProgramMemory pm, const Token* origin) static void addVars(ProgramMemory& pm, const ProgramMemory::Map& vars) { - for (const auto& p:vars) { - const ValueFlow::Value &value = p.second; - pm.setValue(p.first.tok, value); - } + for (const auto& p:vars) + pm.setValues(p.first.tok, p.second); } void ProgramMemoryState::addState(const Token* tok, const ProgramMemory::Map& vars) @@ -576,6 +735,9 @@ void ProgramMemoryState::assume(const Token* tok, bool b, bool isEmpty, const To origin = top->link()->next(); if (!b && origin->link()) { origin = origin->link(); + // The false path runs the else block + if (Token::simpleMatch(origin, "} else {")) + origin = origin->tokAt(2); } } } @@ -624,6 +786,9 @@ void ProgramMemoryState::removeModifiedVars(const Token* tok) const auto findChanged = getCachedFindExpressionChanged(/*skipDeadCode*/ true); state.erase_if([&](const ExprIdToken& e) { const Token* start = origins[e.getExpressionId()]; + // The then-path skips the else block + if (Token::simpleMatch(start, "} else {")) + start = start->linkAt(2); const Token* expr = e.tok; const bool changed = !expr || findChanged(expr, start, tok); if (changed) @@ -658,7 +823,7 @@ ProgramMemory getProgramMemory(const Token* tok, const Token* expr, const ValueF fillProgramMemoryFromConditions(programMemory, tok, settings); programMemory.setValue(expr, value); const ProgramMemory state = programMemory; - fillProgramMemoryFromAssignments(programMemory, tok, settings, state, {{expr, value}}); + fillProgramMemoryFromAssignments(programMemory, tok, settings, state, {{expr, {value}}}); return programMemory; } @@ -691,21 +856,132 @@ static bool isIntegralValue(const ValueFlow::Value& value) return value.isIntValue() || value.isIteratorValue() || value.isSymbolicValue(); } -static ValueFlow::Value evaluate(const Token* op, const ValueFlow::Value& lhs, const ValueFlow::Value& rhs, bool removeAssign = false) +static bool isBounded(const ValueFlow::Value& value) +{ + return value.bound != ValueFlow::Value::Bound::Point; +} + +static bool addOverflows(MathLib::bigint x, MathLib::bigint y) +{ + if (y > 0) + return x > std::numeric_limits::max() - y; + return x < std::numeric_limits::min() - y; +} + +static bool subtractOverflows(MathLib::bigint x, MathLib::bigint y) +{ + if (y < 0) + return x > std::numeric_limits::max() + y; + return x < std::numeric_limits::min() + y; +} + +static bool multiplyOverflows(MathLib::bigint x, MathLib::bigint y) +{ + if (x == 0 || y == 0) + return false; + if (ValueFlow::isSaturated(x) || ValueFlow::isSaturated(y)) + return true; + return std::abs(x) > std::numeric_limits::max() / std::abs(y); +} + +// Is the left shift not defined, or does its result not fit? +static bool shiftOverflows(MathLib::bigint x, MathLib::bigint shift) +{ + if (x < 0 || shift < 0 || shift >= MathLib::bigint_bits - 1) + return true; + const MathLib::biguint limit = static_cast(std::numeric_limits::max()) >> + static_cast(shift); + return static_cast(x) > limit; +} + +// The operations that keep the order of the values of a range +static bool isMonotone(const std::string& op) +{ + return contains({"+", "-", "*", "/", "<<", ">>"}, op); +} + +static bool isComparison(const std::string& op) +{ + return contains({"==", "!=", "<", ">", "<=", ">="}, op); +} + +static bool isArithmetical(const std::string& op) +{ + return contains({"+", "-", "*", "/", "%", "<<", ">>"}, op); +} + +// "x y" for the operations that keep the order of the values; unknown when the operation is not +// defined or its result does not fit the analyzer's integers, which calculate() does not check. +// Unlike calculate(), a division by a negative value is allowed. +static ValueFlow::Value applyOp(const std::string& op, MathLib::bigint x, MathLib::bigint y) +{ + if (ValueFlow::isSaturated(x) || ValueFlow::isSaturated(y)) + return ValueFlow::Value::unknown(); + bool error = false; + if (op == "+") + error = addOverflows(x, y); + else if (op == "-") + error = subtractOverflows(x, y); + else if (op == "*") + error = multiplyOverflows(x, y); + else if (op == "/") + return y == 0 ? ValueFlow::Value::unknown() : ValueFlow::Value{x / y}; + else if (op == "<<") + error = shiftOverflows(x, y); + else if (op != ">>") + return ValueFlow::Value::unknown(); + if (error) + return ValueFlow::Value::unknown(); + const MathLib::bigint result = calculate(op, x, y, &error); + return error ? ValueFlow::Value::unknown() : ValueFlow::Value{result}; +} + +// The range of "x k" (or "k x") when the values of x up to (or from) the bound are +// impossible: the end of the range is transformed; an operation that reverses the order of the +// values turns the range around. +static ValueFlow::Value applyToRange(const std::string& op, const ValueFlow::Value& range, MathLib::bigint k, bool rangeIsLhs) +{ + // A bound at the limit of the type has no edge beyond it + if (ValueFlow::isSaturated(range.intvalue)) + return ValueFlow::Value::unknown(); + // Scaling by zero collapses the range; dividing or shifting by the range does not keep the order + if (((op == "*" || op == "/") && k == 0) || (!rangeIsLhs && contains({"/", "<<", ">>"}, op))) + return ValueFlow::Value::unknown(); + const MathLib::bigint edge = range.rangeEdge(); + const ValueFlow::Value result = applyOp(op, rangeIsLhs ? edge : k, rangeIsLhs ? k : edge); + if (result.isUninitValue()) + return ValueFlow::Value::unknown(); + const bool increasing = op == "-" ? rangeIsLhs : !((op == "*" || op == "/") && k < 0); + ValueFlow::Value scaled = range; + if (!scaled.setRangeEdge(result.intvalue, range.isLowerEdge() == increasing)) + return ValueFlow::Value::unknown(); + return scaled; +} + +static ValueFlow::Value evaluate(const std::string& opStr, const ValueFlow::Value& lhs, const ValueFlow::Value& rhs) { - const std::string opStr = removeAssign ? op->str().substr(0, op->str().size() - 1) : op->str(); ValueFlow::Value result; if (lhs.isImpossible() && rhs.isImpossible()) return ValueFlow::Value::unknown(); + // An impossible range and an int: the range of the result, for the operations that keep the order + const bool rangeIsLhs = lhs.isImpossible() && isBounded(lhs); + const ValueFlow::Value& range = rangeIsLhs ? lhs : rhs; + const ValueFlow::Value& k = rangeIsLhs ? rhs : lhs; + if (range.isImpossible() && isBounded(range) && range.isIntValue() && !k.isImpossible() && !isBounded(k) && + k.isIntValue() && isMonotone(opStr)) + return applyToRange(opStr, range, k.intvalue, rangeIsLhs); if (lhs.isImpossible() || rhs.isImpossible()) { - // noninvertible - if (contains({"%", "/", "&", "|"}, opStr)) + // The image of an impossible value is impossible only for an injective operation + if (contains({"%", "/", "&", "|", ">>"}, opStr)) + return ValueFlow::Value::unknown(); + const ValueFlow::Value& factor = lhs.isImpossible() ? rhs : lhs; + if (opStr == "*" && factor.equalTo(0)) return ValueFlow::Value::unknown(); result.setImpossible(); } if (isNumericValue(lhs) && isNumericValue(rhs)) { if (lhs.isFloatValue() || rhs.isFloatValue()) { - result.valueType = op->isArithmeticalOp() ? ValueFlow::Value::ValueType::FLOAT : ValueFlow::Value::ValueType::INT; + result.valueType = isArithmetical(opStr) ? ValueFlow::Value::ValueType::FLOAT : ValueFlow::Value::ValueType::INT; bool error = false; result.floatValue = calculate(opStr, asFloat(lhs), asFloat(rhs), &error); if (error) @@ -719,7 +995,7 @@ static ValueFlow::Value evaluate(const Token* op, const ValueFlow::Value& lhs, c // If not the same type then one must be int if (lhs.valueType != rhs.valueType && !lhs.isIntValue() && !rhs.isIntValue()) return ValueFlow::Value::unknown(); - const bool compareOp = op->isComparisonOp(); + const bool compareOp = isComparison(opStr); // Comparison must be the same type if (compareOp && lhs.valueType != rhs.valueType) return ValueFlow::Value::unknown(); @@ -741,10 +1017,18 @@ static ValueFlow::Value evaluate(const Token* op, const ValueFlow::Value& lhs, c } else { result.valueType = ValueFlow::Value::ValueType::INT; } - bool error = false; - result.intvalue = calculate(opStr, lhs.intvalue, rhs.intvalue, &error); - if (error) - return ValueFlow::Value::unknown(); + if (lhs.isIntValue() && rhs.isIntValue() && contains({"+", "-", "*", "<<"}, opStr)) { + // These overflow silently in calculate() + const ValueFlow::Value r = applyOp(opStr, lhs.intvalue, rhs.intvalue); + if (r.isUninitValue()) + return ValueFlow::Value::unknown(); + result.intvalue = r.intvalue; + } else { + bool error = false; + result.intvalue = calculate(opStr, lhs.intvalue, rhs.intvalue, &error); + if (error) + return ValueFlow::Value::unknown(); + } if (result.isImpossible() && opStr == "!=") { if (isTrue(result)) { result.intvalue = 1; @@ -1358,6 +1642,8 @@ static void pruneConditions(std::vector& conds, namespace { struct Executor { + using Values = ProgramMemory::Values; + ProgramMemory* pm; RefThunk settings; // Values tracked by the forward/reverse analysis. A tracked value is the authoritative @@ -1371,8 +1657,8 @@ namespace { assert(pm != nullptr); } - // Is the tracked value for this expression available? - const ValueFlow::Value* getTrackedValue(const Token* expr) const + // The tracked values for this expression, if there are any + const Values* getTrackedValues(const Token* expr) const { if (!vars || expr->exprId() == 0) return nullptr; @@ -1387,7 +1673,7 @@ namespace { if (!vars || vars->empty()) return false; return findAstNode(expr, [&](const Token* tok) { - return getTrackedValue(tok) != nullptr; + return getTrackedValues(tok) != nullptr; }) != nullptr; } @@ -1395,17 +1681,134 @@ namespace { return ValueFlow::Value::unknown(); } + // The one value to read for an expression: its value, or the first of its constraints (every + // one of them holds for the expression) + static ValueFlow::Value representative(const Values& values) + { + return values.empty() ? unknown() : values.front(); + } + + // The values of an expression that has the one value; none when it is unknown + static Values single(ValueFlow::Value value) + { + Values values; + if (!value.isUninitValue()) + values.push_back(std::move(value)); + return values; + } + + // Are the values constraints, rather than the one value of the expression? + static bool isConstraints(const Values& values) + { + return !values.empty() && values.front().isImpossible(); + } + + // The value of a condition: constraints that exclude zero are true, a value stands for itself + static ValueFlow::Value conditionValue(Values values) + { + if (isConstraints(values) && isTrue(values)) + return ValueFlow::Value{1}; + return values.empty() ? unknown() : std::move(values.front()); + } + + // Forget the values of a variable that was changed in an unknown way + static Values forget(Values& values) + { + values.assign(1, unknown()); + return {}; + } + + // The values recorded for the expression, when it is read from the program memory: it has no + // known value and does not depend on a tracked value + const Values* getStoredValues(const Token* expr) const + { + if (expr->exprId() == 0) + return nullptr; + const Values* stored = pm->getValues(expr->exprId()); + if (!stored || expr->hasKnownIntValue() || dependsOnTrackedValue(expr)) + return nullptr; + return stored; + } + + // The values of the expression as given by its symbolic values that the predicate accepts: the + // values of the expression a symbolic value refers to, moved by its offset + template + Values resolveSymbolicValues(const Token* expr, Predicate accept) const + { + Values result; + for (const ValueFlow::Value& value : expr->values()) { + if (!value.isSymbolicValue() || !accept(value) || !value.tokvalue || value.tokvalue->exprId() == 0) + continue; + const Values* stored = pm->getValues(value.tokvalue->exprId()); + // Only int values can be moved by an offset + if (!stored || isUnknown(*stored) || (value.intvalue != 0 && !stored->front().isIntValue())) + continue; + for (const ValueFlow::Value& v : *stored) { + if (addOverflows(v.intvalue, value.intvalue)) + continue; + result.push_back(v); + result.back().intvalue += value.intvalue; + } + if (!result.empty()) + return result; + } + return result; + } + + // Does "x k" (or "k x", when the range is the right operand) wrap around in the + // unsigned type of the expression for some value x that the values allow? As the operations + // keep the order of the values, the ends of their range are checked. A signed expression does + // not wrap: its overflow is undefined. + bool mayWrap(const Values& values, const Token* expr, const std::string& op, MathLib::bigint k, bool rangeIsLhs = true) const + { + if (!astIsUnsigned(expr)) + return false; + MathLib::bigint typeMin = 0; + MathLib::bigint typeMax = 0; + if (!ValueFlow::getMinMaxValues(expr->valueType(), settings().platform, typeMin, typeMax)) + return true; + const std::vector low = getMinValue(makeIntegralInferModel(), values); + const std::vector high = getMaxValue(makeIntegralInferModel(), values); + const MathLib::bigint ends[] = {low.empty() ? typeMin : low.front(), high.empty() ? typeMax : high.front()}; + return std::any_of(std::begin(ends), std::end(ends), [&](MathLib::bigint end) { + const ValueFlow::Value r = applyOp(op, rangeIsLhs ? end : k, rangeIsLhs ? k : end); + return r.isUninitValue() || r.intvalue < typeMin || r.intvalue > typeMax; + }); + } + + // Apply "lhs = delta" to every value of the variable. The variable is forgotten when the + // operation cannot be applied to a value or the unsigned type may wrap around. + Values applyToValues(Values& lhs, const Token* lhsTok, const std::string& op, const ValueFlow::Value& delta) const + { + if (delta.isIntValue() && mayWrap(lhs, lhsTok, op, delta.intvalue)) + return forget(lhs); + for (ValueFlow::Value& v : lhs) { + const ValueFlow::Value r = evaluate(op, v, delta); + if (r.isUninitValue()) + return forget(lhs); + if (v.isIntValue()) + ValueFlow::Value::visitValue(r, std::bind(assign{}, std::ref(v.intvalue), std::placeholders::_1)); + else if (v.isFloatValue()) + ValueFlow::Value::visitValue(r, std::bind(assign{}, std::ref(v.floatValue), std::placeholders::_1)); + else + return {}; + // The operation may have turned the range around or dissolved it + v.bound = r.bound; + } + return lhs; + } + std::unordered_map executeAll(const std::vector& toks, const bool* b = nullptr) const { std::unordered_map result; auto state = *this; for (const Token* tok : toks) { - ValueFlow::Value r = state.execute(tok); - if (r.isUninitValue()) + Values r = state.execute(tok); + if (r.empty()) continue; const bool brk = b && isTrueOrFalse(r, *b); - result.emplace(tok->exprId(), std::move(r)); + result.emplace(tok->exprId(), conditionValue(std::move(r))); // Short-circuit evaluation if (brk) break; @@ -1430,23 +1833,22 @@ namespace { ValueFlow::Value executeMultiCondition(bool b, const Token* expr) { - if (pm->hasValue(expr->exprId())) { - const ValueFlow::Value& v = utils::as_const(*pm).at(expr->exprId()); - if (v.isIntValue()) - return v; + if (const ValueFlow::Value* v = pm->getValue(expr->exprId(), /*impossible*/ true)) { + if (v->isIntValue()) + return *v; } // Evaluate recursively if there are no exprids if ((expr->astOperand1() && expr->astOperand1()->exprId() == 0) || (expr->astOperand2() && expr->astOperand2()->exprId() == 0)) { - ValueFlow::Value lhs = execute(expr->astOperand1()); + Values lhs = execute(expr->astOperand1()); if (isTrueOrFalse(lhs, b)) - return lhs; - ValueFlow::Value rhs = execute(expr->astOperand2()); + return conditionValue(std::move(lhs)); + Values rhs = execute(expr->astOperand2()); if (isTrueOrFalse(rhs, b)) - return rhs; + return conditionValue(std::move(rhs)); if (isTrueOrFalse(lhs, !b) && isTrueOrFalse(rhs, !b)) - return lhs; + return conditionValue(std::move(lhs)); return unknown(); } @@ -1478,7 +1880,9 @@ namespace { const Token* tok = p.first.tok; if (!tok) continue; - const ValueFlow::Value& value = p.second; + if (p.second.size() != 1) + continue; + const ValueFlow::Value& value = p.second.front(); if (tok->str() == expr->str() && !astHasExpr(tok, expr->exprId())) { // TODO: Handle when it is greater @@ -1513,117 +1917,99 @@ namespace { return unknown(); } - // Get the size of the container. If the container itself is not tracked in the program - // memory then check if it is symbolically equal to a container whose size is tracked. - ValueFlow::Value executeContainerSize(const Token* containerTok) + // The container size values among the values + static Values containerSizeValues(Values values) { - ValueFlow::Value v = execute(containerTok); - if (v.isContainerSizeValue()) - return v; - for (const ValueFlow::Value& value : containerTok->values()) { - if (!value.isSymbolicValue()) - continue; - if (value.isImpossible()) - continue; - if (value.intvalue != 0) - continue; - if (!value.tokvalue) - continue; - if (value.tokvalue->exprId() == 0) - continue; - const ValueFlow::Value* sizeValue = pm->getValue(value.tokvalue->exprId()); - if (sizeValue && sizeValue->isContainerSizeValue()) - return *sizeValue; - } - return unknown(); + values.remove_if([](const ValueFlow::Value& v) { + return !v.isContainerSizeValue(); + }); + return values; + } + + // Get the size values of the container. If the container itself is not tracked in the + // program memory then check if it is symbolically equal to a container whose size is tracked. + Values executeContainerSizes(const Token* containerTok) + { + Values sizes = containerSizeValues(execute(containerTok)); + if (!sizes.empty()) + return sizes; + return containerSizeValues(resolveSymbolicValues(containerTok, [](const ValueFlow::Value& v) { + return !v.isImpossible() && v.intvalue == 0; + })); + } + + // The size values of the container, as ints + Values executeSizeYield(const Token* containerTok) + { + Values sizes = executeContainerSizes(containerTok); + for (ValueFlow::Value& v : sizes) + v.valueType = ValueFlow::Value::ValueType::INT; + return sizes; } - ValueFlow::Value executeImpl(const Token* expr) + // The values of the expression: its one value, or the constraints it is known to satisfy + Values executeImpl(const Token* expr) { const ValueFlow::Value* value = nullptr; if (!expr) - return unknown(); + return {}; if (expr->hasKnownIntValue() && !expr->isAssignmentOp() && expr->str() != ",") - return *expr->getKnownValue(ValueFlow::Value::ValueType::INT); + return single(*expr->getKnownValue(ValueFlow::Value::ValueType::INT)); if ((value = expr->getKnownValue(ValueFlow::Value::ValueType::FLOAT)) || (value = expr->getKnownValue(ValueFlow::Value::ValueType::TOK)) || (value = expr->getKnownValue(ValueFlow::Value::ValueType::ITERATOR_START)) || (value = expr->getKnownValue(ValueFlow::Value::ValueType::ITERATOR_END)) || (value = expr->getKnownValue(ValueFlow::Value::ValueType::CONTAINER_SIZE))) { - return *value; + return single(*value); } if (expr->isNumber()) { if (MathLib::isFloat(expr->str())) - return unknown(); + return {}; MathLib::bigint i = MathLib::toBigNumber(expr); if (i < 0 && astIsUnsigned(expr)) - return unknown(); - return ValueFlow::Value{i}; + return {}; + return single(ValueFlow::Value{i}); } if (expr->isBoolean()) - return ValueFlow::Value{expr->str() == "true"}; - if (Token::Match(expr->tokAt(-2), ". %name% (") && astIsContainer(expr->tokAt(-2)->astOperand1())) { - const Token* containerTok = expr->tokAt(-2)->astOperand1(); - const Library::Container::Yield yield = containerTok->valueType()->container->getYield(expr->strAt(-1)); - if (yield == Library::Container::Yield::SIZE) { - ValueFlow::Value v = executeContainerSize(containerTok); - if (!v.isContainerSizeValue()) - return unknown(); - v.valueType = ValueFlow::Value::ValueType::INT; - return v; - } - if (yield == Library::Container::Yield::EMPTY) { - ValueFlow::Value v = executeContainerSize(containerTok); - if (!v.isContainerSizeValue()) - return unknown(); - if (v.isImpossible() && v.intvalue == 0) - return ValueFlow::Value{0}; - if (!v.isImpossible()) - return ValueFlow::Value{v.intvalue == 0}; - } + return single(ValueFlow::Value{expr->str() == "true"}); + if (const Token* containerTok = settings().library.getContainerFromYield(expr, Library::Container::Yield::SIZE)) { + return executeSizeYield(containerTok); + } + if (const Token* containerTok = settings().library.getContainerFromYield(expr, Library::Container::Yield::EMPTY)) { + const ValueFlow::Value v = containerEmptyValue(executeContainerSizes(containerTok)); + if (!v.isUninitValue()) + return single(v); } else if (expr->isAssignmentOp() && expr->astOperand1() && expr->astOperand2() && expr->astOperand1()->exprId() > 0) { - ValueFlow::Value rhs = execute(expr->astOperand2()); - if (rhs.isUninitValue()) - return unknown(); + Values rhs = execute(expr->astOperand2()); + if (rhs.empty()) + return {}; if (expr->str() != "=") { if (!pm->hasValue(expr->astOperand1()->exprId())) - return unknown(); - ValueFlow::Value& lhs = pm->at(expr->astOperand1()->exprId()); - rhs = evaluate(expr, lhs, rhs, /*removeAssign*/ true); - if (lhs.isIntValue()) - ValueFlow::Value::visitValue(rhs, std::bind(assign{}, std::ref(lhs.intvalue), std::placeholders::_1)); - else if (lhs.isFloatValue()) - ValueFlow::Value::visitValue(rhs, - std::bind(assign{}, std::ref(lhs.floatValue), std::placeholders::_1)); - else - return unknown(); - return lhs; + return {}; + // Applied with the one value of the right hand side; its constraints make the result unknown + return applyToValues(pm->at(expr->astOperand1()->exprId()), + expr->astOperand1(), + expr->str().substr(0, expr->str().size() - 1), + rhs.front()); } - pm->setValue(expr->astOperand1(), rhs); + pm->setValues(expr->astOperand1(), rhs); return rhs; } else if (expr->str() == "&&" && expr->astOperand1() && expr->astOperand2()) { - return executeMultiCondition(false, expr); + return single(executeMultiCondition(false, expr)); } else if (expr->str() == "||" && expr->astOperand1() && expr->astOperand2()) { - return executeMultiCondition(true, expr); + return single(executeMultiCondition(true, expr)); } else if (expr->str() == "," && expr->astOperand1() && expr->astOperand2()) { execute(expr->astOperand1()); return execute(expr->astOperand2()); } else if (expr->tokType() == Token::eIncDecOp && expr->astOperand1() && expr->astOperand1()->exprId() != 0) { if (!pm->hasValue(expr->astOperand1()->exprId())) - return ValueFlow::Value::unknown(); - ValueFlow::Value& lhs = pm->at(expr->astOperand1()->exprId()); - if (!lhs.isIntValue()) - return unknown(); - // overflow - if (!lhs.isImpossible() && lhs.intvalue == 0 && expr->str() == "--" && astIsUnsigned(expr->astOperand1())) - return unknown(); - - if (expr->str() == "++") - lhs.intvalue++; - else - lhs.intvalue--; - return lhs; + return {}; + Values& lhs = pm->at(expr->astOperand1()->exprId()); + // The values of an expression all have the same type + if (!lhs.front().isIntValue()) + return {}; + return applyToValues(lhs, expr->astOperand1(), expr->str() == "++" ? "+" : "-", ValueFlow::Value{1}); } else if (expr->str() == "[" && expr->astOperand1() && expr->astOperand2()) { const Token* tokvalue = nullptr; if (!pm->getTokValue(expr->astOperand1()->exprId(), tokvalue)) { @@ -1631,115 +2017,144 @@ namespace { expr->astOperand1()->values().cend(), std::mem_fn(&ValueFlow::Value::isTokValue)); if (tokvalue_it == expr->astOperand1()->values().cend() || !tokvalue_it->isKnown()) { - return unknown(); + return {}; } tokvalue = tokvalue_it->tokvalue; } if (!tokvalue || !tokvalue->isLiteral()) { - return unknown(); + return {}; } const std::string strValue = tokvalue->strValue(); - ValueFlow::Value rhs = execute(expr->astOperand2()); - if (!rhs.isIntValue()) - return unknown(); - const MathLib::bigint index = rhs.intvalue; - if (index >= 0 && index < strValue.size()) - return ValueFlow::Value{strValue[index]}; - if (index == strValue.size()) - return ValueFlow::Value{}; + const Values rhs = execute(expr->astOperand2()); + const ValueFlow::Value* index = singleValue(rhs, false); + if (!index || !index->isIntValue()) + return {}; + if (index->intvalue >= 0 && index->intvalue < strValue.size()) + return single(ValueFlow::Value{strValue[index->intvalue]}); + if (index->intvalue == strValue.size()) + return single(ValueFlow::Value{}); } else if (Token::Match(expr, "%cop%") && expr->astOperand1() && expr->astOperand2()) { - ValueFlow::Value lhs = execute(expr->astOperand1()); - if (lhs.isUninitValue()) - return unknown(); - ValueFlow::Value rhs = execute(expr->astOperand2()); - if (rhs.isUninitValue()) - return unknown(); - ValueFlow::Value r = evaluate(expr, lhs, rhs); + Values lhsValues = execute(expr->astOperand1()); + if (lhsValues.empty()) + return {}; + Values rhsValues = execute(expr->astOperand2()); + if (rhsValues.empty()) + return {}; + // The values of an operand are either one value or all constraints + const bool lhsConstraints = isConstraints(lhsValues); + const bool rhsConstraints = isConstraints(rhsValues); + if (!expr->isComparisonOp() && lhsConstraints != rhsConstraints) { + // Apply the operation to each constraint; a constraint it cannot transform is dropped + const Values& constraints = lhsConstraints ? lhsValues : rhsValues; + const ValueFlow::Value& other = lhsConstraints ? rhsValues.front() : lhsValues.front(); + // The range of an unsigned expression that may wrap around is lost + if (other.isIntValue() && mayWrap(constraints, expr, expr->str(), other.intvalue, lhsConstraints)) + return {}; + Values result; + for (const ValueFlow::Value& constraint : constraints) { + ValueFlow::Value r = lhsConstraints ? evaluate(expr->str(), constraint, other) : evaluate(expr->str(), other, constraint); + if (!r.isUninitValue()) + result.push_back(std::move(r)); + } + return result; + } + const ValueFlow::Value& lhs = lhsValues.front(); + const ValueFlow::Value& rhs = rhsValues.front(); + // Compare ranges: an operand with constraints is compared as the interval they describe + if (expr->isComparisonOp() && (lhsConstraints || rhsConstraints)) { + std::vector result = infer(makeIntegralInferModel(), expr->str(), lhsValues, rhsValues); + if (!result.empty()) + return single(std::move(result.front())); + } + ValueFlow::Value r = evaluate(expr->str(), lhs, rhs); if (expr->isComparisonOp() && (r.isUninitValue() || r.isImpossible())) { if (rhs.isIntValue() && !expr->astOperand1()->values().empty()) { - std::vector result = infer(makeIntegralInferModel(), - expr->str(), - expr->astOperand1()->values(), - {std::move(rhs)}); + std::vector result = + infer(makeIntegralInferModel(), expr->str(), expr->astOperand1()->values(), {rhs}); if (!result.empty() && result.front().isKnown()) - return std::move(result.front()); + return single(std::move(result.front())); } if (lhs.isIntValue() && !expr->astOperand2()->values().empty()) { - std::vector result = infer(makeIntegralInferModel(), - expr->str(), - {std::move(lhs)}, - expr->astOperand2()->values()); + std::vector result = + infer(makeIntegralInferModel(), expr->str(), {lhs}, expr->astOperand2()->values()); if (!result.empty() && result.front().isKnown()) - return std::move(result.front()); + return single(std::move(result.front())); } - return unknown(); + return {}; } - return r; + return single(std::move(r)); } // Unary ops else if (Token::Match(expr, "!|+|-") && expr->astOperand1() && !expr->astOperand2()) { - ValueFlow::Value lhs = execute(expr->astOperand1()); - if (!lhs.isIntValue()) - return unknown(); + Values lhs = execute(expr->astOperand1()); + if (lhs.empty() || !lhs.front().isIntValue()) + return {}; if (expr->str() == "!") { + ValueFlow::Value result = lhs.front(); if (isTrue(lhs)) { - lhs.intvalue = 0; + result.intvalue = 0; } else if (isFalse(lhs)) { - lhs.intvalue = 1; + result.intvalue = 1; } else { - return unknown(); + return {}; + } + result.setPossible(); + result.bound = ValueFlow::Value::Bound::Point; + return single(std::move(result)); + } + if (expr->str() == "-") { + for (ValueFlow::Value& v : lhs) { + v.intvalue = -v.intvalue; + v.invertBound(); } - lhs.setPossible(); - lhs.bound = ValueFlow::Value::Bound::Point; } - if (expr->str() == "-") - lhs.intvalue = -lhs.intvalue; return lhs; } else if (expr->str() == "?" && expr->astOperand1() && expr->astOperand2()) { - ValueFlow::Value cond = execute(expr->astOperand1()); - if (!cond.isIntValue()) - return unknown(); + const Values cond = execute(expr->astOperand1()); + if (cond.empty() || !cond.front().isIntValue()) + return {}; const Token* child = expr->astOperand2(); if (isFalse(cond)) return execute(child->astOperand2()); if (isTrue(cond)) return execute(child->astOperand1()); - return unknown(); + return {}; } else if (expr->str() == "(" && expr->isCast()) { if (expr->astOperand2()) { if (expr->astOperand1()->str() != "dynamic_cast") return execute(expr->astOperand2()); - return unknown(); + return {}; } return execute(expr->astOperand1()); } - // Return the tracked value and write it back when it differs, so later reads see the - // same value (as fillProgramMemoryFromAssignments used to do). - if (const ValueFlow::Value* tracked = getTrackedValue(expr)) { - const ValueFlow::Value* stored = pm->getValue(expr->exprId(), /*impossible*/ true); + // Return the tracked values and write them back when they differ, so later reads see the + // same values (as fillProgramMemoryFromAssignments used to do). + if (const Values* tracked = getTrackedValues(expr)) { + const Values* stored = pm->getValues(expr->exprId()); if (!stored || *stored != *tracked) - pm->setValue(expr, *tracked); + pm->setValues(expr, *tracked); return *tracked; } - if (expr->exprId() > 0 && pm->hasValue(expr->exprId()) && !dependsOnTrackedValue(expr)) { - ValueFlow::Value result = utils::as_const(*pm).at(expr->exprId()); - if (result.isImpossible() && result.isIntValue() && result.intvalue == 0 && isUsedAsBool(expr, settings)) { - result.intvalue = !result.intvalue; + if (const Values* stored = getStoredValues(expr)) { + // Int constraints that exclude zero make the expression true as a bool + if (isConstraints(*stored) && stored->front().isIntValue() && isTrue(*stored) && isUsedAsBool(expr, settings)) { + ValueFlow::Value result{1}; result.setKnown(); + return single(std::move(result)); } - return result; + return *stored; } if (Token::Match(expr->previous(), ">|%name% {|(")) { const Token* ftok = expr->previous(); const Function* f = ftok->function(); - ValueFlow::Value result = unknown(); + Values result; if (expr->str() == "(") { - std::vector tokArgs = getArguments(expr); - std::vector args(tokArgs.size()); - std::transform( - tokArgs.cbegin(), tokArgs.cend(), args.begin(), [&](const Token* tok) { + const std::vector tokArgs = getArguments(expr); + std::vector args; + args.reserve(tokArgs.size()); + std::transform(tokArgs.cbegin(), tokArgs.cend(), std::back_inserter(args), [&](const Token* tok) { return execute(tok); }); if (f) { @@ -1748,44 +2163,58 @@ namespace { for (std::size_t i = 0; i < args.size(); ++i) { const Variable* const arg = f->getArgumentVar(i); if (!arg) - return unknown(); - functionState.setValue(arg->nameToken(), args[i]); + return {}; + functionState.setValues(arg->nameToken(), args[i]); } Executor ex = *this; ex.pm = &functionState; ex.fdepth--; - auto r = ex.execute(f->functionScope); - if (!r.empty()) - result = std::move(r.front()); + std::vector returned = ex.execute(f->functionScope); + std::copy_if(std::make_move_iterator(returned.begin()), + std::make_move_iterator(returned.end()), + std::back_inserter(result), + [](const ValueFlow::Value& v) { + return !v.isUninitValue(); + }); // TODO: Track values changed by reference } } else { - BuiltinLibraryFunction lf = getBuiltinLibraryFunction(ftok->str()); - if (lf) - return lf(args); + if (BuiltinLibraryFunction lf = getBuiltinLibraryFunction(ftok->str())) { + // The builtin functions compute with values, not with constraints + std::vector argValues; + argValues.reserve(args.size()); + for (Values& a : args) { + if (!singleValue(a, false)) + return {}; + argValues.push_back(std::move(a.front())); + } + return single(lf(argValues)); + } const std::string& returnValue = settings().library.returnValue(ftok); if (!returnValue.empty()) { std::unordered_map arg_map; int argn = 0; - for (const ValueFlow::Value& v : args) { - if (!v.isUninitValue()) - arg_map[argn] = v; + for (Values& a : args) { + if (!a.empty()) + arg_map[argn] = std::move(a.front()); argn++; } - return evaluateLibraryFunction(arg_map, returnValue, settings, ftok->isCpp()); + return single(evaluateLibraryFunction(arg_map, returnValue, settings, ftok->isCpp())); } } } // Check if function modifies argument visitAstNodes(expr->astOperand2(), [&](const Token* child) { - if (child->exprId() > 0 && pm->hasValue(child->exprId())) { - ValueFlow::Value& v = pm->at(child->exprId()); + const Values* values = child->exprId() > 0 ? pm->getValues(child->exprId()) : nullptr; + if (values) { + // The values of an expression all have the same type + const ValueFlow::Value& v = values->front(); if (v.valueType == ValueFlow::Value::ValueType::CONTAINER_SIZE) { if (ValueFlow::isContainerSizeChanged(child, v.indirect, settings)) - v = unknown(); + pm->setUnknown(child); } else if (v.valueType != ValueFlow::Value::ValueType::UNINIT) { if (isVariableChanged(child, v.indirect, settings)) - v = unknown(); + pm->setUnknown(child); } } return ChildrenToVisit::op1_and_op2; @@ -1793,7 +2222,7 @@ namespace { return result; } - return unknown(); + return {}; } static const ValueFlow::Value* getImpossibleValue(const Token* tok) { @@ -1816,51 +2245,43 @@ namespace { return *it; } - static bool updateValue(ValueFlow::Value& v, ValueFlow::Value x) - { - const bool returnValue = !x.isUninitValue() && !x.isImpossible(); - if (v.isUninitValue() || returnValue) - v = std::move(x); - return returnValue; - } - - ValueFlow::Value execute(const Token* expr) + // The values of the expression. When it does not evaluate to a value, the program memory and + // the values of the token may still constrain it. + Values execute(const Token* expr) { depth--; OnExit onExit{[&] { depth++; }}; - if (depth < 0) - return unknown(); - ValueFlow::Value v = unknown(); - if (updateValue(v, executeImpl(expr))) - return v; - if (!expr) - return v; - if (expr->exprId() > 0 && pm->hasValue(expr->exprId())) { - if (updateValue(v, utils::as_const(*pm).at(expr->exprId()))) - return v; + if (depth < 0 || !expr) + return {}; + Values values = executeImpl(expr); + // The marker of an expression changed in an unknown way is not a value of it + if (isUnknown(values)) + values.clear(); + if (!values.empty() && !isConstraints(values)) + return values; + // The program memory may hold the value of an expression that could not be evaluated + if (expr->exprId() > 0) { + const Values* stored = pm->getValues(expr->exprId()); + if (stored && !isUnknown(*stored)) { + if (!isConstraints(*stored)) + return *stored; + if (values.empty()) + values = *stored; + } } // Find symbolic values - for (const ValueFlow::Value& value : expr->values()) { - if (!value.isSymbolicValue()) - continue; - if (!value.isKnown()) - continue; - if (value.tokvalue->exprId() > 0 && !pm->hasValue(value.tokvalue->exprId())) - continue; - const ValueFlow::Value& v_ref = utils::as_const(*pm).at(value.tokvalue->exprId()); - if (!v_ref.isIntValue() && value.intvalue != 0) - continue; - ValueFlow::Value v2 = v_ref; - v2.intvalue += value.intvalue; - return v2; - } - if (v.isImpossible() && v.isIntValue()) - return v; - if (const ValueFlow::Value* value = getImpossibleValue(expr)) - return *value; - return v; + Values symbolic = resolveSymbolicValues(expr, [](const ValueFlow::Value& v) { + return v.isKnown(); + }); + if (!symbolic.empty()) + return symbolic; + if (!values.empty() && values.front().isIntValue()) + return values; + if (const ValueFlow::Value* impossible = getImpossibleValue(expr)) + return single(*impossible); + return values; } std::vector execute(const Scope* scope) @@ -1872,11 +2293,16 @@ namespace { for (const Token* tok = scope->bodyStart->next(); precedes(tok, scope->bodyEnd); tok = tok->next()) { const Token* top = tok->astTop(); - if (Token::simpleMatch(top, "return") && top->astOperand1()) - return {execute(top->astOperand1())}; + if (Token::simpleMatch(top, "return") && top->astOperand1()) { + Values values = execute(top->astOperand1()); + if (values.empty()) + return {unknown()}; + return std::vector(std::make_move_iterator(values.begin()), + std::make_move_iterator(values.end())); + } if (Token::Match(top, "%op%")) { - if (execute(top).isUninitValue()) + if (execute(top).empty()) return {unknown()}; const Token* next = nextAfterAstRightmostLeaf(top); if (!next) @@ -1884,8 +2310,8 @@ namespace { tok = next; } else if (Token::simpleMatch(top->previous(), "if (")) { const Token* condTok = top->astOperand2(); - ValueFlow::Value v = execute(condTok); - if (!v.isIntValue()) + const Values cond = execute(condTok); + if (cond.empty() || !cond.front().isIntValue()) return {unknown()}; const Token* thenStart = top->link()->next(); const Token* next = thenStart->link(); @@ -1895,9 +2321,9 @@ namespace { next = elseStart->link(); } std::vector result; - if (isTrue(v)) { + if (isTrue(cond)) { result = execute(thenStart->scope()); - } else if (isFalse(v)) { + } else if (isFalse(cond)) { if (elseStart) result = execute(elseStart->scope()); } else { @@ -1915,14 +2341,22 @@ namespace { }; } // namespace +static ProgramMemory::Values executeValues(const Token* expr, + ProgramMemory& pm, + const Settings& settings, + const ProgramMemory::Map& vars) +{ + Executor ex{&pm, settings}; + ex.vars = &vars; + return ex.execute(expr); +} + static ValueFlow::Value execute(const Token* expr, ProgramMemory& pm, const Settings& settings, const ProgramMemory::Map& vars) { - Executor ex{&pm, settings}; - ex.vars = &vars; - return ex.execute(expr); + return Executor::representative(executeValues(expr, pm, settings, vars)); } std::vector execute(const Scope* scope, ProgramMemory& pm, const Settings& settings) diff --git a/lib/programmemory.h b/lib/programmemory.h index f3133a53c31..a201a09f6fc 100644 --- a/lib/programmemory.h +++ b/lib/programmemory.h @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -104,29 +105,55 @@ struct ExprIdToken { }; struct CPPCHECKLIB ProgramMemory { - using Map = std::map; + /** + * The values recorded for one expression. Either a single value of the expression (a possible + * value with a bound is still its value; the bound is extra information about the range it lies + * in) or a set of constraints that hold at the same time: impossible values, where a bound makes + * the value an impossible range, so that "x > 3" is recorded as "values <= 3 are impossible". + * The constraints of one expression all have the same value type. A list, so that adding a + * constraint does not move the values already recorded. + */ + using Values = std::list; + using Map = std::map; ProgramMemory() : mValues(new Map()) {} explicit ProgramMemory(Map values) : mValues(new Map(std::move(values))) {} + /** + * Record a fact about the expression. A value of the expression replaces everything recorded so + * far. A constraint (impossible value) is added to the constraints already recorded, keeping only + * the strongest bound in each direction; it replaces a recorded value only if that value violates it. + */ void setValue(const Token* expr, const ValueFlow::Value& value); + /** setValue() for each of the values */ + void setValues(const Token* expr, const Values& values); + /** + * The single value recorded for the expression, or nullptr if there is none or if several + * constraints are recorded. Impossible values are skipped unless impossible is true. + */ const ValueFlow::Value* getValue(nonneg int exprid, bool impossible = false) const; + /** All values recorded for the expression, or nullptr if there are none */ + const Values* getValues(nonneg int exprid) const; + /** The int value of the expression, if it has one */ bool getIntValue(nonneg int exprid, MathLib::bigint& result) const; void setIntValue(const Token* expr, MathLib::bigint value, bool impossible = false); + /** The container size of the expression, if it has one */ bool getContainerSizeValue(nonneg int exprid, MathLib::bigint& result) const; + /** Is the container empty? Decided from the size or from the recorded size constraints. */ bool getContainerEmptyValue(nonneg int exprid, MathLib::bigint& result) const; void setContainerSizeValue(const Token* expr, MathLib::bigint value, bool equal = true); void setUnknown(const Token* expr); + /** The token value of the expression, if it has one */ bool getTokValue(nonneg int exprid, const Token*& result) const; bool hasValue(nonneg int exprid) const; - const ValueFlow::Value& at(nonneg int exprid) const; - ValueFlow::Value& at(nonneg int exprid); + const Values& at(nonneg int exprid) const; + Values& at(nonneg int exprid); void erase_if(const std::function& pred); @@ -155,6 +182,8 @@ struct CPPCHECKLIB ProgramMemory { } private: + /** Record the value for exactly this expression, without solving the expression */ + void record(const Token* expr, const ValueFlow::Value& value); void copyOnWrite(); Map::const_iterator find(nonneg int exprid) const; Map::iterator find(nonneg int exprid); @@ -162,7 +191,7 @@ struct CPPCHECKLIB ProgramMemory { std::shared_ptr mValues; }; -struct ProgramMemoryState { +struct CPPCHECKLIB ProgramMemoryState { struct ChangedKeyHash { std::size_t operator()(const std::tuple& t) const { @@ -202,12 +231,12 @@ struct ProgramMemoryState { std::vector execute(const Scope* scope, ProgramMemory& pm, const Settings& settings); -void execute(const Token* expr, - ProgramMemory& programMemory, - MathLib::bigint* result, - bool* error, - const Settings& settings, - const ProgramMemory::Map& vars = {}); +CPPCHECKLIB void execute(const Token* expr, + ProgramMemory& programMemory, + MathLib::bigint* result, + bool* error, + const Settings& settings, + const ProgramMemory::Map& vars = {}); /** * Is condition always false when variable has given value? diff --git a/lib/token.cpp b/lib/token.cpp index eac69decee7..3f8e2a88d4c 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -2021,7 +2022,10 @@ static bool isAdjacent(const ValueFlow::Value& x, const ValueFlow::Value& y) return true; if (x.valueType == ValueFlow::Value::ValueType::FLOAT) return false; - return std::abs(x.intvalue - y.intvalue) == 1; + // Compared without a difference, which could overflow + const MathLib::bigint low = std::min(x.intvalue, y.intvalue); + const MathLib::bigint high = std::max(x.intvalue, y.intvalue); + return low != std::numeric_limits::max() && high == low + 1; } static bool removePointValue(std::list& values, std::list::iterator& x) @@ -2198,7 +2202,7 @@ static void removeOverlaps(std::list& values) // Removing contradictions is an NP-hard problem. Instead we run multiple // passes to try to catch most contradictions -static void removeContradictions(std::list& values) +void Token::removeContradictions(std::list& values) { removeOverlaps(values); for (int i = 0; i < 4; i++) { @@ -2240,9 +2244,9 @@ bool Token::addValue(const ValueFlow::Value &value) // })); if (mImpl->mValues) { - // Don't handle more than 10 values for performance reasons + // Don't handle more values for performance reasons // TODO: add setting? - if (mImpl->mValues->size() >= 10U) + if (mImpl->mValues->size() >= ValueFlow::maxValues) return false; // if value already exists, don't add it again diff --git a/lib/token.h b/lib/token.h index 3df24a86cb6..25495cf16a1 100644 --- a/lib/token.h +++ b/lib/token.h @@ -1421,6 +1421,12 @@ class CPPCHECKLIB Token { /** Add token value. Return true if value is added. */ bool addValue(const ValueFlow::Value &value); + /** + * Remove the values that contradict each other and merge adjacent ranges, as addValue() does + * after adding a value. + */ + static void removeContradictions(std::list& values); + void removeValues(std::function pred) { if (mImpl->mValues) mImpl->mValues->remove_if(std::move(pred)); diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 4be7a13dbc7..d5551f5d5ac 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -271,11 +271,6 @@ static void setConditionalValues(const Token* tok, setValueBound(false_value, tok, !lhs); } -static bool isSaturated(MathLib::bigint value) -{ - return value == std::numeric_limits::max() || value == std::numeric_limits::min(); -} - static void parseCompareEachInt( const Token* tok, const std::function& each, @@ -293,7 +288,7 @@ static void parseCompareEachInt( value1.clear(); } for (const ValueFlow::Value& v1 : value1) { - if (isSaturated(v1.intvalue) || astIsFloat(tok->astOperand2(), /*unknown*/ false)) + if (ValueFlow::isSaturated(v1.intvalue) || astIsFloat(tok->astOperand2(), /*unknown*/ false)) continue; ValueFlow::Value true_value = v1; ValueFlow::Value false_value = v1; @@ -301,7 +296,7 @@ static void parseCompareEachInt( each(tok->astOperand2(), std::move(true_value), std::move(false_value)); } for (const ValueFlow::Value& v2 : value2) { - if (isSaturated(v2.intvalue) || astIsFloat(tok->astOperand1(), /*unknown*/ false)) + if (ValueFlow::isSaturated(v2.intvalue) || astIsFloat(tok->astOperand1(), /*unknown*/ false)) continue; ValueFlow::Value true_value = v2; ValueFlow::Value false_value = v2; @@ -3608,6 +3603,14 @@ static void valueFlowSymbolic(const TokenList& tokenlist, const SymbolDatabase& lhs.errorPath.emplace_back(tok, tok->astOperand1()->expressionString() + " is assigned '" + tok->astOperand2()->expressionString() + "' here."); + // A pointer cast keeps the value: the left hand side is also equal to the expression that is cast + const Token* castExpr = tok->astOperand2(); + while (castExpr->isCast() && castExpr->astOperand1() && !castExpr->astOperand2() && + astIsPointer(castExpr) && astIsPointer(castExpr->astOperand1()) && + castExpr->astOperand1()->exprId() > 0) + castExpr = castExpr->astOperand1(); + if (castExpr != tok->astOperand2()) + valueFlowForward(start, end, castExpr, lhs, tokenlist, errorLogger, settings); valueFlowForward(start, end, tok->astOperand2(), std::move(lhs), tokenlist, errorLogger, settings); } } @@ -5249,7 +5252,10 @@ static bool valueFlowForLoop2(const Token *tok, memory1.swap(startMemory); if (!error) { memory2.swap(endMemory); - memoryAfter.swap(programMemory); + // The state after the loop is only known when the condition became false. When the limit of + // iterations was reached the loop runs on, or exits later in a state that is not known. + if (result == 0) + memoryAfter.swap(programMemory); } return true; @@ -5439,32 +5445,29 @@ static void valueFlowForLoop(const TokenList &tokenlist, const SymbolDatabase& s } } else { for (const auto& p : mem1) { - if (!p.second.isIntValue()) - continue; - if (p.second.isImpossible()) + MathLib::bigint value = 0; + if (!mem1.getIntValue(p.first.getExpressionId(), value)) continue; if (p.first.tok->varId() == 0) continue; - valueFlowForLoopSimplify(bodyStart, p.first.tok, false, p.second.intvalue, tokenlist, errorLogger, settings); + valueFlowForLoopSimplify(bodyStart, p.first.tok, false, value, tokenlist, errorLogger, settings); } for (const auto& p : mem2) { - if (!p.second.isIntValue()) - continue; - if (p.second.isImpossible()) + MathLib::bigint value = 0; + if (!mem2.getIntValue(p.first.getExpressionId(), value)) continue; if (p.first.tok->varId() == 0) continue; - valueFlowForLoopSimplify(bodyStart, p.first.tok, false, p.second.intvalue, tokenlist, errorLogger, settings); + valueFlowForLoopSimplify(bodyStart, p.first.tok, false, value, tokenlist, errorLogger, settings); } } for (const auto& p : memAfter) { - if (!p.second.isIntValue()) - continue; - if (p.second.isImpossible()) + MathLib::bigint value = 0; + if (!memAfter.getIntValue(p.first.getExpressionId(), value)) continue; if (p.first.tok->varId() == 0) continue; - valueFlowForLoopSimplifyAfter(tok, p.first.getExpressionId(), p.second.intvalue, tokenlist, errorLogger, settings); + valueFlowForLoopSimplifyAfter(tok, p.first.getExpressionId(), value, tokenlist, errorLogger, settings); } } } @@ -6218,6 +6221,31 @@ static const Token* parseBinaryIntOp(const Token* expr, return varTok; } +static MathLib::bigint floorDiv(MathLib::bigint x, MathLib::bigint y) +{ + MathLib::bigint q = x / y; + if (x % y != 0 && (x < 0) != (y < 0)) + --q; + return q; +} + +static MathLib::bigint ceilDiv(MathLib::bigint x, MathLib::bigint y) +{ + MathLib::bigint q = x / y; + if (x % y != 0 && (x < 0) == (y < 0)) + ++q; + return q; +} + +// Solve "x * divisor" for x when the value is a bound: divide the end of the range, rounding towards +// the inside of the range so that it stays exact; a negative divisor turns the range around. +static bool divideBound(ValueFlow::Value& value, MathLib::bigint divisor) +{ + const bool lowerAfter = (divisor > 0) == value.isLowerEdge(); + const MathLib::bigint edge = value.rangeEdge(); + return value.setRangeEdge(lowerAfter ? ceilDiv(edge, divisor) : floorDiv(edge, divisor), lowerAfter); +} + const Token* ValueFlow::solveExprValue(const Token* expr, const std::function(const Token*)>& eval, ValueFlow::Value& value) @@ -6241,19 +6269,32 @@ const Token* ValueFlow::solveExprValue(const Token* expr, return ValueFlow::solveExprValue(binaryTok, eval, value); } case '-': { - if (rhs) + if (rhs) { value.intvalue = intval - value.intvalue; - else + // c - x >= a <=> x <= c - a + value.invertBound(); + } else value.intvalue += intval; return ValueFlow::solveExprValue(binaryTok, eval, value); } case '*': { - if (intval == 0) + // A bound at the limit of the type cannot be solved, nor can its edge be divided safely + if (intval == 0 || ValueFlow::isSaturated(value.intvalue) || ValueFlow::isSaturated(value.rangeEdge())) + break; + if (value.bound == ValueFlow::Value::Bound::Point) { + // x * k is v only for a v that k divides + if (value.intvalue % intval != 0) + break; + value.intvalue /= intval; + } else if (!divideBound(value, intval)) { break; - value.intvalue /= intval; + } return ValueFlow::solveExprValue(binaryTok, eval, value); } case '^': { + // xor does not keep a range together + if (value.bound != ValueFlow::Value::Bound::Point) + break; value.intvalue ^= intval; return ValueFlow::solveExprValue(binaryTok, eval, value); } diff --git a/lib/vf_analyzers.cpp b/lib/vf_analyzers.cpp index bc988051c3d..ccadc3ef623 100644 --- a/lib/vf_analyzers.cpp +++ b/lib/vf_analyzers.cpp @@ -59,6 +59,26 @@ static bool isDereferenceOp(const Token* tok) return tok->str() == "." && tok->originalName() == "->"; } +// Every leaf is a constant or has an int value or constraint in the memory, so an undecided +// condition can go either way. +static bool stateCoversCondition(const Token* tok, const ProgramMemory& pm, int depth = 20) +{ + if (!tok || depth < 0) + return false; + if (tok->hasKnownIntValue()) + return true; + if (tok->varId() > 0 || Token::simpleMatch(tok, ".")) { + const ProgramMemory::Values* values = pm.getValues(tok->exprId()); + return values && !values->empty() && std::all_of(values->cbegin(), values->cend(), [](const ValueFlow::Value& v) { + return v.isIntValue(); + }); + } + if (!tok->astOperand2()) + return Token::Match(tok, "!|-|~") && stateCoversCondition(tok->astOperand1(), pm, depth - 1); + return tok->isConstOp() && stateCoversCondition(tok->astOperand1(), pm, depth - 1) && + stateCoversCondition(tok->astOperand2(), pm, depth - 1); +} + struct ValueFlowAnalyzer : Analyzer { RefThunk settings; ProgramMemoryState pms; @@ -358,7 +378,7 @@ struct ValueFlowAnalyzer : Analyzer { if (dst) { const size_t sz = dst->getSizeOf(settings, ValueType::Accuracy::ExactOrZero, ValueType::SizeOf::Pointer); if (sz > 0 && sz < sizeof(MathLib::biguint)) { - MathLib::bigint newvalue = ValueFlow::truncateIntValue(value->intvalue, sz, dst, settings.platform); + MathLib::bigint newvalue = ValueFlow::truncateIntValue(value->intvalue, sz, dst, settings().platform); /* Handle overflow/underflow for value bounds */ if (value->bound != ValueFlow::Value::Bound::Point) { @@ -383,6 +403,15 @@ struct ValueFlowAnalyzer : Analyzer { assert(false && "Internal update unimplemented."); } + // A conditional value is split only on a condition the state covers; an unknown one may be + // correlated with the assumption. + bool canSplitConditional(const Token* condTok) const + { + if (!condTok) + return false; + return stateCoversCondition(condTok, pms.get(condTok, nullptr, getProgramState())); + } + private: // Returns Action::Match if its an exact match, return Action::Read if it partially matches the lifetime Action analyzeLifetime(const Token* tok) const @@ -757,14 +786,13 @@ struct ValueFlowAnalyzer : Analyzer { pms.addState(anchor, getProgramState()); pms.assume(tok, state, flags & Assume::ContainerEmpty, origin); - // The false path (the true path uses scopeEnd above): record the assumed state where control - // continues - the end of the else block, or the closing brace when there is no else - so it - // reaches the enclosing scope. + // The false path: record the state where control continues, at the end of the else block or + // past the closing brace (which still counts as inside the block). if (isCondBlock && !(flags & Assume::Pending) && !state) { if (Token::simpleMatch(endBlock, "} else {")) pms.addState(endBlock->linkAt(2)->previous(), getProgramState()); else - pms.addState(endBlock, getProgramState()); + pms.addState(endBlock->next(), getProgramState()); } if (!(flags & Assume::Quiet)) { @@ -1051,7 +1079,7 @@ struct MultiValueFlowAnalyzer : ValueFlowAnalyzer { bool stopOnCondition(const Token* condTok) const override { if (isConditional()) - return true; + return !canSplitConditional(condTok); if (!condTok->hasKnownIntValue() && values.count(condTok->varId()) == 0) { const auto& values_ = condTok->values(); return std::any_of(values_.cbegin(), values_.cend(), [](const ValueFlow::Value& v) { @@ -1083,9 +1111,9 @@ struct MultiValueFlowAnalyzer : ValueFlowAnalyzer { }; if (std::all_of(values.cbegin(), values.cend(), std::bind(pred, std::bind(SelectMapValues{}, std::placeholders::_1)))) return true; - if (isConditional()) - return false; const Token* condTok = getCondTokFromEnd(endBlock); + if (isConditional()) + return canSplitConditional(condTok); std::set varids; std::transform(getVars().cbegin(), getVars().cend(), std::inserter(varids, varids.begin()), SelectMapKeys{}); return bifurcate(condTok, varids, getSettings()); @@ -1105,7 +1133,7 @@ struct MultiValueFlowAnalyzer : ValueFlowAnalyzer { if (!var) continue; assert(var->nameToken()); - ps[var->nameToken()] = p.second; + ps[var->nameToken()] = {p.second}; } return ps; } @@ -1232,9 +1260,9 @@ struct SingleValueFlowAnalyzer : ValueFlowAnalyzer { if (value.isLifetimeValue()) return false; // 'conditional' flag (uninit, or lowered after a modifying branch): may depend on a - // condition that doesn't mention the variable -> stop + // condition that doesn't mention the variable -> stop unless the state covers this one if (value.conditional && !value.isKnown()) - return true; + return !canSplitConditional(condTok); if (value.isNonValue()) return false; if (value.isSymbolicValue()) @@ -1272,9 +1300,9 @@ struct SingleValueFlowAnalyzer : ValueFlowAnalyzer { return true; if (value.isLifetimeValue()) return true; - if (isConditional()) - return false; const Token* condTok = getCondTokFromEnd(endBlock); + if (isConditional()) + return canSplitConditional(condTok); std::set varids2; std::transform(getVars().cbegin(), getVars().cend(), std::inserter(varids2, varids2.begin()), SelectMapKeys{}); return bifurcate(condTok, varids2, getSettings()); @@ -1380,7 +1408,7 @@ struct ExpressionAnalyzer : SingleValueFlowAnalyzer { ProgramState getProgramState() const override { ProgramState ps; - ps[expr] = value; + ps[expr] = {value}; return ps; } diff --git a/lib/vf_common.h b/lib/vf_common.h index 448d14ccb41..2557b5a1bff 100644 --- a/lib/vf_common.h +++ b/lib/vf_common.h @@ -25,6 +25,7 @@ #include "symboldatabase.h" #include +#include #include class Token; @@ -43,6 +44,12 @@ namespace ValueFlow MathLib::bigint truncateIntValue(MathLib::bigint value, size_t value_size, const ValueType* dst, const Platform& platform); + /** Is the value at a limit of its type, standing for any value beyond? */ + inline bool isSaturated(MathLib::bigint value) + { + return value == std::numeric_limits::max() || value == std::numeric_limits::min(); + } + Token * valueFlowSetConstantValue(Token *tok, const Settings &settings); Value castValue(Value value, ValueType::Sign sign, nonneg int bit); diff --git a/lib/vfvalue.h b/lib/vfvalue.h index 9eab775de24..4b94ca077b6 100644 --- a/lib/vfvalue.h +++ b/lib/vfvalue.h @@ -27,8 +27,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -40,6 +42,9 @@ class Token; namespace ValueFlow { + /** The most values kept for one expression, for the sake of performance */ + constexpr std::size_t maxValues = 10; + class CPPCHECKLIB Value { public: enum class Bound : std::uint8_t { Upper, Lower, Point }; @@ -194,6 +199,44 @@ namespace ValueFlow decreaseRange(); } + /** + * Is a value with a bound the lower end of its range? A possible lower bound is; so is an + * impossible upper bound, as the values up to it are impossible. + */ + bool isLowerEdge() const { + return (bound == Bound::Lower) != isImpossible(); + } + + /** + * The first value inside the range of a value with a bound. A bound at the limit of the type + * stays there, as there is no value beyond it. + */ + MathLib::bigint rangeEdge() const { + if (!isImpossible()) + return intvalue; + if (isLowerEdge()) + return intvalue == std::numeric_limits::max() ? intvalue : intvalue + 1; + return intvalue == std::numeric_limits::min() ? intvalue : intvalue - 1; + } + + /** + * Let the range start (lower edge) or end at the given value, keeping the kind of the value. + * Returns false, leaving the value as it is, when the edge is at the limit of the type: the + * bound would lie beyond it. + */ + bool setRangeEdge(MathLib::bigint edge, bool lowerEdge) { + if (isImpossible()) { + if (lowerEdge ? edge == std::numeric_limits::min() : edge == std::numeric_limits::max()) + return false; + bound = lowerEdge ? Bound::Upper : Bound::Lower; + intvalue = lowerEdge ? edge - 1 : edge + 1; + } else { + bound = lowerEdge ? Bound::Lower : Bound::Upper; + intvalue = edge; + } + return true; + } + void assumeCondition(const Token* tok); std::string infoString() const; diff --git a/oss-fuzz/Makefile b/oss-fuzz/Makefile index 5b8a1d159d4..133080e4a7d 100644 --- a/oss-fuzz/Makefile +++ b/oss-fuzz/Makefile @@ -315,7 +315,7 @@ $(libcppdir)/platform.o: ../lib/platform.cpp ../externals/tinyxml2/tinyxml2.h .. $(libcppdir)/preprocessor.o: ../lib/preprocessor.cpp ../externals/simplecpp/simplecpp.h ../lib/checkers.h ../lib/config.h ../lib/errorlogger.h ../lib/errortypes.h ../lib/library.h ../lib/mathlib.h ../lib/path.h ../lib/platform.h ../lib/preprocessor.h ../lib/refthunk.h ../lib/settings.h ../lib/standards.h ../lib/suppressions.h ../lib/utils.h $(CXX) ${LIB_FUZZING_ENGINE} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/preprocessor.cpp -$(libcppdir)/programmemory.o: ../lib/programmemory.cpp ../lib/astutils.h ../lib/calculate.h ../lib/checkers.h ../lib/config.h ../lib/errortypes.h ../lib/infer.h ../lib/library.h ../lib/mathlib.h ../lib/platform.h ../lib/programmemory.h ../lib/refthunk.h ../lib/settings.h ../lib/smallvector.h ../lib/sourcelocation.h ../lib/standards.h ../lib/symboldatabase.h ../lib/templatesimplifier.h ../lib/token.h ../lib/tokenlist.h ../lib/utils.h ../lib/valueflow.h ../lib/valueptr.h ../lib/vfvalue.h +$(libcppdir)/programmemory.o: ../lib/programmemory.cpp ../lib/astutils.h ../lib/calculate.h ../lib/checkers.h ../lib/config.h ../lib/errortypes.h ../lib/infer.h ../lib/library.h ../lib/mathlib.h ../lib/platform.h ../lib/programmemory.h ../lib/refthunk.h ../lib/settings.h ../lib/smallvector.h ../lib/sourcelocation.h ../lib/standards.h ../lib/symboldatabase.h ../lib/templatesimplifier.h ../lib/token.h ../lib/tokenlist.h ../lib/utils.h ../lib/valueflow.h ../lib/valueptr.h ../lib/vf_common.h ../lib/vfvalue.h $(CXX) ${LIB_FUZZING_ENGINE} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/programmemory.cpp $(libcppdir)/regex.o: ../lib/regex.cpp ../lib/config.h ../lib/regex.h diff --git a/test/testcondition.cpp b/test/testcondition.cpp index abef2d95614..e1c82ed53e0 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -130,6 +130,7 @@ class TestCondition : public TestFixture { TEST_CASE(knownConditionAfterBailout); // #12526 TEST_CASE(knownConditionIncDecOperator); TEST_CASE(knownConditionFloating); + TEST_CASE(knownConditionRecordedComparison); } struct CheckOptions @@ -935,6 +936,20 @@ class TestCondition : public TestFixture { "}\n"); ASSERT_EQUALS("", errout_str()); + // the condition 'length > 1' does not make length equal to 2, so 'length > 2' is not dead + check("void f(int length, unsigned int& dst) {\n" + " unsigned int src2 = 0U;\n" + " if (length > 1) {\n" + " if (length > 2) {\n" + " src2 = 15U;\n" + " }\n" + " }\n" + " if (length >= 2) {\n" + " dst = ((0x80) | (src2 >> 2));\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + check("const int FEATURE_BITS = x |\n" "#if FOO_ENABLED\n" " FEATURE_FOO |\n" @@ -5808,6 +5823,17 @@ class TestCondition : public TestFixture { "}\n"); ASSERT_EQUALS("[test.cpp:2:26]: (style) Condition 'i<20' is always false [knownConditionTrueFalse]\n", errout_str()); + check("void f(int n) {\n" // the loop runs but its simulation does not change the state + " if (n > 0) {\n" + " int i, j;\n" + " for (i = j = 0; i < n; i = j) {\n" + " while (j < n)\n" + " j++;\n" + " }\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + check("int foo(int foo, int bar, bool baz, bool flag) {\n" " if (baz && flag) {\n" " do {\n" @@ -6922,6 +6948,94 @@ class TestCondition : public TestFixture { "", errout_str()); } + + // TODO: a comparison of two expressions without values should decide the comparisons of the pair + // that move a constant to the other side: "(x + 1) < w[0]" is "x < w[0] - 1". At the normal check + // level the forward analysis forks on a few unknown conditions only, so the condition has to be + // decided for the analysis of the conditional value of z to go on into the right hand side of the + // "&&" (reduced from rpp local_binary_pattern.cpp, DACA report for PR #8899). + void knownConditionRecordedComparison() { + const Settings settings = settingsBuilder().severity(Severity::style).checkLevel(Settings::CheckLevel::normal).build(); + check("void f(const unsigned char* in, const unsigned int* w, int y, int x, int z, int c, unsigned char* n) {\n" + " if (x < w[0] - 1 && x > 0 && z > 0) {\n" + " if (z >= y) {\n" + " for (int i = 0; i < c; i++) {\n" + " if ((x - 1) >= 0 && (z - 1) >= 0)\n" + " n[i] = in[0];\n" + " else\n" + " n[i] = 0;\n" + " if ((z - 1) >= 0)\n" + " n[i] = in[1];\n" + " else\n" + " n[i] = 0;\n" + " if ((x + 1) < w[0] && (z - 1) >= 0)\n" + " n[i] = in[2];\n" + " else\n" + " n[i] = 0;\n" + " }\n" + " }\n" + " }\n" + "}\n", settings); + TODO_ASSERT_EQUALS("[test.cpp:2:27] -> [test.cpp:5:29]: (style) Condition '(x-1)>=0' is always true [knownConditionTrueFalse]\n" + "[test.cpp:2:36] -> [test.cpp:5:45]: (style) Condition '(z-1)>=0' is always true [knownConditionTrueFalse]\n" + "[test.cpp:2:36] -> [test.cpp:9:29]: (style) Condition '(z-1)>=0' is always true [knownConditionTrueFalse]\n" + "[test.cpp:5:45] -> [test.cpp:13:47]: (style) Condition '(z-1)>=0' is always true [knownConditionTrueFalse]\n", + "[test.cpp:2:27] -> [test.cpp:5:29]: (style) Condition '(x-1)>=0' is always true [knownConditionTrueFalse]\n" + "[test.cpp:2:36] -> [test.cpp:5:45]: (style) Condition '(z-1)>=0' is always true [knownConditionTrueFalse]\n" + "[test.cpp:2:36] -> [test.cpp:9:29]: (style) Condition '(z-1)>=0' is always true [knownConditionTrueFalse]\n", + errout_str()); + + // a comparison that moves a different constant does not follow, nor one of a changed operand + check("void f(const unsigned char* in, const unsigned int* w, int y, int x, int z, int c, unsigned char* n) {\n" + " if (x < w[0] - 1 && x > 0 && z > 0) {\n" + " if (z >= y) {\n" + " for (int i = 0; i < c; i++) {\n" + " if ((x - 1) >= 0 && (z - 1) >= 0)\n" + " n[i] = in[0];\n" + " else\n" + " n[i] = 0;\n" + " if ((z - 1) >= 0)\n" + " n[i] = in[1];\n" + " else\n" + " n[i] = 0;\n" + " if ((x + 2) < w[0] && (z - 1) >= 0)\n" + " n[i] = in[2];\n" + " else\n" + " n[i] = 0;\n" + " }\n" + " }\n" + " }\n" + "}\n", settings); + ASSERT_EQUALS("[test.cpp:2:27] -> [test.cpp:5:29]: (style) Condition '(x-1)>=0' is always true [knownConditionTrueFalse]\n" + "[test.cpp:2:36] -> [test.cpp:5:45]: (style) Condition '(z-1)>=0' is always true [knownConditionTrueFalse]\n" + "[test.cpp:2:36] -> [test.cpp:9:29]: (style) Condition '(z-1)>=0' is always true [knownConditionTrueFalse]\n", + errout_str()); + + check("void f(const unsigned char* in, const unsigned int* w, int y, int x, int z, int c, unsigned char* n) {\n" + " if (x < w[0] - 1 && x > 0 && z > 0) {\n" + " if (z >= y) {\n" + " for (int i = 0; i < c; i++) {\n" + " if ((x - 1) >= 0 && (z - 1) >= 0)\n" + " n[i] = in[0];\n" + " else\n" + " n[i] = 0;\n" + " if ((z - 1) >= 0)\n" + " n[i] = in[1];\n" + " else\n" + " n[i] = 0;\n" + " x++;\n" + " if ((x + 1) < w[0] && (z - 1) >= 0)\n" + " n[i] = in[2];\n" + " else\n" + " n[i] = 0;\n" + " }\n" + " }\n" + " }\n" + "}\n", settings); + ASSERT_EQUALS("[test.cpp:2:36] -> [test.cpp:5:45]: (style) Condition '(z-1)>=0' is always true [knownConditionTrueFalse]\n" + "[test.cpp:2:36] -> [test.cpp:9:29]: (style) Condition '(z-1)>=0' is always true [knownConditionTrueFalse]\n", + errout_str()); + } }; REGISTER_TEST(TestCondition) diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index ca5c183c911..093dbe94dfc 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -148,6 +148,11 @@ class TestNullPointer : public TestFixture { TEST_CASE(nullpointer108); TEST_CASE(nullpointer109); TEST_CASE(nullpointer110); // #14937 + TEST_CASE(nullpointer111); // ranges from conditions + TEST_CASE(nullpointer112); // unknown values in program memory + TEST_CASE(nullpointer113); // a variable is clamped before the check + TEST_CASE(nullpointer114); // the else block changes the value + TEST_CASE(nullpointer115); // a range condition overlapping the assumed one TEST_CASE(nullpointer_addressOf); // address of TEST_CASE(nullpointerSwitch); // #2626 TEST_CASE(nullpointer_cast); // #4692 @@ -3147,6 +3152,227 @@ class TestNullPointer : public TestFixture { ASSERT_EQUALS("", errout_str()); } + void nullpointer111() { // a condition 'x > 3' does not give x the value 4 + check("void f(int x) {\n" + " int* p = 0;\n" + " if (x > 3) {\n" + " if (x < 10) {}\n" + " else { *p = 1; }\n" + " }\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:5:17]: (error) Null pointer dereference: p [nullPointer]\n", errout_str()); + + check("void f(int x) {\n" + " int* p = 0;\n" + " if (x > 3) {\n" + " if (x == 15) { *p = 1; }\n" + " }\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4:25]: (error) Null pointer dereference: p [nullPointer]\n", errout_str()); + + // 3 < x < 10: x == 15 is impossible, x == 5 is not + check("void f(int x) {\n" + " int* p = 0;\n" + " if (x > 3 && x < 10) {\n" + " if (x == 15) { *p = 1; }\n" + " if (x == 5) { *p = 1; }\n" + " }\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:5:24]: (error) Null pointer dereference: p [nullPointer]\n", errout_str()); + + // the range of a product is solved exactly: -2 * x > 3 is x <= -2 + check("void f(int x) {\n" + " int* p = 0;\n" + " if (-2 * x > 3) {\n" + " if (x <= -2) p = &x;\n" + " *p = 1;\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + + // x * 2 < 3 is x <= 1, so x == 1 is possible + check("void f(int x) {\n" + " int* p = 0;\n" + " if (x * 2 < 3) {\n" + " if (x == 1) p = &x;\n" + " *p = 1;\n" + " }\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:5:10]: (warning) Possible null pointer dereference: p [nullPointer]\n", errout_str()); + + // the range follows the value through arithmetic + check("void f(int x) {\n" + " int* p = 0;\n" + " if (x > 3) {\n" + " if ((x << 1) >= 8) p = &x;\n" + " *p = 1;\n" + " }\n" + " if (x > 6) {\n" + " if (x / 2 > 2) p = &x;\n" + " *p = 1;\n" + " }\n" + " if (x > 3) {\n" + " if (10 - x < 7) p = &x;\n" + " *p = 1;\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + + // a range that excludes zero is true; one that includes zero is not known + check("void f(int x) {\n" + " int* p = 0;\n" + " if (x > 3) {\n" + " if (x) p = &x;\n" + " *p = 1;\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + check("void f(int x) {\n" + " int* p = 0;\n" + " if (x > -5) {\n" + " if (x) p = &x;\n" + " *p = 1;\n" + " }\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:5:10]: (warning) Possible null pointer dereference: p [nullPointer]\n", errout_str()); + + // x >= 0 and x != 0 is x > 0 + check("void f(int x) {\n" + " int* p = 0;\n" + " if (x < 0) return;\n" + " if (x == 0) return;\n" + " if (x > 0) p = &x;\n" + " *p = 1;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + } + + void nullpointer112() { // a variable whose value is unknown is still known through its aliases + // result is unknown, but result == p and the check on result is a check on p + check("char* g(char* path) {\n" + " char* result;\n" + " char* p;\n" + " result = path;\n" + " p = result;\n" + " if (!result)\n" + " return NULL;\n" + " while ((p = strchr(p, '/'))) {\n" + " p++;\n" + " }\n" + " return result;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + + // g is unknown; it does not hide that 'ctx = g' is 0 when ctx is 0 + check("struct S { int a; };\n" + "static struct S* g;\n" + "void f(const int* rsl) {\n" + " static int inited = 0;\n" + " struct S* ctx;\n" + " if ((ctx = g) == 0)\n" + " ctx = g = (struct S*)malloc(sizeof(struct S));\n" + " if (inited && rsl == 0)\n" + " return;\n" + " inited = 1;\n" + " ctx->a = 0;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:11:5]: (warning) If memory allocation fails, then there is a possible null pointer dereference: ctx [nullPointerOutOfMemory]\n", errout_str()); + } + + void nullpointer113() { // clamp before the check: 'if (x > N) x = N;' + // inside a range condition + check("int f(int len, int *buf) {\n" + " int *p = 0;\n" + " if (len >= 0) {\n" + " if (len > 16)\n" + " len = 16;\n" + " if (len <= 16)\n" + " p = buf;\n" + " return *p;\n" + " }\n" + " return 0;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + + // false on both paths + check("int f(int x) {\n" + " int *p = 0;\n" + " if (x > 5) x = 5;\n" + " if (x > 5) return *p;\n" + " return x;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + + check("int f(int x) {\n" + " int *p = 0;\n" + " if (x > 5) x = 5;\n" + " if (x <= 5) return x;\n" + " return *p;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + + // else block assigns too + check("int f(int x) {\n" + " int *p = 0;\n" + " if (x > 5) x = 5;\n" + " else x = 0;\n" + " if (x > 5) return *p;\n" + " return x;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + + // still possible + check("int f(int x) {\n" + " int *p = 0;\n" + " if (x > 5) x = 5;\n" + " if (x < 5) return *p;\n" + " return x;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4:24]: (error) Null pointer dereference: p [nullPointer]\n", errout_str()); + + // unrelated condition + check("int f(int x, int y) {\n" + " int *p = 0;\n" + " if (x > 5) x = 5;\n" + " if (y) return *p;\n" + " return x;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4:20]: (error) Null pointer dereference: p [nullPointer]\n", errout_str()); + + // TODO: 'len >= 0' is a loop invariant + check("int f(int len, int *buf) {\n" + " int *p = 0;\n" + " if (len >= 0) {\n" + " while (len > 0)\n" + " len--;\n" + " if (len == 0)\n" + " p = buf;\n" + " return *p;\n" + " }\n" + " return 0;\n" + "}\n"); + TODO_ASSERT_EQUALS("", "[test.cpp:8:17]: (warning) Possible null pointer dereference: p [nullPointer]\n", errout_str()); + } + + void nullpointer114() { // the else block changes the value + check("int f(int *p, int c) {\n" + " if (!p) return 1;\n" + " if (c) {} else { p = 0; }\n" + " return *p;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4:13]: (warning) Possible null pointer dereference: p [nullPointer]\n", errout_str()); + } + + void nullpointer115() { // a range condition overlapping the assumed one + check("int f(int n, int *q) {\n" + " int *p = 0;\n" + " if (n > 5) p = q;\n" + " if (n > 3) return *p;\n" + " return 0;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4:24]: (warning) Possible null pointer dereference: p [nullPointer]\n", errout_str()); + } + void nullpointer_addressOf() { // address of check("void f() {\n" " struct X *x = 0;\n" @@ -4871,6 +5097,14 @@ class TestNullPointer : public TestFixture { check("int* f9() { int *x = NULL; return x--; }\n"); ASSERT_EQUALS("[test.cpp:1:36]: (error) Overflow in pointer arithmetic, NULL pointer is subtracted. [nullPointerArithmetic]\n", errout_str()); + + // The condition of an assert() is not redundant (sqlite3MemRealloc) + check("void foo(void *pPrior, int nByte) {\n" + " long long *p = (long long*)pPrior;\n" + " assert(pPrior != 0 && nByte > 0);\n" + " p--;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); } void addNull() { diff --git a/test/testother.cpp b/test/testother.cpp index e285d8d8bd0..58e7d13d9e0 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -898,6 +898,43 @@ class TestOther : public TestFixture { " if (!num) {}\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + // clamp before the check + check("int f(int x) {\n" + " int d = 0;\n" + " if (x > 5) x = 0;\n" + " if (x <= 5) d = 1;\n" + " return 10 / d;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + + check("int f(int x) {\n" + " int d = 0;\n" + " if (x >= 0) {\n" + " if (x > 5) x = 0;\n" + " if (x <= 5) d = 1;\n" + " return 10 / d;\n" + " }\n" + " return d;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + + // the else block changes the value + check("int f(int x, int c) {\n" + " if (x == 0) return 1;\n" + " if (c) {} else { x = 0; }\n" + " return 10 / x;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4:15]: (warning) Division by zero. [zerodivcond]\n", errout_str()); + + // a range condition overlapping the assumed one + check("int f(int n) {\n" + " int x = 0;\n" + " if (n > 5) { x = 1; }\n" + " if (n > 3) return 10 / x;\n" + " return 0;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4:26]: (warning) Division by zero. [zerodivcond]\n", errout_str()); } void zeroDivErrorPath() { diff --git a/test/testprogrammemory.cpp b/test/testprogrammemory.cpp index c37431de608..49e3e00b276 100644 --- a/test/testprogrammemory.cpp +++ b/test/testprogrammemory.cpp @@ -19,23 +19,72 @@ #include "config.h" #include "fixture.h" #include "helpers.h" +#include "mathlib.h" +#include "settings.h" #include "token.h" #include "programmemory.h" #include "utils.h" #include "vfvalue.h" +#include +#include +#include +#include #include +#include +#include class TestProgramMemory : public TestFixture { public: TestProgramMemory() : TestFixture("TestProgramMemory") {} private: + const Settings settings = settingsBuilder().library("std.cfg").build(); + void run() override { TEST_CASE(copyOnWrite); TEST_CASE(hasValue); TEST_CASE(getValue); TEST_CASE(at); + TEST_CASE(setValueConstraints); + TEST_CASE(setValueReplacesConstraints); + TEST_CASE(containerEmpty); + TEST_CASE(executeRange); + TEST_CASE(executeScaledRange); + TEST_CASE(executeSolvedRange); + TEST_CASE(executeCompoundAssignment); + TEST_CASE(executeRangeAtLimit); + TEST_CASE(executeUnsignedRange); + TEST_CASE(executeContainerAlias); + TEST_CASE(executeContainerSizeRange); + TEST_CASE(executeUnknown); + } + + static ValueFlow::Value impossible(MathLib::bigint x, ValueFlow::Value::Bound bound = ValueFlow::Value::Bound::Point) { + ValueFlow::Value v{x, bound}; + v.setImpossible(); + return v; + } + + // The constraint "x > lower": the values up to lower are impossible + static ValueFlow::Value greaterThan(MathLib::bigint lower) { + return impossible(lower, ValueFlow::Value::Bound::Upper); + } + + // The constraint "x < upper": the values from upper on are impossible + static ValueFlow::Value lessThan(MathLib::bigint upper) { + return impossible(upper, ValueFlow::Value::Bound::Lower); + } + + static ValueFlow::Value containerSize(ValueFlow::Value v) { + v.valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE; + return v; + } + + static bool hasValue(const ProgramMemory::Values& values, MathLib::bigint x, ValueFlow::Value::Bound bound) { + return std::any_of(values.cbegin(), values.cend(), [&](const ValueFlow::Value& v) { + return v.intvalue == x && v.bound == bound; + }); } void copyOnWrite() const { @@ -94,6 +143,7 @@ class TestProgramMemory : public TestFixture { void getValue() const { ProgramMemory pm; ASSERT(!pm.getValue(123)); + ASSERT(!pm.getValues(123)); } void at() const { @@ -101,6 +151,533 @@ class TestProgramMemory : public TestFixture { ASSERT_THROW_EQUALS(pm.at(123), std::out_of_range, "ProgramMemory::at"); ASSERT_THROW_EQUALS(utils::as_const(pm).at(123), std::out_of_range, "ProgramMemory::at"); } + + void setValueConstraints() const { + SimpleTokenList tokenlist("1+1;\n"); + Token* tok = tokenlist.front(); + const nonneg int id = 123; + tok->exprId(id); + + ProgramMemory pm; + // x > 3 and x < 10 hold at the same time + pm.setValue(tok, greaterThan(3)); + pm.setValue(tok, lessThan(10)); + const ProgramMemory::Values* values = pm.getValues(id); + ASSERT(values); + ASSERT_EQUALS(2U, values->size()); + ASSERT(hasValue(*values, 3, ValueFlow::Value::Bound::Upper)); + ASSERT(hasValue(*values, 10, ValueFlow::Value::Bound::Lower)); + + // several constraints are not a single value + ASSERT(!pm.getValue(id)); + ASSERT(!pm.getValue(id, true)); + MathLib::bigint i = 0; + ASSERT(!pm.getIntValue(id, i)); + + // a repeated constraint is not added again + pm.setValue(tok, greaterThan(3)); + ASSERT_EQUALS(2U, pm.at(id).size()); + + // a weaker bound is dropped + pm.setValue(tok, greaterThan(1)); + ASSERT_EQUALS(2U, pm.at(id).size()); + ASSERT(hasValue(pm.at(id), 3, ValueFlow::Value::Bound::Upper)); + + // a stronger bound replaces the bound + pm.setValue(tok, greaterThan(5)); + ASSERT_EQUALS(2U, pm.at(id).size()); + ASSERT(hasValue(pm.at(id), 5, ValueFlow::Value::Bound::Upper)); + ASSERT(!hasValue(pm.at(id), 3, ValueFlow::Value::Bound::Upper)); + + // an impossible value inside the range is kept + pm.setValue(tok, impossible(7)); + ASSERT_EQUALS(3U, pm.at(id).size()); + ASSERT(hasValue(pm.at(id), 7, ValueFlow::Value::Bound::Point)); + + // x > 5 and x != 6 is x > 6, and then x != 7 makes it x > 7 + pm.setValue(tok, impossible(6)); + ASSERT_EQUALS(2U, pm.at(id).size()); + ASSERT(hasValue(pm.at(id), 7, ValueFlow::Value::Bound::Upper)); + ASSERT(hasValue(pm.at(id), 10, ValueFlow::Value::Bound::Lower)); + } + + void setValueReplacesConstraints() const { + SimpleTokenList tokenlist("1+1;\n"); + Token* tok = tokenlist.front(); + const nonneg int id = 123; + tok->exprId(id); + + ProgramMemory pm; + pm.setValue(tok, greaterThan(3)); + pm.setValue(tok, lessThan(10)); + + // a value of the expression replaces its constraints + pm.setValue(tok, ValueFlow::Value{5}); + MathLib::bigint i = 0; + ASSERT(pm.getIntValue(id, i)); + ASSERT_EQUALS(5, i); + ASSERT_EQUALS(1U, pm.at(id).size()); + + // a constraint the value satisfies keeps the value + pm.setValue(tok, greaterThan(3)); + pm.setValue(tok, impossible(7)); + ASSERT(pm.getIntValue(id, i)); + ASSERT_EQUALS(5, i); + + // a constraint the value violates replaces the value + pm.setValue(tok, impossible(5)); + ASSERT(!pm.getIntValue(id, i)); + ASSERT_EQUALS(1U, pm.at(id).size()); + ASSERT(pm.at(id).front().isImpossible()); + + // a possible value with a bound is a value of the expression + pm.setValue(tok, ValueFlow::Value{4, ValueFlow::Value::Bound::Lower}); + ASSERT(pm.getIntValue(id, i)); + ASSERT_EQUALS(4, i); + + // a value of another type replaces the value + pm.setValue(tok, containerSize(ValueFlow::Value{3})); + ASSERT(!pm.getIntValue(id, i)); + ASSERT(pm.getContainerSizeValue(id, i)); + ASSERT_EQUALS(3, i); + + pm.setUnknown(tok); + ASSERT(pm.hasValue(id)); + ASSERT(pm.getValue(id)); + ASSERT(pm.getValue(id)->isUninitValue()); + } + + void containerEmpty() const { + SimpleTokenList tokenlist("1+1;\n"); + Token* tok = tokenlist.front(); + const nonneg int id = 123; + tok->exprId(id); + + ProgramMemory pm; + MathLib::bigint empty = -1; + ASSERT(!pm.getContainerEmptyValue(id, empty)); + + pm.setContainerSizeValue(tok, 0); + ASSERT(pm.getContainerEmptyValue(id, empty)); + ASSERT_EQUALS(1, empty); + + pm.setContainerSizeValue(tok, 3); + ASSERT(pm.getContainerEmptyValue(id, empty)); + ASSERT_EQUALS(0, empty); + + // size != 0 + pm.clear(); + pm.setContainerSizeValue(tok, 0, false); + ASSERT(pm.getContainerEmptyValue(id, empty)); + ASSERT_EQUALS(0, empty); + + // size > 2 + pm.clear(); + pm.setValue(tok, containerSize(greaterThan(2))); + ASSERT(pm.getContainerEmptyValue(id, empty)); + ASSERT_EQUALS(0, empty); + + // size < 1 + pm.clear(); + pm.setValue(tok, containerSize(lessThan(1))); + ASSERT(pm.getContainerEmptyValue(id, empty)); + ASSERT_EQUALS(1, empty); + + // size < 5 does not decide it + pm.clear(); + pm.setValue(tok, containerSize(lessThan(5))); + ASSERT(!pm.getContainerEmptyValue(id, empty)); + } + + // Remove the values ValueFlow attached to the tokens, so that only the program memory decides. + // Numbers keep their value, as they always have it. + static void clearValues(SimpleTokenizer& tokenizer) { + for (Token* tok = tokenizer.list.front(); tok; tok = tok->next()) { + if (!tok->isNumber()) + tok->clearValueFlow(); + } + } + + // The right hand sides of the assignments to the variable, in order + static std::vector assignedExpressions(const Token* tokens, const std::string& var) { + std::vector result; + for (const Token* tok = tokens; tok; tok = tok->next()) { + if (tok->str() == "=" && tok->astOperand1() && tok->astOperand1()->str() == var && tok->astOperand2()) + result.push_back(tok->astOperand2()); + } + return result; + } + + // Evaluate the expression with the program memory. The result as a string, empty if it is unknown. + std::string evaluate(const Token* expr, ProgramMemory pm) const { + MathLib::bigint result = 0; + bool error = false; + execute(expr, pm, &result, &error, settings); + return error ? "" : std::to_string(result); + } + + // Evaluate the expression with the program memory built from the conditions enclosing it + std::string evaluate(const Token* expr) const { + ProgramMemoryState pms(settings); + pms.addState(expr, {}); + return evaluate(expr, pms.state); + } + + // The results of the expressions assigned to y in the code, each evaluated at its position + // Tokenize the code and return the expressions assigned to y, in order. The ValueFlow values are + // removed so that only the program memory decides, unless they are kept. + std::vector parseAssignments(SimpleTokenizer& tokenizer, const char code[], bool clear = true) const { + ASSERT(tokenizer.tokenize(code)); + if (clear) + clearValues(tokenizer); + return assignedExpressions(tokenizer.tokens(), "y"); + } + + // Run the statement of the operator on the program memory + void step(const Token* op, ProgramMemory& pm) const { + execute(op, pm, nullptr, nullptr, settings); + } + + std::vector evaluateAssignments(const char code[]) { + SimpleTokenizer tokenizer(settings, *this); + const std::vector exprs = parseAssignments(tokenizer, code); + std::vector results; + std::transform(exprs.cbegin(), exprs.cend(), std::back_inserter(results), [&](const Token* expr) { + return evaluate(expr); + }); + return results; + } + + void executeRange() { + const char code[] = "void f(int x, int y) {\n" + " if (x > 3) {\n" + " if (x < 10) {\n" + " y = x == 15;\n" + " y = x == 5;\n" + " y = x < 20;\n" + " y = x >= 4;\n" + " y = x + 1 > 4;\n" + " y = 10 - x < 7;\n" + " y = -x < 0;\n" + " y = x;\n" + " y = x + 1 < 20;\n" + " y = -x > -20;\n" + " y = (long)x < 20;\n" + " y = (x > 0 ? x : 0) < 20;\n" + " y = 2 * x - 1 == 3;\n" + " }\n" + " }\n" + "}\n"; + const std::vector results = evaluateAssignments(code); + ASSERT_EQUALS(13U, results.size()); + // 3 < x < 10 + ASSERT_EQUALS("0", results[0]); + ASSERT_EQUALS("", results[1]); + ASSERT_EQUALS("1", results[2]); + ASSERT_EQUALS("1", results[3]); + // the range is shifted by arithmetic + ASSERT_EQUALS("1", results[4]); + ASSERT_EQUALS("1", results[5]); + ASSERT_EQUALS("1", results[6]); + // a range is not a value + ASSERT_EQUALS("", results[7]); + // both bounds follow the value through arithmetic, casts and conditionals + ASSERT_EQUALS("1", results[8]); + ASSERT_EQUALS("1", results[9]); + ASSERT_EQUALS("1", results[10]); + ASSERT_EQUALS("1", results[11]); + ASSERT_EQUALS("0", results[12]); + } + + void executeScaledRange() { + const char code[] = "void f(int x, int y) {\n" + " if (x > 3) {\n" + " y = x * 2 > 6;\n" + " y = x * 2 == 7;\n" + " y = -2 * x < -6;\n" + " y = x * 0 == 0;\n" + " y = (x << 1) >= 8;\n" + " y = x % 2 == 0;\n" + " y = (x >> 1) == 1;\n" + " }\n" + " if (x > 6) {\n" + " y = x / 2 > 2;\n" + " y = x / -2 < -2;\n" + " }\n" + "}\n"; + const std::vector results = evaluateAssignments(code); + ASSERT_EQUALS(9U, results.size()); + // x > 3: x * 2 >= 8 + ASSERT_EQUALS("1", results[0]); + ASSERT_EQUALS("0", results[1]); + ASSERT_EQUALS("1", results[2]); + // x * 0 is not "not zero" + ASSERT_EQUALS("", results[3]); + ASSERT_EQUALS("1", results[4]); + // the remainder does not keep the range; x >> 1 >= 2 + ASSERT_EQUALS("", results[5]); + ASSERT_EQUALS("0", results[6]); + // x > 6: x / 2 >= 3 + ASSERT_EQUALS("1", results[7]); + ASSERT_EQUALS("1", results[8]); + } + + void executeSolvedRange() { + const char code[] = "void f(int x, int y) {\n" + " if (x * 2 < 3) {\n" + " y = x <= 1;\n" + " y = x == 1;\n" + " y = x == 2;\n" + " }\n" + " if (x * 3 >= 7) {\n" + " y = x >= 3;\n" + " y = x == 2;\n" + " }\n" + " if (-2 * x > 3) {\n" + " y = x <= -2;\n" + " y = x == -1;\n" + " }\n" + " if ((x ^ 4) > 3) {\n" + " y = x == 0;\n" + " }\n" + "}\n"; + const std::vector results = evaluateAssignments(code); + ASSERT_EQUALS(8U, results.size()); + // x * 2 < 3: x <= 1 + ASSERT_EQUALS("1", results[0]); + ASSERT_EQUALS("", results[1]); + ASSERT_EQUALS("0", results[2]); + // x * 3 >= 7: x >= 3 + ASSERT_EQUALS("1", results[3]); + ASSERT_EQUALS("0", results[4]); + // -2 * x > 3: x <= -2 + ASSERT_EQUALS("1", results[5]); + ASSERT_EQUALS("0", results[6]); + // (x ^ 4) > 3 does not give a range for x + ASSERT_EQUALS("", results[7]); + } + + void executeCompoundAssignment() { + const char code[] = "void f(int x, unsigned u, int y) {\n" + " x *= -1;\n" + " y = x < -3;\n" + " u--;\n" + " y = u > 100;\n" + "}\n"; + SimpleTokenizer tokenizer(settings, *this); + const std::vector exprs = parseAssignments(tokenizer, code); + ASSERT_EQUALS(2U, exprs.size()); + const Token* xtok = Token::findsimplematch(tokenizer.tokens(), "x *="); + const Token* utok = Token::findsimplematch(tokenizer.tokens(), "u --"); + ASSERT(xtok && utok); + + ProgramMemory pm; + // x > 3, then x *= -1: x < -3 + pm.setValue(xtok, greaterThan(3)); + step(xtok->next(), pm); + ASSERT_EQUALS("1", evaluate(exprs[0], pm)); + + // u < 1, then u--: the value wraps around, nothing is known + pm.setValue(utok, lessThan(1)); + step(utok->next(), pm); + ASSERT_EQUALS("", evaluate(exprs[1], pm)); + + // u > 3, then u--: u > 2 + pm.setValue(utok, greaterThan(3)); + step(utok->next(), pm); + ASSERT_EQUALS("", evaluate(exprs[1], pm)); + const ProgramMemory::Values* values = pm.getValues(utok->exprId()); + ASSERT(values); + ASSERT_EQUALS(1U, values->size()); + ASSERT(hasValue(*values, 2, ValueFlow::Value::Bound::Upper)); + } + + // Arithmetic on a range at the limit of the type does not overflow in the analyzer + void executeRangeAtLimit() { + const char code[] = "void f(long long x, long long y) {\n" + " y = x + 100 < 0;\n" + " y = x - 100 > 0;\n" + " y = 100 - x > 0;\n" + " y = x * 2 > 0;\n" + " y = (x << 1) > 0;\n" + " x++;\n" + " y = x > 0;\n" + "}\n"; + SimpleTokenizer tokenizer(settings, *this); + const std::vector exprs = parseAssignments(tokenizer, code); + ASSERT_EQUALS(6U, exprs.size()); + const Token* xtok = Token::findsimplematch(tokenizer.tokens(), "x +"); + const Token* inc = Token::findsimplematch(tokenizer.tokens(), "x ++"); + ASSERT(xtok && inc); + const MathLib::bigint max = std::numeric_limits::max(); + const MathLib::bigint min = std::numeric_limits::min(); + + // x > max - 10 + ProgramMemory pm; + pm.setValue(xtok, greaterThan(max - 10)); + ASSERT_EQUALS("", evaluate(exprs[0], pm)); + ASSERT_EQUALS("1", evaluate(exprs[1], pm)); + ASSERT_EQUALS("0", evaluate(exprs[2], pm)); + ASSERT_EQUALS("", evaluate(exprs[3], pm)); + ASSERT_EQUALS("", evaluate(exprs[4], pm)); + + // x < min + 10 + pm.clear(); + pm.setValue(xtok, lessThan(min + 10)); + ASSERT_EQUALS("1", evaluate(exprs[0], pm)); + ASSERT_EQUALS("", evaluate(exprs[1], pm)); + ASSERT_EQUALS("", evaluate(exprs[2], pm)); + ASSERT_EQUALS("", evaluate(exprs[3], pm)); + ASSERT_EQUALS("", evaluate(exprs[4], pm)); + + // x is the largest value: incrementing it is unknown + pm.clear(); + pm.setValue(xtok, ValueFlow::Value{max}); + step(inc->next(), pm); + ASSERT_EQUALS("", evaluate(exprs[5], pm)); + + // x > max - 2: incrementing moves the bound to the limit, which is still not known to overflow + pm.setValue(xtok, greaterThan(max - 2)); + step(inc->next(), pm); + ASSERT_EQUALS("1", evaluate(exprs[5], pm)); + } + + // The range of an unsigned expression is kept only when it cannot wrap around + void executeUnsignedRange() { + const char code[] = "void f(unsigned u, unsigned y) {\n" + " if (u > 3) {\n" + " y = u + 1 > 4;\n" + " y = u - 1 > 2;\n" + " y = u * 2 > 6;\n" + " }\n" + " if (u < 10) {\n" + " y = u - 1 < 9;\n" + " y = 10 - u > 0;\n" + " y = u + 1 < 11;\n" + " }\n" + " if (u > 3 && u < 10) {\n" + " y = u + 1 > 4;\n" + " y = u * 2 < 20;\n" + " }\n" + "}\n"; + const std::vector results = evaluateAssignments(code); + ASSERT_EQUALS(8U, results.size()); + // u > 3: adding and multiplying may wrap around, subtracting may not + ASSERT_EQUALS("", results[0]); + ASSERT_EQUALS("1", results[1]); + ASSERT_EQUALS("", results[2]); + // u < 10: subtracting may wrap around, the others may not + ASSERT_EQUALS("", results[3]); + ASSERT_EQUALS("1", results[4]); + ASSERT_EQUALS("1", results[5]); + // 3 < u < 10 + ASSERT_EQUALS("1", results[6]); + ASSERT_EQUALS("1", results[7]); + + const char code2[] = "void f(unsigned u, unsigned y) {\n" + " u++;\n" + " y = u > 4;\n" + "}\n"; + SimpleTokenizer tokenizer(settings, *this); + const std::vector exprs = parseAssignments(tokenizer, code2); + ASSERT_EQUALS(1U, exprs.size()); + const Token* utok = Token::findsimplematch(tokenizer.tokens(), "u ++"); + ASSERT(utok); + // u > 3, then u++: u may have wrapped around + ProgramMemory pm; + pm.setValue(utok, greaterThan(3)); + step(utok->next(), pm); + ASSERT_EQUALS("", evaluate(exprs[0], pm)); + // 3 < u < 10, then u++: u > 4 + pm.clear(); + pm.setValue(utok, greaterThan(3)); + pm.setValue(utok, lessThan(10)); + step(utok->next(), pm); + ASSERT_EQUALS("1", evaluate(exprs[0], pm)); + } + + // The size constraints of a container reach a container that is symbolically equal to it + void executeContainerAlias() { + const char code[] = "void f(std::string s, bool y) {\n" + " std::string t = s;\n" + " y = t.size() == 15;\n" + " y = t.size() < 20;\n" + "}\n"; + // the symbolic value of t is kept + SimpleTokenizer tokenizer(settings, *this); + const std::vector exprs = parseAssignments(tokenizer, code, /*clear*/ false); + ASSERT_EQUALS(2U, exprs.size()); + const Token* stok = Token::findsimplematch(tokenizer.tokens(), "s ;"); + ASSERT(stok); + // 3 < s.size() < 10 + ProgramMemory pm; + pm.setValue(stok, containerSize(greaterThan(3))); + pm.setValue(stok, containerSize(lessThan(10))); + ASSERT_EQUALS("0", evaluate(exprs[0], pm)); + ASSERT_EQUALS("1", evaluate(exprs[1], pm)); + } + + void executeContainerSizeRange() { + const char code[] = "void f(std::string s, bool y) {\n" + " if (s.size() > 3) {\n" + " if (s.size() < 10) {\n" + " y = s.size() == 15;\n" + " y = s.size() < 20;\n" + " y = s.empty();\n" + " y = s.size() == 5;\n" + " }\n" + " }\n" + "}\n"; + const std::vector results = evaluateAssignments(code); + ASSERT_EQUALS(4U, results.size()); + // 3 < s.size() < 10 + ASSERT_EQUALS("0", results[0]); + ASSERT_EQUALS("1", results[1]); + ASSERT_EQUALS("0", results[2]); + ASSERT_EQUALS("", results[3]); + } + + // An expression recorded as changed in an unknown way has no value: the marker is not a value + void executeUnknown() { + { + // The right hand side is unknown, so the assignment is not evaluated and the value recorded + // for the whole assignment expression (from a condition on it) is used instead of the marker + SimpleTokenizer tokenizer(settings, *this); + const std::vector exprs = parseAssignments(tokenizer, "void f(int x, int z, int y) {\n" + " y = (x = z) == 0;\n" + "}\n"); + ASSERT_EQUALS(1U, exprs.size()); + const Token* const compare = exprs[0]; + const Token* const assign = compare->astOperand1(); + ASSERT(assign && assign->str() == "="); + ProgramMemory pm; + pm.setValue(assign, ValueFlow::Value(0)); + pm.setUnknown(assign->astOperand2()); + ASSERT_EQUALS("1", evaluate(compare, pm)); + // the unknown right hand side does not replace the value of the left hand side + pm.setValue(assign->astOperand1(), ValueFlow::Value(3)); + step(assign, pm); + MathLib::bigint x = 0; + ASSERT(pm.getIntValue(assign->astOperand1()->exprId(), x)); + ASSERT_EQUALS(3, x); + } + { + // The symbolic value of an unknown expression still resolves it: result == p and p is 0 + SimpleTokenizer tokenizer(settings, *this); + const std::vector exprs = parseAssignments(tokenizer, + "char* f(char* path, int y) {\n" + " char* result = path;\n" + " char* p = result;\n" + " if (!p) {\n" + " y = !result;\n" + " }\n" + " return p;\n" + "}\n", + /*clear*/ false); + ASSERT_EQUALS(1U, exprs.size()); + ASSERT_EQUALS("1", evaluate(exprs[0])); + } + } }; REGISTER_TEST(TestProgramMemory) diff --git a/test/testtype.cpp b/test/testtype.cpp index 1b5b57f41ca..6f98efbda9e 100644 --- a/test/testtype.cpp +++ b/test/testtype.cpp @@ -219,9 +219,7 @@ class TestType : public TestFixture { " return 0;\n" " return rm>> k;\n" "}\n"); - ASSERT_EQUALS( - "[test.cpp:4] -> [test.cpp:6]: (warning) Shifting signed 32-bit value by 31 bits is undefined behaviour. See condition at line 4.\n", - errout_str()); + ASSERT_EQUALS("", errout_str()); // a right shift by 31 bits is defined check("int f(int k, int rm) {\n" " if (k == 0 || k == 32)\n" @@ -231,9 +229,7 @@ class TestType : public TestFixture { " else\n" " return rm>> k;\n" "}\n"); - ASSERT_EQUALS( - "[test.cpp:4] -> [test.cpp:7]: (warning) Shifting signed 32-bit value by 31 bits is undefined behaviour. See condition at line 4.\n", - errout_str()); + ASSERT_EQUALS("", errout_str()); // a right shift by 31 bits is defined check("int f(int k, int rm) {\n" " if (k == 0 || k == 32 || k == 31)\n" @@ -268,6 +264,29 @@ class TestType : public TestFixture { " }\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + // Shifting right by the width minus one bit is defined; shifting left is not + check("long long f(long long m, long long e) {\n" + " if (e <= 0) {\n" + " if (1 - e >= 64)\n" + " m = 0;\n" + " else\n" + " m >>= 1 - e;\n" + " }\n" + " return m;\n" + "}\n", dinit(CheckOptions, $.settings = &settings)); + ASSERT_EQUALS("", errout_str()); + + check("long long f(long long m, long long e) {\n" + " if (e <= 0) {\n" + " if (1 - e >= 64)\n" + " m = 0;\n" + " else\n" + " m <<= 1 - e;\n" + " }\n" + " return m;\n" + "}\n", dinit(CheckOptions, $.settings = &settings)); + ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:6]: (warning) Shifting signed 64-bit value by 63 bits is undefined behaviour. See condition at line 3.\n", errout_str()); } void checkIntegerOverflow() { diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 57940b1b3fd..3063e161d80 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -4367,7 +4367,21 @@ class TestUninitVar : public TestFixture { " if (x == 1)\n" " v = value;\n" "}\n"); - TODO_ASSERT_EQUALS("[test.cpp:6:9]: (error) Uninitialized variable: value [legacyUninitvar]\n", "", errout_str()); + ASSERT_EQUALS("[test.cpp:3:9] -> [test.cpp:5:9] -> [test.cpp:6:9]: (warning) Uninitialized variable: value [uninitvar]\n", errout_str()); + + // false path: 'flag' is false past the block + valueFlowUninit("void getX(int *p);\n" + "bool g();\n" + "void f() {\n" + " int x;\n" + " bool flag, ok;\n" + " ok = g();\n" + " flag = ok;\n" + " if (ok == true) { getX(&x); }\n" + " if (flag == true) { int a = x; }\n" + " if (flag == false) { int b = x; }\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:8:12] -> [test.cpp:10:14] -> [test.cpp:10:34]: (warning) Uninitialized variable: x [uninitvar]\n", errout_str()); valueFlowUninit("void f(int x) {\n" " int value;\n" @@ -6134,7 +6148,7 @@ class TestUninitVar : public TestFixture { " if (b == 'x') {}\n" " if (a) {}\n" "}\n"); - TODO_ASSERT_EQUALS("[test.cpp:8]: (error) Uninitialized variable: a\n", "", errout_str()); + ASSERT_EQUALS("[test.cpp:3:11] -> [test.cpp:5:11] -> [test.cpp:7:11] -> [test.cpp:8:9]: (warning) Uninitialized variable: a [uninitvar]\n", errout_str()); valueFlowUninit("void h() {\n" " int i;\n" diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 3609bf2aee2..cd7d0c17e77 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -99,6 +99,7 @@ class TestValueFlow : public TestFixture { TEST_CASE(valueFlowForwardTryCatch); TEST_CASE(valueFlowForwardInconclusiveImpossible); TEST_CASE(valueFlowForwardConst); + TEST_CASE(valueFlowForwardConditionFork); TEST_CASE(valueFlowForwardAfterCondition); TEST_CASE(valueFlowFwdAnalysis); @@ -128,6 +129,7 @@ class TestValueFlow : public TestFixture { TEST_CASE(valueFlowUninit); TEST_CASE(valueFlowConditionExpressions); + TEST_CASE(valueFlowConditionRanges); TEST_CASE(valueFlowContainerSize); TEST_CASE(valueFlowContainerSizeIterator); @@ -4491,6 +4493,167 @@ class TestValueFlow : public TestFixture { ASSERT_EQUALS(true, testValueOfXKnown(code, 8U, 3)); } + void valueFlowForwardConditionFork() + { + const char* code; + + // the then-path runs on a fork, the else-path on the main traversal, which knows + // the condition is false: only the fork reaches line 4 + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 3) {}\n" + " if (n > 6) { int a = x; }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 1)); + + // the main path's assumption does not make the value conditional + code = "void f(int n, int y) {\n" + " int x = 1;\n" + " if (n > 5) n = 5;\n" + " if (y) { int a = x; }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfXKnown(code, 4U, 1)); + + // then-branch dead: the main path is the false path and the value is conditional + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 5) x = 2;\n" + " if (n > 5) { int a = x; }\n" + " if (n <= 5) { int b = x; }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 4U, 2)); + ASSERT_EQUALS(true, testValueOfX(code, 5U, 1)); + ASSERT_EQUALS(false, testValueOfXKnown(code, 5U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 5U, 2)); + + // the fork continues after the if with the block's assignments (else escapes) + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 5) { n = 5; } else { return; }\n" + " if (n == 5) { int a = x; }\n" + " if (n != 5) { int b = x; }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 5U, 1)); + + // the main path continues with the else block's assignments (then escapes) + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 5) { return; } else { n = 5; }\n" + " if (n == 5) { int a = x; }\n" + " if (n != 5) { int b = x; }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 5U, 1)); + + // both blocks assign: each path keeps its own assignment + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 5) { n = 5; } else { n = 0; }\n" + " if (n > 5) { int a = x; }\n" + " if (n <= 5) { int b = x; }\n" + " if (n == 5) { int c = x; }\n" + " if (n == 0) { int d = x; }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 5U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 6U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 7U, 1)); + + // a value changed in one branch is possible on both paths + code = "void f(int c) {\n" + " int x = 1;\n" + " if (c) {} else { x = 2; }\n" + " int a = x;\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(false, testValueOfXKnown(code, 4U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 4U, 2)); + + // an impossible value cannot be lowered: the fork stops + code = "void f(int x, int c) {\n" + " if (x == 0) return;\n" + " if (c) {} else { x = 0; }\n" + " int a = x;\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfXImpossible(code, 4U, 0)); + ASSERT_EQUALS(true, testValueOfX(code, 4U, 0)); + + code = "void f(int x, int c) {\n" + " if (x == 0) return;\n" + " if (c) {} else {}\n" + " int a = x;\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfXImpossible(code, 4U, 0)); + + // 'n <= 5' leaves 'n > 3' undecided: the conditional value is split + code = "void f(int n) {\n" + " int x = 0;\n" + " if (n > 5) { x = 1; }\n" + " if (n > 3) { int a = x; }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 0)); + ASSERT_EQUALS(true, testValueOfX(code, 4U, 1)); + + code = "void f(int n) {\n" + " int x = 0;\n" + " if (n > 5) { x = 1; }\n" + " if (n == 2) { int a = x; }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 0)); + + code = "void f(int n) {\n" + " int x = 0;\n" + " if (n > 5) { x = 1; }\n" + " if (!(n < 3)) { int a = x; }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 0)); + + code = "void f(int n) {\n" + " int x = 0;\n" + " if (n > 5) { x = 1; }\n" + " if (n - 3 > 0) { int a = x; }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 0)); + + // decided false: the block is not reached + code = "void f(int n) {\n" + " int x = 0;\n" + " if (n > 5) { x = 1; }\n" + " if (n == 7) { int a = x; }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 4U, 0)); + + // not covered by the state: no split + code = "void f(int n, int c) {\n" + " int x = 0;\n" + " if (n > 5) { x = 1; }\n" + " if (c) { int a = x; }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 4U, 0)); + + code = "int g(int);\n" + "void f(int n) {\n" + " int x = 0;\n" + " if (n > 5) { x = 1; }\n" + " if (g(n)) { int a = x; }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 5U, 0)); + + // no fork: the main path still knows the condition is false + /*const*/ Settings s(settings); + s.vfOptions.maxForwardConditionForkDepth = 0; + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 5) n = 5;\n" + " if (n > 5) { int a = x; }\n" + " if (n <= 5) { int b = x; }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 4U, 1, &s)); + ASSERT_EQUALS(true, testValueOfX(code, 5U, 1, &s)); + } + void valueFlowForwardAfterCondition() { const char* code; @@ -9160,6 +9323,146 @@ class TestValueFlow : public TestFixture { ASSERT_EQUALS(true, testValueOfXImpossible(code, 4U, 0)); } + // The ranges that conditions give the program memory decide which branches a value reaches + void valueFlowConditionRanges() { + const char* code; + + // n > 3 does not mean that n is 4: the else branch is reachable + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 3) {\n" + " if (n < 10) {}\n" + " else { int a = x; }\n" + " }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 5U, 1)); + + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 3) {\n" + " if (n == 15) { int a = x; }\n" + " }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 1)); + + // 3 < n < 10: n == 15 is impossible, n == 5 is not + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 3 && n < 10) {\n" + " if (n == 15) { int a = x; }\n" + " if (n == 5) { int b = x; }\n" + " }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 5U, 1)); + + // a condition on the same variable is decided from the range + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 3) {\n" + " if (n > 2) { int a = x; }\n" + " else { int b = x; }\n" + " }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 5U, 1)); + + // n >= 0 and n != 0 is n > 0 + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n < 0) return;\n" + " if (n == 0) return;\n" + " if (n > 0) { int a = x; }\n" + " else { int b = x; }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 5U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 6U, 1)); + + // the range is shifted and scaled by arithmetic + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 3) {\n" + " if (n + 1 > 4) { int a = x; }\n" + " else { int b = x; }\n" + " if ((n << 1) >= 8) { int c = x; }\n" + " else { int d = x; }\n" + " if (n * 2 == 7) { int e = x; }\n" + " if (-2 * n < -6) { int g = x; }\n" + " else { int h = x; }\n" + " }\n" + " if (n > 6) {\n" + " if (n / 2 > 2) { int i = x; }\n" + " else { int j = x; }\n" + " }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 5U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 6U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 7U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 8U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 9U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 10U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 13U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 14U, 1)); + + // the range of a product is solved exactly + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n * 2 < 3) {\n" + " if (n == 1) { int a = x; }\n" + " if (n == 2) { int b = x; }\n" + " }\n" + " if (-2 * n > 3) {\n" + " if (n == -2) { int c = x; }\n" + " if (n == -1) { int d = x; }\n" + " }\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 5U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 8U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 9U, 1)); + + // a range that excludes zero is true as a bool; one that includes zero is not known + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 3) {\n" + " if (n) {} else { int a = x; }\n" + " }\n" + " if (n > -5) {\n" + " if (n) {} else { int b = x; }\n" + " }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 7U, 1)); + + // container sizes + code = "void f(const std::string& s) {\n" + " int x = 1;\n" + " if (s.size() > 3 && s.size() < 10) {\n" + " if (s.size() == 15) { int a = x; }\n" + " if (s.empty()) { int b = x; }\n" + " if (s.size() < 20) { int c = x; }\n" + " else { int d = x; }\n" + " }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 5U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 6U, 1)); + ASSERT_EQUALS(false, testValueOfX(code, 7U, 1)); + + // clamped: false on both paths + code = "void f(int n) {\n" + " int x = 1;\n" + " if (n > 5) n = 5;\n" + " if (n > 5) { int a = x; }\n" + " if (n <= 5) { int b = x; }\n" + " if (n < 5) { int c = x; }\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 4U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 5U, 1)); + ASSERT_EQUALS(true, testValueOfX(code, 6U, 1)); + } + void valueFlowSymbolic() { const char* code;