Commit Graph

73 Commits

Author SHA1 Message Date
Sebastian 02c0240dcd
Fix #9322: bsd.cfg, gnu.cfg: Fix FP for mmap when argument "fd" is -1 (#2306)
In contrast to POSIX, GNU and BSD allow or even require the argument
"fd" to be set to -1 if MAP_ANONYMOUS or MAP_ANON is specified.
2019-10-30 09:39:50 +01:00
Sebastian 60de5e12dd gnu.cfg: Add configuration for __alignof__() (#2268)
Reference: https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Alignment.html
2019-10-14 20:59:38 +02:00
Sebastian 0527b80174
gnu.cfg: Add support for __glibc_likely() and __glibc_unlikely() (#2267)
Reference:
https://sourceware.org/glibc/wiki/Style_and_Conventions#Branch_Prediction
2019-10-14 12:16:28 +02:00
Sebastian 267d23f1b8
gnu.cfg: Define `__typeof__` as `typeof`, fix simplifyTypedef() (#2260)
`__typeof__` is just an alternative keyword for `typeof`, see
https://gcc.gnu.org/onlinedocs/gcc/Typeof.html
Since `typeof` is handled in several checkers it makes sense to define
`__typeof__` as `typeof`.
Tokenizer::simplifyTypedef(): Use `typeof` instead of `__typeof__` to
be consistent with the rest of the code.
2019-10-14 08:20:22 +02:00
versat 77c711d129 gnu.cfg: Add configuration and test for __builtin_assume_aligned() 2019-10-10 10:23:21 +02:00
versat 7277fe5a2b gnu.cfg: Add support for macro __extension__
The macro does nothing except preventing from warnings when compiling
with "pedantic" or other options.
2019-09-19 12:27:21 +02:00
orbitcowboy da29a1f56b gnu/bsd.cfg: Cleanup redundant configuration for timercmp() and add more tests. 2019-09-10 11:51:47 +02:00
versat 7737a448cf Fix #9345 FP wrongPrintfScanfArgNum for vasprintf
Configuration "<formatstr/>" for function is wrong, for the argument it
is fine.
2019-09-09 15:02:55 +02:00
orbitcowboy aed5e17867 #9323, #9331: Moved configuration and tests to gnu and bsd. 2019-09-08 19:17:15 +02:00
versat 7ee36489f1 gnu.cfg: Add configuration for __builtin_memcpy()
In case there is something like `#define memcpy __builtin_memcpy` in the
code our define for __builtin_memcpy does not work.
So the configuration for __builtin_memcpy is added as a fallback.
2019-08-02 13:17:39 +02:00
versat 2519a1aed5 gnu.cfg: Add more __builtin_* functions and some tests
Most of them were detected by daca@home
2019-08-02 12:27:46 +02:00
Sebastian 5390588cda
gnu.cfg: Add xfree() (#2051)
It is hard to find good references, one that describes it a bit can
be found here:
https://manpages.ubuntu.com/manpages/bionic/man3/xmalloc.3pub.html

xfree() can be used instead of free().
A check, to verify that a memory leak is found if the memory allocated
via xmalloc() is not freed, has also been added.
2019-08-02 07:41:32 +02:00
Rikard Falkeborn e19068504d Configure xrealloc and adjust gnu memory functions (#2003)
Remove <noreturn> tag, since the functions do not return unless there
was no error.
2019-07-16 08:12:21 +02:00
orbitcowboy 9a41b51a04 gnu.cfg: Added support for isascii_l(), which is a GNU-extension. 2019-05-31 11:24:41 +02:00
Daniel Marjamäki e80181d35a astyle formatting
[ci skip]
2019-05-17 09:32:14 +02:00
orbitcowboy 0469111750 gnu.cfg: Improved configuration for mkostemp(), mkstemps() and mkostemps(). 2019-05-16 16:02:05 +02:00
orbitcowboy 92be62a6eb gnu.cfg: Ensure the return value of pipe2() is taken into account. 2019-05-03 22:15:46 +02:00
orbitcowboy d724f86e01 gnu.cfg: Added support for tee(). Reference: http://man7.org/linux/man-pages/man2/tee.2.html 2019-04-26 17:55:47 +02:00
orbitcowboy 2dd42b867f gnu.cfg: Added support for dup3(). Reference: http://man7.org/linux/man-pages/man2/dup2.2.html 2019-04-26 16:57:43 +02:00
orbitcowboy c693e8969d gnu.cfg: Added support for more interfaces. 2019-04-26 16:39:04 +02:00
orbitcowboy c0b533c452 gnu.cfg: Warn for socket/file-descriptors having negatives values. 2019-04-25 17:07:44 +02:00
amai2012 9692c3dde7 Add macros from signal.h 2019-04-25 12:17:26 +02:00
versat e0e262ae25 gnu.cfg: Use function configuration for `_()` instead of define.
There can be preprocessor issues if the macro is used slightly different
or preprocessor conditions are used inside the string argument.
So now a function configuration with very few assumptions is used.
It is assumed that the function does return and has one parameter.
The same configuration is added for N_() since it works similar.
2019-04-03 16:02:55 +02:00
versat 5134fefb52 gnu.cfg: Add support for bswap*() macros. 2019-04-01 14:25:59 +02:00
orbitcowboy e98ddb6cc5 gnu.cfg: Added support for pipe2(). 2019-03-30 15:50:18 +01:00
versat 7c09b0cfe0 gnu.cfg: Add "buffer-size" attribute and tests for xcalloc(). 2019-03-21 10:44:18 +01:00
Daniel Marjamäki 14528bcf25 Library: allowed values for the buffer-size attribute: malloc/calloc/strdup 2019-03-20 06:46:55 +01:00
versat 9b6b94336c gnu.cfg: Add buffer-size to xmalloc; add some __builtin_*() functions. 2019-03-19 15:24:02 +01:00
versat bb7888e70b gnu.cfg: Add support for pvalloc() and __builtin_alloca(). 2019-03-18 11:44:35 +01:00
versat 3d02c10fde gnu.cfg: Further fixes, enhancements and adding argument directions. 2019-03-14 09:26:27 +01:00
versat d5c5feafb2 gnu.cfg: Fixes, enhancements and adding argument directions. 2019-03-13 16:17:16 +01:00
Sebastian 1fe1fc7008
gnu.cfg: Add support for non-GNU _(string) macro. (#1726)
As can be read here:
https://www.gnu.org/software/gettext//manual/html_node/Mark-Keywords.html
The _(str) macro is typically defined for a project to abbreviate the
gettext(str) call. Although this is not part of GNU it would enhance the
analysis. Cppcheck often does not know what _() is. In daca@home it is
reported thousands of times as a function without configuration.
2019-03-06 10:57:59 +01:00
orbitcowboy fa59cb91cb gnu.cfg: Added <use-retval/> to xrealloc() configuration. 2019-02-28 23:45:51 +01:00
orbitcowboy b222ff14be gnu.cfg: Added support fo xexit(). 2019-02-28 22:55:17 +01:00
orbitcowboy 80e31755da gnu.cfg: Added support for xrealloc(). 2019-02-28 22:48:39 +01:00
orbitcowboy 43daaca19c gnu.cfg: Added support for xstrdup(). 2019-02-28 22:46:16 +01:00
orbitcowboy e6d36913c8 gnu.cfg: Added support for xmalloc() and xcalloc(). Reference: https://gcc.gnu.org/onlinedocs/libiberty/Functions.html 2019-02-28 22:36:52 +01:00
Martin Ettl 17c1733b0e gnu.cfg: Added support for asprintf() and vasprintf(). There is a FN with memory leak detection regarding pointer args, which is already mentioned in #8980. A comment has been added. 2019-02-27 15:17:34 +01:00
amai2012 22611c4b74 Add getopt_long,getopt_long_only to gnu.cfg 2019-02-05 21:29:56 +01:00
amai2012 d6d8a871ca Add/correct some interfaces. Move some standard interfaces from gnu.cfg to posix.cfg. 2019-01-28 23:26:53 +01:00
Sebastian 5c91d7b4e1 gnu.cfg: Add support for gettext() and some related functions (#1621)
* gnu.cfg: Add support for gettext() and some related functions
Reference (beside some other web sites):
https://www.gnu.org/software/libc/manual/html_node/Translation-with-gettext.html
2019-01-24 23:08:42 +01:00
orbitcowboy ba28cbe0ff gnu.cfg: Replaced '__builtin_memset' definition with macro definition, since it is equal to 'memset' from std.cfg. 2018-10-30 15:37:20 +01:00
orbitcowboy b998dcb5aa gnu.cfg: Added support for '__builtin_memset'. 2018-10-27 18:25:05 +02:00
orbitcowboy 879803c90f gnu.cfg: Fixed FP (nullpointer) when third parameter of epoll_ctl is set to NULL. 2018-09-25 09:07:49 +02:00
Sebastian 4ef452132c
posix.cfg,gnu.cfg: Add (get|set)hostname functions. (#1315)
Reference for POSIX gethostname:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html
Reference for sethostname:
http://man7.org/linux/man-pages/man2/gethostname.2.html
2018-07-18 09:40:06 +02:00
Sebastian b5b84d1737 gnu.cfg Remove redundant function and resource configurations (#1036)
The epoll_* function and resource configurations somehow where added
twice.
This removes all duplicates (they have the same
attributes/configuration).
2018-01-16 17:13:15 +01:00
orbitcowboy cbc95c5662 gnu.cfg: Added more returnValue-types. 2017-10-05 11:45:46 +02:00
orbitcowboy cc210679a5 gnu.cfg: Added returnValue-types. 2017-08-02 14:34:06 +02:00
Daniel Marjamäki 7875054f36 Fixed #8078 (cppcheck-cfg.rng outdated) 2017-07-23 12:09:41 +02:00
Alexander Mai 389b4cdf99 Remove atrribute to cure FP. Run astyle 2017-05-29 20:04:34 +02:00