diff --git a/psycopg/config.h b/psycopg/config.h index 177782e8..4e05e997 100644 --- a/psycopg/config.h +++ b/psycopg/config.h @@ -195,13 +195,6 @@ static double round(double num) #define RAISES_NEG #endif -#if defined(WITH_CPYCHECKER_NULL_RESULT_SETS_EXCEPTION_ATTRIBUTE) -#define RAISES_NULL \ - __attribute__((cpychecker_null_result_sets_exception)) -#else -#define RAISES_NULL -#endif - #if defined(WITH_CPYCHECKER_SETS_EXCEPTION_ATTRIBUTE) #define RAISES \ __attribute__((cpychecker_sets_exception)) @@ -209,6 +202,16 @@ static double round(double num) #define RAISES #endif +/* these attributes are available in the psycopg2 branch of the clone: + * https://github.com/dvarrazzo/gcc-python-plugin */ + +#if defined(WITH_CPYCHECKER_NULL_RESULT_SETS_EXCEPTION_ATTRIBUTE) +#define RAISES_NULL \ + __attribute__((cpychecker_null_result_sets_exception)) +#else +#define RAISES_NULL +#endif + #if defined(WITH_CPYCHECKER_IGNORE_REFCOUNT_ATTRIBUTE) #define IGNORE_REFCOUNT \ __attribute__((cpychecker_ignore_refcount)) diff --git a/scripts/cpychecker.Dockerfile b/scripts/cpychecker.Dockerfile new file mode 100644 index 00000000..ab8a3e28 --- /dev/null +++ b/scripts/cpychecker.Dockerfile @@ -0,0 +1,36 @@ +# docker build -f scripts/cpychecker.Dockerfile -t cpychecker scripts/ +# docker run --rm -ti --name cpychecker --volume `pwd`:/psycopg2 cpychecker + +FROM ubuntu:18.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + g++-6 \ + gcc \ + gcc-6-plugin-dev \ + git \ + libpq-dev \ + make \ + python-lxml \ + python-pygments \ + python-setuptools \ + python-six \ + python2.7 \ + python2.7-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN git clone -b psycopg2 https://github.com/dvarrazzo/gcc-python-plugin.git +WORKDIR /gcc-python-plugin +ENV PYTHON=python2.7 +ENV PYTHON_CONFIG=python2.7-config +ENV CC=gcc-6 +RUN make PYTHON_CONFIG=$PYTHON_CONFIG plugin + +# expected to be mounted +WORKDIR /psycopg2 +ENV CC_FOR_CPYCHECKER=$CC +ENV CC=/gcc-python-plugin/gcc-with-cpychecker + +CMD ["python2.7", "setup.py", "build"] +# CMD ["sleep", "infinity"]