cppcheck/cppcheck.spec

138 lines
4.6 KiB
RPMSpec
Raw Normal View History

#
# spec file for package cppcheck
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: cppcheck
Version: 2.12.1
Release: 0
Summary: A tool for static C/C++ code analysis
License: GPL-3.0-or-later
URL: https://github.com/danmar/cppcheck
Source: https://github.com/danmar/cppcheck/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: eb076d87.patch
Patch1: werror-return-type.patch
BuildRequires: cmake
BuildRequires: docbook-xsl-stylesheets
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libqt5-linguist-devel
BuildRequires: pkgconfig
BuildRequires: python3-base
BuildRequires: xsltproc
BuildRequires: z3-devel
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Gui)
Accepting request 855374 from home:milsav92:branches:devel:tools - Update to version 2.3 Improved C++ parser: * types * wrong operands in ast * better simplification of templates Improved clang import, various fixes. Improved value flow analysis Fixed false positives Improved configuration in library files * boost.cfg * googletest.cfg * qt.cfg * windows.cfg * wxwidgets.cfg Added several Misra rules: * 6.1 * 6.2 * 7.2 * 7.4 * 9.2 * 10.2 * 15.4 Added platforms: * elbrus e1c+ * pic * pic8 * mips - Update to version 2.2 New checks: * incorrect usage of mutexes and lock guards * Dereference end iterator * Iterating a known empty container * outOfBounds check for iterators to containers Removed 'operator=' check that ensures reference to self is returned. That is not about safety. Improved parser * various ast fixes Clang parser * The Clang import feature in Cppcheck should be considered to be experimental for now. There are problems. Improved bug hunting * variable constraints * handling of multidimension arrays * function calls, execute functions that are in same TU * improved handling of containers * several improvements for uninitialized variables check * improved analysis of for loops * added a hash value for warnings that can be used for suppressions Improved data flow * one more heuristic for ternary operators * improved data flow for containers CLI: * Fixed some addon execution problems when there are spaces etc GUI: * Fix handling of tags * Exclude files cppcheck-htmlreport: * several result files can be combined into 1 output Suppressions: * comments can be added at end of suppression in suppressions file OBS-URL: https://build.opensuse.org/request/show/855374 OBS-URL: https://build.opensuse.org/package/show/devel:tools/cppcheck?expand=0&rev=72
2020-12-16 14:21:00 +01:00
BuildRequires: pkgconfig(Qt5Help)
BuildRequires: pkgconfig(Qt5Network)
BuildRequires: pkgconfig(Qt5PrintSupport)
BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(libpcre)
ExcludeArch: %ix86 %arm
Requires: python3-Pygments
%description
This program tries to detect bugs that your C/C++ compiler don't see. Cppcheck
is versatile. You can check non-standard code that includes various compiler
extensions, inline assembly code, etc. Checking covers for example these
errors:
* Out of bounds
* Uninitialized member variable 'classname::varname'
* Using 'memfunc' on class
* Using 'memfunc' on struct that contains a 'std::classname'
* Class Base which is inherited by class Derived does not have a virtual
destructor
* Memory leak: varname
* Resource leak: varname
* Deallocating a deallocated pointer: varname
* Using 'varname' after it is deallocated / released
* Invalid radix in call to strtol or strtoul. Must be 0 or 2-36
* Overlapping data buffer varname
* Unsigned division. The result will be wrong.
* Unusual pointer arithmetic
%package gui
Summary: A tool for static C/C++ code analysis
Requires: cppcheck
%description gui
This is the gui for Cppcheck, a program to detect bugs that your C/C++ compiler
doesn't see.
%prep
%autosetup -p1
%build
%cmake \
-DCMAKE_CXX_FLAGS="%{optflags} -UNDEBUG" \
-DFILESDIR="%{_datadir}/%{name}" \
-DBUILD_GUI=ON \
-DBUILD_TESTS=ON \
-DHAVE_RULES=yes \
-DUSE_Z3=yes
%cmake_build
# does not work with CMake, directly call provided Makefile from source directory
cd ..
%make_build man \
DB2MAN=%{_datadir}/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl
# use python3 as interpreter
sed -i "s|env python3|python3|g" htmlreport/cppcheck-htmlreport
%check
export CXXFLAGS="%{optflags}"
%define _smp_mflags -j1
%ctest
%install
install -Dpm 0755 build/bin/cppcheck \
%{buildroot}%{_bindir}/cppcheck
install -Dpm 0755 htmlreport/cppcheck-htmlreport \
%{buildroot}%{_bindir}/cppcheck-htmlreport
install -Dpm 0755 build/bin/cppcheck-gui \
%{buildroot}%{_bindir}/cppcheck-gui
install -Dpm 0644 cppcheck.1 \
%{buildroot}%{_mandir}/man1/cppcheck.1
install -d %{buildroot}%{_datadir}/%{name}/cfg
install -pm 0644 cfg/*.cfg %{buildroot}%{_datadir}/%{name}/cfg
install -d %{buildroot}%{_datadir}/%{name}/platforms
install -pm 0644 platforms/*.xml %{buildroot}%{_datadir}/%{name}/platforms
install -d %{buildroot}%{_datadir}/%{name}/addons
install -pm 0644 addons/*.py %{buildroot}%{_datadir}/%{name}/addons
# Give execute permission to python addons with a shebang to fix non-executable-script
find %{buildroot}%{_datadir}/%{name}/addons -type f -size +0 -exec awk 'NR == 1 && /^#!.*python/ { exit } { exit 1 }' {} \; -print0 | xargs -0 chmod +x
# Correct shebang to fix env-script-interpreter
find %{buildroot}%{_datadir}/%{name}/addons -type f -size +0 -exec awk 'NR == 1 && /^#!.*python/ { exit } { exit 1 }' {} \; -print0 | xargs -0 sed -i "s|env python3|python3|g"
# Remove duplicate files
%fdupes -s %{buildroot}%{_datadir}/%{name}/platforms
%files
Accepting request 577725 from home:alois:branches:devel:tools - Update to version 1.82 Bug fixes: * Better handling of namespaces * Fixed false positives * Fixed parsing of compile databases * Fixed parsing of visual studio projects Enhancements * New check; Detect mistakes when there are multiple strcmp() in condition Example: if (strcmp(password,"A")==0 || strcmp(password,"B")==0 || strcmp(password,"C")) There is a missing '==0', and therefore this condition is always true except when password is "C". * New check; pointer calculation result can't be NULL unless there is overflow Example: someType **list_p = ...; if ((list_p + 1) == NULL) The result for '(list_p + 1)' can't be NULL unless there is overflow (UB). * New check; public interface of classes should be safe - detect possible division by zero Example: class Fred { public: void setValue(int mul, int div) { value = mul / div; // <- unsafe } ... This check does not consider how Fred::setValue() is really called. If you agree that the public interface of classes should always be safe; it should be allowed to call all public methods with arbitrary arguments, then this checker will be useful. * Fixed a few false negatives * More information in the cfg files version 1.81 CPPCHECK: * New warning: Check if condition after an early return is overlapping and therefore always false. * Improved knowledge about C/C++ standard, windows, posix, wxwidgets, gnu * Better handling of Visual Studio projects GUI: * Compile: Qt5 is now needed to build the GUI * Compile: New qmake flag HAVE_QCHART * Project: You can now run cppcheck-addons * Project: We have integrated clang-tidy * Results view: Reload last results (if cppcheck build dir is used) when GUI is started * Results view: Tag the warnings with custom keywords (bug/todo/not important/etc..) * Results view: Shows when warning first appeared (since date) * Results view: Suppress warnings through right-click menu * Statistics: Added charts (shown if Qt charts module is enabled during build) version 1.80 Checking improvements: * Added platform for Atmel AVR 8 bit microcontrollers (avr8) * Better 'callstacks' in cppcheck messages * Improved gnu.cfg, posix.cfg, wxwidgets.cfg and std.cfg, added motif.cfg * Various improvements to AST, ValueFlow analysis and template parsing Command line changes: * Deprecated command line argument *-append has been removed * New command line argument *-plist-output to create .plist files * New command line argument *-output-file to print output to file directly * Check OpenCL files (.cl) GUI: * Support export of statistics to PDF * Several small usability improvements * Additionally, lots of false positives and bugs have been fixed and several existing checks have been improved. version 1.79 General changes: * C++ code in C files is rejected now (use *-language=c++ to enforce checking the code as C++) * Write function access type to XML dump Checking improvements: * Improved configuration extraction in preprocessor * Improved accuracy of AST * Improved template parsing * Improved support for (STL) containers in SymbolDatabase * Improved support for C++11's 'auto' type * Experimental support for uninitialized variables in ValueFlow analysis * Added qt.cfg and sfml.cfg, improved several existing .cfg files GUI: * Use CFGDIR macro * Additionally, lots of false positives and bugs have been fixed and several existing checks have been improved. version 1.78 General changes: * Reduced memory usage by up to 10% by reducing size of token list New checks: * Mismatching argument names between function declaration and definition * Detect classes which have a copy constructor but no copy operator and vice versa Checking improvements: * Improved matching of overloaded functions * Improved ValueType analysis, especially related to allocations with "new" and C++11's "auto" * Improved support for C++11 brace initialization * Improved ValueFlow analysis * Improved template parsing * Improved detection of memory leaks * Improved nullpointer checking when nullptr and NULL are used * Detect array out of bounds across compilation units * Extended windows.cfg, posix.cfg and std.cfg * Additionally, lots of false positives and bugs have been fixed and several existing checks have been improved. OBS-URL: https://build.opensuse.org/request/show/577725 OBS-URL: https://build.opensuse.org/package/show/devel:tools/cppcheck?expand=0&rev=51
2018-02-19 04:33:22 +01:00
%doc AUTHORS
%license COPYING
%{_bindir}/cppcheck
%{_bindir}/cppcheck-htmlreport
%{_datadir}/%{name}/
%{_mandir}/man1/cppcheck.1%{?ext_man}
%files gui
%{_bindir}/cppcheck-gui
%changelog