cairo.cfg: Add library configuration/tests/... for cairo library (#2176)
Reference: https://www.cairographics.org/
This commit is contained in:
parent
3d3f62aefd
commit
8207fb7b14
|
@ -18,7 +18,7 @@ env:
|
||||||
before_install:
|
before_install:
|
||||||
# install needed deps
|
# install needed deps
|
||||||
- travis_retry sudo apt-get update -qq
|
- travis_retry sudo apt-get update -qq
|
||||||
- travis_retry sudo apt-get install -qq python-pygments qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3
|
- travis_retry sudo apt-get install -qq python-pygments qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev
|
||||||
- travis_retry python2 -m pip install --user pytest==4.6.4
|
- travis_retry python2 -m pip install --user pytest==4.6.4
|
||||||
- travis_retry python2 -m pip install --user pylint
|
- travis_retry python2 -m pip install --user pylint
|
||||||
- travis_retry python2 -m pip install --user unittest2
|
- travis_retry python2 -m pip install --user unittest2
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<def format="2">
|
||||||
|
<!-- cairo Library Configuration https://www.cairographics.org/ -->
|
||||||
|
<!-- The cairo library is typically included by "#include <cairo.h>" -->
|
||||||
|
<!-- ########## cairo Types ########## -->
|
||||||
|
<define name="cairo_bool_t" value="int"/>
|
||||||
|
<!-- TODO: Configure cairo_status_t as an enum when this is implemented in Cppcheck -->
|
||||||
|
<podtype name="cairo_status_t"/>
|
||||||
|
<!-- ########## cairo Macros / Defines ########## -->
|
||||||
|
<define name="CAIRO_HAS_MIME_SURFACE" value="1"/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_CCITT_FAX" value=""image/g3fax""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_CCITT_FAX_PARAMS" value=""application/x-cairo.ccitt.params""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_EPS" value=""application/postscript""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_EPS_PARAMS" value=""application/x-cairo.eps.params""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_JBIG2" value=""application/x-cairo.jbig2""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_JBIG2_GLOBAL" value=""application/x-cairo.jbig2-global""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID" value=""application/x-cairo.jbig2-global-id""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_JP2" value=""image/jp2""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_JPEG" value=""image/jpeg""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_PNG" value=""image/png""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_URI" value=""text/x-uri""/>
|
||||||
|
<define name="CAIRO_MIME_TYPE_UNIQUE_ID" value=""application/x-cairo.uuid""/>
|
||||||
|
<!-- ########## cairo Allocation / Deallocation ########## -->
|
||||||
|
<!-- ########## cairo Functions ########## -->
|
||||||
|
<!-- cairo_t * cairo_create (cairo_surface_t *target); -->
|
||||||
|
<function name="cairo_create">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="cairo_t *"/>
|
||||||
|
<use-retval/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
<not-bool/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
<!-- void cairo_destroy (cairo_t *cr); -->
|
||||||
|
<function name="cairo_destroy">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="void"/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
<not-bool/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
<!-- void cairo_line_to (cairo_t *cr, double x, double y); -->
|
||||||
|
<!-- void cairo_move_to (cairo_t *cr, double x, double y); -->
|
||||||
|
<function name="cairo_line_to,cairo_move_to">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="void"/>
|
||||||
|
<leak-ignore/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="2" direction="in">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="3" direction="in">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
<!-- cairo_status_t cairo_status (cairo_t *cr); -->
|
||||||
|
<function name="cairo_status">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="cairo_status_t"/>
|
||||||
|
<use-retval/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
<!-- const char * cairo_status_to_string (cairo_status_t status); -->
|
||||||
|
<function name="cairo_status_to_string">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="const char *"/>
|
||||||
|
<use-retval/>
|
||||||
|
<arg nr="1" direction="in">
|
||||||
|
<not-uninit/>
|
||||||
|
<not-bool/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
<!-- void cairo_stroke (cairo_t *cr); -->
|
||||||
|
<function name="cairo_stroke">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="void"/>
|
||||||
|
<leak-ignore/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
</def>
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
// Test library configuration for cairo.cfg
|
||||||
|
//
|
||||||
|
// Usage:
|
||||||
|
// $ cppcheck --check-library --library=cairo --enable=information --error-exitcode=1 --inline-suppr --suppress=missingIncludeSystem test/cfg/cairo.c
|
||||||
|
// =>
|
||||||
|
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <cairo.h>
|
||||||
|
|
||||||
|
void validCode(cairo_surface_t *target)
|
||||||
|
{
|
||||||
|
cairo_t * cairo1 = cairo_create(target);
|
||||||
|
cairo_move_to(cairo1, 1.0, 2.0);
|
||||||
|
cairo_line_to(cairo1, 5.0, 6.0);
|
||||||
|
cairo_destroy(cairo1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ignoredReturnValue(cairo_surface_t *target)
|
||||||
|
{
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
cairo_create(target);
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
cairo_status_to_string(CAIRO_STATUS_READ_ERROR);
|
||||||
|
}
|
|
@ -253,6 +253,33 @@ else
|
||||||
fi
|
fi
|
||||||
${CPPCHECK} ${CPPCHECK_OPT} --library=libcurl ${DIR}libcurl.c
|
${CPPCHECK} ${CPPCHECK_OPT} --library=libcurl ${DIR}libcurl.c
|
||||||
|
|
||||||
|
# cairo.c
|
||||||
|
set +e
|
||||||
|
pkg-config --version
|
||||||
|
PKGCONFIG_RETURNCODE=$?
|
||||||
|
set -e
|
||||||
|
if [ $PKGCONFIG_RETURNCODE -ne 0 ]; then
|
||||||
|
echo "pkg-config needed to retrieve cairo configuration is not available, skipping syntax check."
|
||||||
|
else
|
||||||
|
set +e
|
||||||
|
CAIROCONFIG=$(pkg-config --cflags cairo)
|
||||||
|
CAIROCONFIG_RETURNCODE=$?
|
||||||
|
set -e
|
||||||
|
if [ $CAIROCONFIG_RETURNCODE -eq 0 ]; then
|
||||||
|
set +e
|
||||||
|
echo -e "#include <cairo.h>" | ${CC} ${CC_OPT} ${CAIROCONFIG} -x c -
|
||||||
|
CAIROCONFIG_RETURNCODE=$?
|
||||||
|
set -e
|
||||||
|
if [ $CAIROCONFIG_RETURNCODE -ne 0 ]; then
|
||||||
|
echo "cairo not completely present or not working, skipping syntax check with ${CC}."
|
||||||
|
else
|
||||||
|
echo "cairo found and working, checking syntax with ${CC} now."
|
||||||
|
${CC} ${CC_OPT} ${CAIROCONFIG} ${DIR}cairo.c
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
${CPPCHECK} ${CPPCHECK_OPT} --library=cairo ${DIR}cairo.c
|
||||||
|
|
||||||
# Check the syntax of the defines in the configuration files
|
# Check the syntax of the defines in the configuration files
|
||||||
set +e
|
set +e
|
||||||
xmlstarlet --version
|
xmlstarlet --version
|
||||||
|
|
|
@ -432,6 +432,7 @@ def upload_info(package, info_output, server_address):
|
||||||
def get_libraries():
|
def get_libraries():
|
||||||
libraries = ['posix', 'gnu']
|
libraries = ['posix', 'gnu']
|
||||||
library_includes = {'boost': ['<boost/'],
|
library_includes = {'boost': ['<boost/'],
|
||||||
|
# 'cairo': ['<cairo.h>'], <= enable after release of version 1.90
|
||||||
'cppunit': ['<cppunit/'],
|
'cppunit': ['<cppunit/'],
|
||||||
'googletest': ['<gtest/gtest.h>'],
|
'googletest': ['<gtest/gtest.h>'],
|
||||||
'gtk': ['<gtk/gtk.h>', '<glib.h>', '<glib/', '<gnome.h>'],
|
'gtk': ['<gtk/gtk.h>', '<glib.h>', '<glib/', '<gnome.h>'],
|
||||||
|
|
Loading…
Reference in New Issue