Commit Graph

46 Commits

Author SHA1 Message Date
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
Rikard Falkeborn b530b3dfff Remove <noreturn> from g_malloc and friends (#1942)
From the Gnome Developer documentation
(https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html):

    If any call to allocate memory using functions g_new(), g_new0(),
    g_renew(), g_malloc(), g_malloc0(), g_malloc0_n(), g_realloc(), and
    g_realloc_n() fails, the application is terminated. This also means
    that there is no need to check if the call succeeded. On the other
    hand, g_try_...() family of functions returns NULL on failure that
    can be used as a check for unsuccessful memory allocation. The
    application is not terminated in this case.

g_new(), g_new0() and g_renew() are defines using g_malloc(),
g_malloc0() and g_realloc() respectively, so there is no need to change
those.
2019-07-02 11:51:28 +02:00
Sebastian 389df97352
gtk.cfg: Add/improve g_ascii_*() functions (#1927)
* gtk.cfg: Add/improve g_ascii_*() functions

Found via daca@home

* gtk.cfg: Add `<const/>` where applicable (forgotten in last commit)

* gtk.cfg: Add `<valid>0:255</valid>` for `gchar` ASCII value arguments
2019-06-30 21:16:45 +02:00
Sebastian d745dcc0eb
gtk.cfg: Add g_error_*() functions (#1922) 2019-06-25 19:19:10 +02:00
versat 206488c0ea gtk.cfg: Add some g_list_*() function / macro configurations.
Found missing by daca@home.
2019-04-18 10:49:02 +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 0372c9cde6 gtk.cfg: Add buffer-size attribute to `alloc` entries. 2019-03-20 16:30:28 +01:00
versat 45b1c717ae gtk.cfg: Add support for g_object_(get|set)_data[_full](). 2019-03-20 16:10:18 +01:00
versat 0cb45b1f42 gtk.cfg: Add more macros and some functions used in the macros. 2019-03-15 14:51:45 +01:00
orbitcowboy 782958d814 wxwidgets.cfg: Added more directions-attributes. 2019-03-04 10:53:25 +01:00
orbitcowboy 391ed97717 gtk.cfg: Added support for more macros. 2019-03-04 10:43:21 +01:00
orbitcowboy 7d266e688c gtk.cfg: Added support for more interfaces. 2019-03-03 17:42:58 +01:00
orbitcowboy f66dde018d gtk.cfg: Added support for GTK_DIALOG-macro. 2019-03-03 17:28:05 +01:00
orbitcowboy 915280beec gtk.cfg: Added support for GTK_LABEL-macro. 2019-03-03 17:25:49 +01:00
orbitcowboy 68f4243c89 gtk.cfg: Added support for GTK_TREE_VIEW-macro. 2019-03-03 17:22:35 +01:00
versat 24739dc5f2 gtk.cfg: Add support for g_message() and similar printf like functions.
g_error() is special because it never returns.
2019-03-01 11:20:28 +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
Sebastian 2a45d390f3
gtk.cfg: Add support for gtk_label_new(), enhance gtk_label_get(). (#1706)
References:
https://developer.gnome.org/gtk3/stable/GtkLabel.html#gtk-label-new
https://developer.gnome.org/gtk2/stable/GtkLabel.html#gtk-label-get
Found by daca@home.
2019-02-27 12:56:21 +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 8fb4e7dde8 gtk.cfg: Add more details to g_object_unref() configuration
Reference:
https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-unref
2019-02-18 16:16:10 +01:00
versat 8e11dc5b41 gtk.cfg: Add support for G_TYPE_CHECK_INSTANCE_CAST() macro 2019-02-18 11:37:19 +01:00
versat 6f57b9abfa gtk.cfg: Add some GTK_*() instance cast macros
SOME GTK_*() macros most often reported as missing by daca@home are added.
2019-02-17 16:41:19 +01:00
amai2012 ac0d39a164 Add parentheses to G_OBJECT 2019-02-16 00:19:00 +01:00
amai2012 e3083ade52 Define G_OBBECJT(obj). It's #2 on daca@home checkLibraryFunction report currently 2019-02-15 21:50:32 +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
orbitcowboy acebfac176 Added missing <use-retval/>-tag to strdup()-like functions. In case the return value is not taken in account, a logical error is revealed. 2019-02-03 20:38:33 +01:00
orbitcowboy b472d74f1f gtk.cfg: Added support for g_strdup(); wxwidgets.cfg: Added <use-retval/>-flag to wxString::FromUTF8(). 2019-02-03 20:31:59 +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
amai2012 db413d254a Add G_CALLBACK() to gtk.cfg 2019-01-22 22:11:06 +01:00
Daniel Marjamäki e6e3987935 snprintf/g_snprintf: do not allow uninitialized target buffer 2018-12-22 20:40:47 +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
Daniel Marjamäki 7875054f36 Fixed #8078 (cppcheck-cfg.rng outdated) 2017-07-23 12:09:41 +02:00
PKEuS c5b21d12cf Removed lots of redundant tests from testmemleak.cpp, added some missing types to gtk.cfg 2015-11-19 18:51:32 +01:00
Boris Egorov bf2baef27b gtk.cfg: Fix some g_variant deallocators
"This call makes a shallow copy; the return result should be released
with g_free(), but the individual strings must not be modified."

https://developer.gnome.org/glib/stable/glib-GVariant.html
2015-10-28 17:27:15 +06:00
PKEuS cbb8360b30 Added version attribute to .cfg files (#5928) 2014-09-29 16:26:17 +02:00
Pavel Roschin 19a8cfd960 Library: add new "define" tag
This tag will allow to add some preprocessor defs into library.
It would be useful to provide more information about libraries
implementation details. As example GLib's library include tag
was added that helps to detect more memory leaks.
2014-02-07 10:13:36 +04:00
Pavel Roschin 4f38d7ae31 Library: add full GLib/GTK support 2014-02-05 19:52:24 +04:00
Pavel Roschin 0dd227419d CheckMemoryLeak: use library while checking whitelist functions 2014-02-05 12:16:50 +04:00
Pavel Roschin 651ebcf17b Add GLib library, add GLib tests (some new bugs found) 2014-02-02 22:45:57 +04:00
Daniel Marjamäki be5e4ccfd5 Library: Renamed <ignore> to <leak-ignore> 2013-07-20 13:12:24 +02:00
Daniel Marjamäki 1dc8b1706b cfg/gtk.cfg: Updated configuration 2013-07-20 10:19:12 +02:00
Daniel Marjamäki 4a2c200b7a renamed the folder data/ to cfg/ in the repo 2013-07-20 08:26:15 +02:00