fix build warnings (#2355)

* fix build warnings

* cython fixes

* cleanup transformations build

* little more
pull/2356/head
Adeeb Shihadeh 5 years ago committed by GitHub
parent 6b020241c9
commit 96b637737b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      SConstruct
  2. 1
      common/clock.pyx
  3. 8
      common/common_pyx_setup.py
  4. 4
      common/kalman/simple_kalman_impl.pxd
  5. 3
      common/kalman/simple_kalman_setup.py
  6. 2
      common/params_pyx.pyx
  7. 42
      common/transformations/setup.py
  8. 1
      common/transformations/transformations.pxd
  9. 2
      common/transformations/transformations.pyx
  10. 2
      selfdrive/common/params.cc
  11. 7
      selfdrive/common/util.c

@ -202,6 +202,7 @@ if arch in ["x86_64", "Darwin", "larch64"]:
] ]
qt_env["LINKFLAGS"] += ["-F" + QT_BASE + "lib"] qt_env["LINKFLAGS"] += ["-F" + QT_BASE + "lib"]
else: else:
qt_env['QTDIR'] = "/usr"
qt_dirs = [ qt_dirs = [
f"/usr/include/{real_arch}-linux-gnu/qt5", f"/usr/include/{real_arch}-linux-gnu/qt5",
f"/usr/include/{real_arch}-linux-gnu/qt5/QtWidgets", f"/usr/include/{real_arch}-linux-gnu/qt5/QtWidgets",

@ -1,3 +1,4 @@
# cython: language_level = 3
from posix.time cimport clock_gettime, timespec, CLOCK_MONOTONIC_RAW, clockid_t from posix.time cimport clock_gettime, timespec, CLOCK_MONOTONIC_RAW, clockid_t
IF UNAME_SYSNAME == "Darwin": IF UNAME_SYSNAME == "Darwin":

@ -4,9 +4,9 @@ from Cython.Build import cythonize
from common.cython_hacks import BuildExtWithoutPlatformSuffix from common.cython_hacks import BuildExtWithoutPlatformSuffix
sourcefiles = ['clock.pyx'] sourcefiles = ['clock.pyx']
extra_compile_args = ["-std=c++11", "-Wno-nullability-completeness"] extra_compile_args = ["-std=c++14"]
setup(name='Common', setup(name='common',
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
ext_modules=cythonize( ext_modules=cythonize(
Extension( Extension(
@ -14,7 +14,7 @@ setup(name='Common',
language="c++", language="c++",
sources=sourcefiles, sources=sourcefiles,
extra_compile_args=extra_compile_args, extra_compile_args=extra_compile_args,
) ),
nthreads=4,
), ),
nthreads=4,
) )

@ -1,3 +1,5 @@
# cython: language_level = 3
cdef class KF1D: cdef class KF1D:
cdef public: cdef public:
double x0_0 double x0_0
@ -13,4 +15,4 @@ cdef class KF1D:
double A_K_0 double A_K_0
double A_K_1 double A_K_1
double A_K_2 double A_K_2
double A_K_3 double A_K_3

@ -7,5 +7,4 @@ from common.cython_hacks import BuildExtWithoutPlatformSuffix
setup(name='Simple Kalman Implementation', setup(name='Simple Kalman Implementation',
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
ext_modules=cythonize(Extension("simple_kalman_impl", ext_modules=cythonize(Extension("simple_kalman_impl",
["simple_kalman_impl.pyx"], ["simple_kalman_impl.pyx"])))
extra_compile_args=["-Wno-nullability-completeness"])))

@ -1,4 +1,4 @@
# distutils: langauge = c++ # distutils: language = c++
# cython: language_level = 3 # cython: language_level = 3
from libcpp cimport bool from libcpp cimport bool
from libcpp.string cimport string from libcpp.string cimport string

@ -1,42 +1,20 @@
import os
import numpy import numpy
import sysconfig
from Cython.Build import cythonize from Cython.Build import cythonize
from Cython.Distutils import build_ext
from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module
from common.cython_hacks import BuildExtWithoutPlatformSuffix
def get_ext_filename_without_platform_suffix(filename):
name, ext = os.path.splitext(filename)
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
if ext_suffix == ext:
return filename
ext_suffix = ext_suffix.replace(ext, '')
idx = name.find(ext_suffix)
if idx == -1:
return filename
else:
return name[:idx] + ext
class BuildExtWithoutPlatformSuffix(build_ext):
def get_ext_filename(self, ext_name):
filename = super().get_ext_filename(ext_name)
return get_ext_filename_without_platform_suffix(filename)
setup( setup(
name='Cython transformations wrapper', name='Cython transformations wrapper',
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
ext_modules=cythonize( ext_modules=cythonize(
Extension( Extension(
"transformations", "transformations",
sources=["transformations.pyx"], sources=["transformations.pyx"],
language="c++", language="c++",
extra_compile_args=["-std=c++14", "-Wno-nullability-completeness"], extra_compile_args=["-std=c++14", "-Wno-cpp"],
include_dirs=[numpy.get_include()], include_dirs=[numpy.get_include()],
),
nthreads=4,
) )
)) )

@ -1,3 +1,4 @@
#cython: language_level=3
from libcpp cimport bool from libcpp cimport bool
cdef extern from "orientation.cc": cdef extern from "orientation.cc":

@ -26,7 +26,7 @@ cdef np.ndarray[double, ndim=2] matrix2numpy(Matrix3 m):
[m(2, 0), m(2, 1), m(2, 2)], [m(2, 0), m(2, 1), m(2, 2)],
]) ])
cdef Matrix3 numpy2matrix (np.ndarray[double, ndim=2, mode="fortran"] m): cdef Matrix3 numpy2matrix(np.ndarray[double, ndim=2, mode="fortran"] m):
assert m.shape[0] == 3 assert m.shape[0] == 3
assert m.shape[1] == 3 assert m.shape[1] == 3
return Matrix3(<double*>m.data) return Matrix3(<double*>m.data)

@ -173,7 +173,7 @@ int Params::write_db_value(const char* key, const char* value, size_t value_size
tmp_path = params_path + "/.tmp_value_XXXXXX"; tmp_path = params_path + "/.tmp_value_XXXXXX";
tmp_fd = mkstemp((char*)tmp_path.c_str()); tmp_fd = mkstemp((char*)tmp_path.c_str());
bytes_written = write(tmp_fd, value, value_size); bytes_written = write(tmp_fd, value, value_size);
if (bytes_written != value_size) { if (bytes_written < 0 || (size_t)bytes_written != value_size) {
result = -20; result = -20;
goto cleanup; goto cleanup;
} }

@ -4,13 +4,16 @@
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#ifdef __linux__ #ifdef __linux__
#include <sys/prctl.h> #include <sys/prctl.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#ifndef __USE_GNU
#define __USE_GNU #define __USE_GNU
#include <sched.h>
#endif #endif
#include <sched.h>
#endif // __linux__
void* read_file(const char* path, size_t* out_len) { void* read_file(const char* path, size_t* out_len) {
FILE* f = fopen(path, "r"); FILE* f = fopen(path, "r");

Loading…
Cancel
Save