2014-01-12 02:24:21 +01:00
|
|
|
#
|
|
|
|
# spec file for package cppcheck
|
|
|
|
#
|
2023-01-30 13:09:12 +01:00
|
|
|
# Copyright (c) 2023 SUSE LLC
|
2014-01-12 02:24:21 +01:00
|
|
|
#
|
|
|
|
# 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.
|
2009-02-20 17:30:26 +01:00
|
|
|
|
2018-12-27 11:04:40 +01:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2014-01-12 02:24:21 +01:00
|
|
|
#
|
2011-01-06 17:48:30 +01:00
|
|
|
|
2015-09-15 20:52:26 +02:00
|
|
|
|
2010-06-01 23:32:29 +02:00
|
|
|
Name: cppcheck
|
2023-09-19 16:21:34 +02:00
|
|
|
Version: 2.12.1
|
2010-08-22 19:03:01 +02:00
|
|
|
Release: 0
|
2014-01-12 02:24:21 +01:00
|
|
|
Summary: A tool for static C/C++ code analysis
|
2018-10-18 12:38:02 +02:00
|
|
|
License: GPL-3.0-or-later
|
2021-03-23 08:20:41 +01:00
|
|
|
URL: https://github.com/danmar/cppcheck
|
2021-03-24 12:08:27 +01:00
|
|
|
Source: https://github.com/danmar/cppcheck/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
2023-11-10 09:57:12 +01:00
|
|
|
Patch0: eb076d87.patch
|
2023-09-15 09:59:45 +02:00
|
|
|
Patch1: werror-return-type.patch
|
2018-12-27 09:40:19 +01:00
|
|
|
BuildRequires: cmake
|
2014-01-12 02:24:21 +01:00
|
|
|
BuildRequires: docbook-xsl-stylesheets
|
2023-02-01 10:32:41 +01:00
|
|
|
BuildRequires: fdupes
|
2014-01-12 02:24:21 +01:00
|
|
|
BuildRequires: gcc-c++
|
2018-12-27 11:04:40 +01:00
|
|
|
BuildRequires: libqt5-linguist-devel
|
|
|
|
BuildRequires: pkgconfig
|
|
|
|
BuildRequires: python3-base
|
2014-01-12 02:24:21 +01:00
|
|
|
BuildRequires: xsltproc
|
2020-07-14 07:24:49 +02:00
|
|
|
BuildRequires: z3-devel
|
2018-12-27 11:04:40 +01:00
|
|
|
BuildRequires: pkgconfig(Qt5Core)
|
|
|
|
BuildRequires: pkgconfig(Qt5Gui)
|
2020-12-16 14:21:00 +01:00
|
|
|
BuildRequires: pkgconfig(Qt5Help)
|
2022-12-07 23:59:57 +01:00
|
|
|
BuildRequires: pkgconfig(Qt5Network)
|
2018-12-27 11:04:40 +01:00
|
|
|
BuildRequires: pkgconfig(Qt5PrintSupport)
|
2022-03-20 20:31:39 +01:00
|
|
|
BuildRequires: pkgconfig(Qt5Test)
|
2018-12-27 11:04:40 +01:00
|
|
|
BuildRequires: pkgconfig(Qt5Widgets)
|
|
|
|
BuildRequires: pkgconfig(libpcre)
|
2022-04-21 22:36:47 +02:00
|
|
|
ExcludeArch: %ix86 %arm
|
2018-12-27 09:40:19 +01:00
|
|
|
Requires: python3-Pygments
|
2011-08-08 06:45:14 +02:00
|
|
|
|
2009-02-20 17:30:26 +01:00
|
|
|
%description
|
2011-01-06 17:48:30 +01:00
|
|
|
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:
|
2009-02-20 17:30:26 +01:00
|
|
|
|
|
|
|
* Out of bounds
|
|
|
|
* Uninitialized member variable 'classname::varname'
|
|
|
|
* Using 'memfunc' on class
|
|
|
|
* Using 'memfunc' on struct that contains a 'std::classname'
|
2011-01-06 17:48:30 +01:00
|
|
|
* Class Base which is inherited by class Derived does not have a virtual
|
|
|
|
destructor
|
2009-02-20 17:30:26 +01:00
|
|
|
* 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
|
|
|
|
|
2011-01-06 17:48:30 +01:00
|
|
|
%package gui
|
|
|
|
Summary: A tool for static C/C++ code analysis
|
2014-01-12 02:24:21 +01:00
|
|
|
Requires: cppcheck
|
|
|
|
|
2011-01-06 17:48:30 +01:00
|
|
|
%description gui
|
2011-08-08 06:45:14 +02:00
|
|
|
|
2011-01-06 17:48:30 +01:00
|
|
|
This is the gui for Cppcheck, a program to detect bugs that your C/C++ compiler
|
2011-08-08 06:45:14 +02:00
|
|
|
doesn't see.
|
2011-01-06 17:48:30 +01:00
|
|
|
|
2009-02-20 17:30:26 +01:00
|
|
|
%prep
|
2021-05-10 12:52:49 +02:00
|
|
|
%autosetup -p1
|
2009-02-20 17:30:26 +01:00
|
|
|
|
|
|
|
%build
|
2018-12-27 09:40:19 +01:00
|
|
|
%cmake \
|
2023-09-15 09:59:45 +02:00
|
|
|
-DCMAKE_CXX_FLAGS="%{optflags} -UNDEBUG" \
|
2020-03-12 20:38:37 +01:00
|
|
|
-DFILESDIR="%{_datadir}/%{name}" \
|
2018-12-27 11:04:40 +01:00
|
|
|
-DBUILD_GUI=ON \
|
|
|
|
-DBUILD_TESTS=ON \
|
2020-07-14 07:24:49 +02:00
|
|
|
-DHAVE_RULES=yes \
|
|
|
|
-DUSE_Z3=yes
|
2020-03-04 13:18:09 +01:00
|
|
|
%cmake_build
|
2009-02-20 17:30:26 +01:00
|
|
|
|
2018-12-27 09:40:19 +01:00
|
|
|
# does not work with CMake, directly call provided Makefile from source directory
|
|
|
|
cd ..
|
2020-03-04 13:18:09 +01:00
|
|
|
%make_build man \
|
2014-01-12 02:24:21 +01:00
|
|
|
DB2MAN=%{_datadir}/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl
|
2018-12-27 11:04:40 +01:00
|
|
|
|
|
|
|
# use python3 as interpreter
|
2023-02-01 10:32:41 +01:00
|
|
|
sed -i "s|env python3|python3|g" htmlreport/cppcheck-htmlreport
|
2014-01-12 02:24:21 +01:00
|
|
|
|
2009-02-20 17:30:26 +01:00
|
|
|
%check
|
2018-12-27 11:04:40 +01:00
|
|
|
export CXXFLAGS="%{optflags}"
|
2023-06-01 12:02:25 +02:00
|
|
|
%define _smp_mflags -j1
|
2020-03-04 13:18:09 +01:00
|
|
|
%ctest
|
2009-02-20 17:30:26 +01:00
|
|
|
|
|
|
|
%install
|
2018-12-27 11:04:40 +01:00
|
|
|
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
|
2020-03-12 20:38:37 +01:00
|
|
|
install -d %{buildroot}%{_datadir}/%{name}/cfg
|
|
|
|
install -pm 0644 cfg/*.cfg %{buildroot}%{_datadir}/%{name}/cfg
|
2023-02-01 10:32:41 +01:00
|
|
|
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
|
2009-02-20 17:30:26 +01:00
|
|
|
|
|
|
|
%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
|
2009-02-20 17:30:26 +01:00
|
|
|
%{_bindir}/cppcheck
|
2011-01-06 17:48:30 +01:00
|
|
|
%{_bindir}/cppcheck-htmlreport
|
2014-01-13 14:01:10 +01:00
|
|
|
%{_datadir}/%{name}/
|
2018-12-27 11:04:40 +01:00
|
|
|
%{_mandir}/man1/cppcheck.1%{?ext_man}
|
2011-01-06 17:48:30 +01:00
|
|
|
|
|
|
|
%files gui
|
2010-06-01 23:32:29 +02:00
|
|
|
%{_bindir}/cppcheck-gui
|
2010-12-29 10:33:04 +01:00
|
|
|
|
|
|
|
%changelog
|