[segyio] 266/376: Add cppcheck support

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

jokva-guest pushed a commit to branch debian
in repository segyio.

commit 699fa5979df7277e88b418977935adeeeb9129ea
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date:   Wed Mar 29 13:43:37 2017 +0200

    Add cppcheck support
    
    cppcheck http://cppcheck.sourceforge.net/ is a nifty static analyser,
    but requires some configuration of the library and some suppressions to
    be useful. It can nicely be integrated into the CI process, or be run on
    downstream code.
---
 cppcheck/segyio.cfg       | 131 ++++++++++++++++++++++++++++++++++++++++++++++
 cppcheck/suppressions.txt |   5 ++
 2 files changed, 136 insertions(+)

diff --git a/cppcheck/segyio.cfg b/cppcheck/segyio.cfg
new file mode 100644
index 0000000..1e13772
--- /dev/null
+++ b/cppcheck/segyio.cfg
@@ -0,0 +1,131 @@
+<?xml version="1.0"?>
+<def format="2">
+
+  <!-- segy_file* segy_open( const char* path, const char* mode ); -->
+  <function name="segy_open">
+    <leak-ignore/>
+    <noreturn>false</noreturn>
+    <use-retval/>
+
+    <arg nr="1">
+      <not-uninit/>
+      <not-null/>
+      <strz/>
+    </arg>
+    <arg nr="2">
+      <not-uninit/>
+      <not-null/>
+      <strz/>
+    </arg>
+  </function>
+
+  <!-- int segy_mmap( segy_file* fd ); -->
+  <function name="segy_mmap">
+    <leak-ignore/>
+    <noreturn>false</noreturn>
+
+    <arg nr="1">
+      <not-uninit/>
+      <not-null/>
+    </arg>
+  </function>
+
+  <!-- int segy_close( segy_file* fd ); -->
+  <function name="segy_close">
+    <noreturn>false</noreturn>
+    <arg nr="1">
+      <not-uninit/>
+      <not-null/>
+    </arg>
+  </function>
+
+  <!-- int segy_get_field( const char* traceheader, int field, int32_t* f ); -->
+  <function name="segy_get_field">
+    <noreturn>false</noreturn>
+    <leak-ignore/>
+
+    <arg nr="1">
+      <not-uninit/>
+      <not-null/>
+    </arg>
+    <arg nr="2">
+      <not-uninit/>
+      <not-bool/>
+    </arg>
+    <arg nr="3">
+      <not-null/>
+    </arg>
+  </function>
+
+  <!-- int segy_get_bfield( const char* binheader, int field, int32_t* f ); -->
+  <function name="segy_get_bfield">
+    <noreturn>false</noreturn>
+    <leak-ignore/>
+
+    <arg nr="1">
+      <not-uninit/>
+      <not-null/>
+    </arg>
+    <arg nr="2">
+      <not-uninit/>
+      <not-bool/>
+    </arg>
+    <arg nr="3">
+      <not-null/>
+    </arg>
+  </function>
+
+  <function name="reverse">
+    <noreturn>false</noreturn>
+    <leak-ignore/>
+
+    <arg nr="1">
+      <not-uninit/>
+      <not-null/>
+    </arg>
+    <arg nr="2">
+      <not-uninit/>
+      <not-bool/>
+    </arg>
+  </function>
+
+  <resource>
+    <alloc>segy_open</alloc>
+    <dealloc>segy_close</dealloc>
+  </resource>
+
+  <!-- testing functions - these aren't really a part of segyio and are used to
+       silence cppcheck during configuration
+  -->
+  <function name="testAssertionFailed">
+    <noreturn>true</noreturn>
+
+    <arg nr="1">
+      <not-uninit/>
+    </arg>
+    <arg nr="2">
+      <not-uninit/>
+    </arg>
+    <arg nr="3">
+      <not-uninit/>
+    </arg>
+  </function>
+
+  <function name="testAssertTrue">
+    <noreturn>true</noreturn>
+    <arg nr="1">
+      <not-uninit/>
+    </arg>
+    <arg nr="2">
+      <not-uninit/>
+      <valid>0:</valid>
+    </arg>
+    <arg nr="3">
+      <not-uninit/>
+    </arg>
+    <arg nr="4">
+      <not-uninit/>
+    </arg>
+  </function>
+
+</def>
diff --git a/cppcheck/suppressions.txt b/cppcheck/suppressions.txt
new file mode 100644
index 0000000..c787b84
--- /dev/null
+++ b/cppcheck/suppressions.txt
@@ -0,0 +1,5 @@
+preprocessorErrorDirective:*pyconfig.h
+preprocessorErrorDirective:*Python.h
+
+// silence unreachable-warnings generated by the exit(1) call in unittest
+unreachableCode:*test/*.c

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git



More information about the debian-science-commits mailing list