Commit graph

38 commits

Author SHA1 Message Date
Peter Meerwald-Stadler
424e97a5fa build: Add Coverity scan model
the modeling file help to avoid false positives and increase scanning
accuracy by explaining code Coverity can't see (out of tree libraries);
the model file must be uploaded by an admin to:
https://scan.coverity.com/projects/pulseaudio?tab=analysis_settings

the pa_assert_se() macro needs to be rewritten for Coverity so that
the assignment is not declared a side-effect

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-06 08:22:33 +01:00
Peter Meerwald-Stadler
45d9030638 core: Replace PA_PAGE_SIZE with pa_page_size()
PA_PAGE_SIZE using sysconf() may return a negative number

CID 1137925, CID 1137926, CID 1138485

instead of calling sysconf() directly, add function pa_page_size()
which uses the guestimate 4096 in case sysconf(_SC_PAGE_SIZE) fails

using PA_ONCE to only evaluate sysconf() once
2016-09-02 14:52:53 +02:00
Peter Meerwald-Stadler
8b076c3ed9 Remove newline at end of log messages
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2016-08-16 07:03:25 +02:00
Peter Meerwald
93822f98f4 core: Fix GCC 6 compiler warning regarding left shift of negative value
In file included from pulse/timeval.c:32:0:
pulse/timeval.c: In function 'pa_timeval_add':
./pulsecore/macro.h:303:28: warning: left shift of negative value [-Wshift-negative-value]
              ? ~(~(type) 0 << (8*sizeof(type)-1))

reported by Ubuntu gcc-6

gcc-6 adds -Wshift-negative-value (enabled by -Wextra) which warns
about left shifting a negative value. Such shifts are undefined
because they depend on the representation of negative values.

also works with -Wshift-overflow=2

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2016-02-18 14:08:13 +01:00
Ondrej Holecek
5effc83479 update FSF addresses to FSF web page
FSF addresses used in PA sources are no longer valid and rpmlint
generates numerous warnings during packaging because of this.
This patch changes all FSF addresses to FSF web page according to
the GPL how-to: https://www.gnu.org/licenses/gpl-howto.en.html

Done automatically by sed-ing through sources.
2015-01-14 22:20:40 +02:00
Peter Meerwald
87d188b46c macro: Add macro PA_UNUSED
the macro PA_UNUSED may be used to suppress a warning when a variable
is not used, or assigned and never used; this typically happens
when the only use of the variable is within an assert() that can
be optimized away (i.e. with NDEBUG set)

has an effect with GCC only

v2: (thanks to Alexander Patrakov)
* fix patch subject/description

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-11-17 13:24:43 +01:00
Peter Meerwald
094de7f024 macro: Abort() when pa_assert_not_reached() even for NDEBUG
fixes many warnings when compiling with NDEBUG, such as
  CC       pulse/libpulse_la-channelmap.lo
pulse/channelmap.c: In function 'pa_channel_map_init_auto':
pulse/channelmap.c:397:1: warning: control reaches end of non-void function [-Wreturn-type]

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-11-17 13:24:38 +01:00
poljar (Damir Jelić)
b224716f33 macro: Remove unneeded typedef for pa_bool_t. 2013-07-04 12:26:02 +03:00
poljar (Damir Jelić)
d806b19714 Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
2013-07-04 12:25:30 +03:00
Arun Raghavan
dbe8f2e595 macro: typedef pa_bool_t to bool instead of _Bool
They're functionally equivalent, and the former lets the header be
included in C++ as well.
2011-10-17 16:42:59 +05:30
Maarten Bosmans
9133c6c935 Make gcc --std=c99 happy
We're now more or less C99 compliant
2011-09-03 12:17:28 +02:00
Maarten Bosmans
dd9265ac78 Remove unnecessary #includes 2011-06-22 23:12:20 +01:00
Lennart Poettering
56f217f3f8 macro: introduce PA_INT_TYPE_MIN, PA_INT_TYPE_MAX, PA_INT_TYPE_SIGNED macros 2009-09-18 04:14:37 +02:00
Wim Taymans
27bfb7628c macro: add macro to align variables 2009-08-27 10:44:53 +02:00
Lennart Poettering
827ae07c1e macro: add PA_CLIP_SUB() for saturated subtraction 2009-08-26 01:41:34 +02:00
Lennart Poettering
2838b78e59 macro: extend comments a bit 2009-08-19 01:03:09 +02:00
Lennart Poettering
8f928b2e57 macro: simplify page/word alignment macros a bit 2009-08-17 19:17:10 +02:00
Lennart Poettering
fe3a21f6a5 macro: add PA_ROUND_UP/PA_ROUND_DOWN macros 2009-08-17 19:15:33 +02:00
Lennart Poettering
003e03d233 macro: include string.h because we need it for memset 2009-05-14 01:23:12 +02:00
Lennart Poettering
92a6141888 macro: add macros for initializing memory 2009-05-08 02:04:33 +02:00
Lennart Poettering
bd0e4ceb85 macro: make pa_page_align roung up instead of down 2009-04-29 01:52:28 +02:00
Lennart Poettering
68f3ca9831 macro: add new macro pa_align_ptr() 2009-04-29 01:52:11 +02:00
Lennart Poettering
52dcb950ef add pa_assert_cc() for compile time assertions 2009-03-23 21:03:52 +01:00
Lennart Poettering
bd3154a861 introduce pa_assert_fp() for fast path assertions 2009-03-20 13:29:42 +01:00
Colin Guthrie
86dee05aec Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
Lennart Poettering
b092f2e0f8 use uintpr_t when casting between pointers and integers 2009-02-02 00:20:05 +01:00
Lennart Poettering
c4b346259f make the debug trap macro a proper macro in macro.h 2008-10-21 22:04:22 +02:00
Lennart Poettering
f92a814118 include log.h near the end so that macro.h can be included in log.h and defines pa_bool_t properly 2008-10-21 18:40:01 +02:00
Lennart Poettering
7fecb2340e convert argument to boolean int in PA_UNLIKELY, too 2008-10-21 18:27:25 +02:00
Lennart Poettering
ea15ca9862 PA_WARN_REFERENCE works only for ELF targets 2008-10-01 14:49:00 +02:00
Lennart Poettering
8ae83d618e get rid of svn $ keywords 2008-06-18 23:23:21 +03:00
Lennart Poettering
045c1d602d merge glitch-free branch back into trunk
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2445 fefdeb5f-60dc-0310-8127-8f9354f1896f
2008-05-15 23:34:41 +00:00
Lennart Poettering
b39da92935 merge r2194 from prepare-0.9.10
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2209 fefdeb5f-60dc-0310-8127-8f9354f1896f
2008-03-31 22:12:55 +00:00
Lennart Poettering
e043eaad94 add new function pa_strnull() to simplify passing null strings to non-linux printf()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2045 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-11-11 22:59:34 +00:00
Lennart Poettering
01490319d3 remove PA_CLAMP_LIKELY macro because it doesn't really make sense.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2039 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-11-09 14:19:40 +00:00
Lennart Poettering
3c17c7d442 fix CLAMP_LIKELY/UNLIKELY definition
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2036 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-11-09 02:12:09 +00:00
Lennart Poettering
cb66762d6d add PA_CLAMP_LIKELY and PA_CLAMP_UNLIKELY macros
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2033 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-11-09 01:29:50 +00:00
Lennart Poettering
a67c21f093 merge 'lennart' branch back into trunk.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1971 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-10-28 19:13:50 +00:00