Commit Graph

26 Commits

Author SHA1 Message Date
chrchr-github 56e2af5dec
Fix #9653 FP leakReturnValNotUsed although (void) is specified (#4431) 2022-09-27 20:09:04 +02:00
Daniel Marjamäki 08bc21199e Make ci happy 2021-10-03 22:01:13 +02:00
Paul Fultz II d30f42e0da
Fix FP when calling a function in a condition (#3412) 2021-08-21 18:52:11 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki 22ae4543a6 Fixed 'make checkcfg' 2021-05-22 07:39:27 +02:00
Daniel Marjamäki 224492b0b5 Uninitalialized variables; Avoid FP for void cast 2021-05-17 05:59:28 +02:00
keinflue e93f8f140e
Regression tests for PR #3258 (#3259) 2021-05-17 05:35:16 +02:00
Daniel Marjamäki 6a0a2456b5 make checkcfg; temporarily disable suppressions 2021-05-16 22:48:22 +02:00
Sebastian f0e3f9e79a
gtk.cfg: Fix/enhance Gtk library configuration (g_abort and others) (#2558)
test/CMakeLists.txt: Fix missing INCONCLUSIVE for Gtk configuration test
2020-02-27 13:16:43 +01:00
Sebastian fb36889d29
gtk.cfg: Fix syntax errors and false positives (#2552)
A missing definition for g_assert_cmp*() causes syntax errors if code
like g_assert_cmpint(a, ==, b); is encountered.
The function g_hash_table_iter_replace() does not have to be marked
with leak-ignore since the memory could be freed later if corresponding
functions are present in the GHashTable. Since we can not know if this
is the case we have to assume that the memory is freed to avoid false
positives. The same is true for g_hash_table_insert() and
g_hash_table_replace().
2020-02-26 10:33:23 +01:00
versat 93e9e12aa1 gtk.cfg: Add some missing g_str*() functions found by daca@home 2019-10-08 10:01:38 +02:00
Sebastian a2a874dbd5
gtk.cfg: Add/enhance function configurations and tests. (#2101)
Add/enhance:
g_once_init_enter(), g_once_init_leave() and g_signal_emit_by_name()
2019-08-20 15:00:30 +02:00
Rikard Falkeborn 8cd1d5a47d Use library for memleak checks (#2002)
* Use library for memleak checks

Change memleakOnRealloc and leakReturnValNotUsed to use library
configuration instead of hardcoding "realloc".

In order to do so, some care needs to be taken when matching for a
reallocation function, since it can no longer be assumed that the input
to be allocated is the first argument of the function. This complicates
getReallocationType() and checkReallocUsage() but is necessary in order
to handle for example freopen() properly.

Also, refactor memleakOnRealloc check to reduce duplicated code when
checking "a" and "*a". When doing so, extending the check to look for
arbitrary number of "*" can be done for free (just change an if
statement to a while statement). Most likely, this is an unusual case in
real world code.

* Remove redundant whitespace in Token::Match()

* Run on simplified checks

* Fix cppcheck warning
2019-07-22 10:37:36 +02:00
Rikard Falkeborn dcc375ca64 Update gtk memory functions (#2000)
* Improve configuration of g_try_realloc and g_try_realloc_n
* Mark g_realloc and similar functions as realloc functions
* Remove g_new, g_new0, etc as <alloc> functions, these are defined as
  macros and handled as the functions they're expanded to.
* Add tests. TODO tests will be resolved by using the library
  configuration in the checker.
2019-07-15 14:51:58 +02:00
Rikard Falkeborn 60a213e6a5 Fix #9047 (c-style casts before malloc) (#1930)
* Fix #9047 (c-style casts before malloc)

Note that there are still no warnings for c++-style casts

* Fix memleak check with casts of assignments in if-statements

* Fix possible null pointer dereference

As pointed out by cppcheck.

* Add check of astOperand2 when removing casts

This is similar to how it is done in other checks.
2019-07-03 08:39:44 +02:00
Sebastian d745dcc0eb
gtk.cfg: Add g_error_*() functions (#1922) 2019-06-25 19:19:10 +02:00
versat 974f01ce59 gtk.cfg: Add / improve g_str*() functions and add GTK_SIGNAL_FUNC(). 2019-04-01 16:15:32 +02:00
versat 9d8b965270 gtk.cfg: Add / improve g_string_*() function configurations.
daca@home reported missing configurations for most of them.
2019-04-01 15:33:27 +02:00
Sebastian 6976d5c6e2
gtk.cfg: Add support for g_new() and similar macros. (#1760)
Also add / improve corresponding function configurations and some tests.
2019-03-26 10:45:06 +01:00
versat f6c3749015 gtk.cfg: Add support for g_alloca() and g_newa().
References:
https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-alloca
https://github.com/GNOME/glib/blob/master/glib/galloca.h
2019-02-28 15:29:37 +01:00
versat dc63cb9f98 gtk.cfg: Add more details for g_print() and g_printerr()
Reference:
https://developer.gnome.org/glib/stable/glib-Warnings-and-Assertions.html#g-print
2019-02-18 16:48:46 +01:00
versat 4dae640e8c gtk.cfg: Add type conversion macros
Reference:
https://developer.gnome.org/glib/stable/glib-Type-Conversion-Macros.html
daca@home found that they are missing.
2019-02-15 08:44:21 +01:00
versat ed25ae3acb gtk.cfg: Add some configurations often reported as missing by daca@home
Add two g_assert*(), g_signal_connect_data(), some g_signal_connect*() functions and macros and g_strdup_printf().
2019-02-13 15:35:46 +01:00
versat 62b9368b3c gtk.cfg: Add configurations for g_free() and g_malloc() / g_malloc0()
Reference: https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html
daca@home found these missing function configurations among others.
Also add tests for g_malloc() and g_free().
2019-01-28 13:47:46 +01:00
Sebastian ce96ffd433
gtk.cfg: Add internationalization macros / functions (#1623)
Found via Donate CPU / daca@home.
Reference: https://developer.gnome.org/glib/stable/glib-I18N.html
Update header comment in gtk.cfg since it is now only edited manually.
2019-01-25 13:07:48 +01:00
Sebastian 7ba9ab7e4c Gtk library: Add configuration to avoid syntax error, add test file (#1109)
Add configuration for G_UNLIKELY and G_LIKELY to avoid syntax errors
when these macros are used as condition without enclosing brackets.
Add test file to verify Gtk library configuration. Syntax check for the
test file is only done when Gtk+2.0 or Gtk+3.0 is found and working.
Tested on Cygwin and on Ubuntu 16.04.
2018-03-10 11:22:10 +01:00