diff --git a/SConstruct b/SConstruct index e80fe3f7..1b863beb 100644 --- a/SConstruct +++ b/SConstruct @@ -138,6 +138,7 @@ env = Environment( "-Werror", "-Wno-unknown-warning-option", "-Wno-deprecated-register", + "-Wno-register", "-Wno-inconsistent-missing-override", "-Wno-c99-designator", "-Wno-reorder-init-list", @@ -177,7 +178,7 @@ env = Environment( RPATH=rpath, CFLAGS=["-std=gnu11"] + cflags, - CXXFLAGS=["-std=c++14"] + cxxflags, + CXXFLAGS=["-std=c++1z"] + cxxflags, LIBPATH=libpath + [ "#cereal", "#selfdrive/common", diff --git a/cereal b/cereal index 1e7810db..5c7e91ab 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit 1e7810dbbfe31003b85f11f948ac6e03b1134570 +Subproject commit 5c7e91abb7fa93f86164fc48124c596bf9cfc849 diff --git a/common/common_pyx_setup.py b/common/common_pyx_setup.py index 547fca81..d8f653e6 100644 --- a/common/common_pyx_setup.py +++ b/common/common_pyx_setup.py @@ -4,7 +4,7 @@ from Cython.Build import cythonize from common.cython_hacks import BuildExtWithoutPlatformSuffix sourcefiles = ['clock.pyx'] -extra_compile_args = ["-std=c++14"] +extra_compile_args = ["-std=c++1z"] setup(name='common', cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, diff --git a/common/ffi_wrapper.py b/common/ffi_wrapper.py index 0fbe1629..e6ee2c23 100644 --- a/common/ffi_wrapper.py +++ b/common/ffi_wrapper.py @@ -44,7 +44,7 @@ def compile_code(name, c_code, c_header, directory, cflags="", libraries=None): ffibuilder = FFI() ffibuilder.set_source(name, c_code, source_extension='.cpp', libraries=libraries) ffibuilder.cdef(c_header) - os.environ['OPT'] = "-fwrapv -O2 -DNDEBUG -std=c++11" + os.environ['OPT'] = "-fwrapv -O2 -DNDEBUG -std=c++1z" os.environ['CFLAGS'] = cflags ffibuilder.compile(verbose=True, debug=False, tmpdir=directory) diff --git a/common/transformations/setup.py b/common/transformations/setup.py index 4f18423f..32546192 100644 --- a/common/transformations/setup.py +++ b/common/transformations/setup.py @@ -12,7 +12,7 @@ setup( "transformations", sources=["transformations.pyx"], language="c++", - extra_compile_args=["-std=c++14", "-Wno-cpp"], + extra_compile_args=["-std=c++1z", "-Wno-cpp"], include_dirs=[numpy.get_include()], ), nthreads=4, diff --git a/installer/Makefile b/installer/Makefile index 6c80546a..cb42fab7 100644 --- a/installer/Makefile +++ b/installer/Makefile @@ -11,7 +11,7 @@ WARN_FLAGS = -Werror=implicit-function-declaration \ -Werror=format-extra-args CFLAGS = -std=gnu11 -fPIC -O2 $(WARN_FLAGS) -CXXFLAGS = -std=c++11 -fPIC -O2 $(WARN_FLAGS) +CXXFLAGS = -std=c++1z -fPIC -O2 $(WARN_FLAGS) NANOVG_FLAGS = -I$(PHONELIBS)/nanovg diff --git a/installer/updater/Makefile b/installer/updater/Makefile index d252fc2a..e222bc29 100644 --- a/installer/updater/Makefile +++ b/installer/updater/Makefile @@ -10,7 +10,7 @@ WARN_FLAGS = -Werror=implicit-function-declaration \ -Werror=format-extra-args CFLAGS = -std=gnu11 -g -fPIC -O2 $(WARN_FLAGS) -CXXFLAGS = -std=c++11 -g -fPIC -O2 $(WARN_FLAGS) +CXXFLAGS = -std=c++1z -g -fPIC -O2 $(WARN_FLAGS) CURL_FLAGS = -I$(PHONELIBS)/curl/include CURL_LIBS = $(PHONELIBS)/curl/lib/libcurl.a \ diff --git a/laika_repo b/laika_repo index bb4003cc..bfb59fa1 160000 --- a/laika_repo +++ b/laika_repo @@ -1 +1 @@ -Subproject commit bb4003cc04efc615bce7cf9e883367ba3a7bd878 +Subproject commit bfb59fa18dd05d8766101b16624d020965793a14 diff --git a/opendbc b/opendbc index a14baf55..25dc12a8 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit a14baf55531e8e2f10f4b8010f355def11e63bcc +Subproject commit 25dc12a87b13c78e78be9664e496402f0e0286db diff --git a/rednose_repo b/rednose_repo index 32267071..10bf459f 160000 --- a/rednose_repo +++ b/rednose_repo @@ -1 +1 @@ -Subproject commit 32267071160ac461f513ca684b831e3a6d8896cc +Subproject commit 10bf459f33adcdb75ca6851555f5ff870cfea10e diff --git a/selfdrive/boardd/boardd_setup.py b/selfdrive/boardd/boardd_setup.py index 4d272d9b..01ca0524 100644 --- a/selfdrive/boardd/boardd_setup.py +++ b/selfdrive/boardd/boardd_setup.py @@ -16,7 +16,7 @@ setup(name='Boardd API Implementation', ], sources=['boardd_api_impl.pyx'], language="c++", - extra_compile_args=["-std=c++11", "-Wno-nullability-completeness"], + extra_compile_args=["-std=c++1z", "-Wno-nullability-completeness"], ) ) ) diff --git a/selfdrive/camerad/cameras/camera_qcom.cc b/selfdrive/camerad/cameras/camera_qcom.cc index 6baaff71..d90d900c 100644 --- a/selfdrive/camerad/cameras/camera_qcom.cc +++ b/selfdrive/camerad/cameras/camera_qcom.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -376,7 +377,7 @@ static void set_exposure(CameraState *s, float exposure_frac, float gain_frac) { unsigned int integ_lines = s->cur_integ_lines; if (exposure_frac >= 0) { - exposure_frac = clamp(exposure_frac, 2.0 / frame_length, 1.0); + exposure_frac = std::clamp(exposure_frac, 2.0f / frame_length, 1.0f); integ_lines = frame_length * exposure_frac; // See page 79 of the datasheet, this is the max allowed (-1 for phase adjust) @@ -385,7 +386,7 @@ static void set_exposure(CameraState *s, float exposure_frac, float gain_frac) { if (gain_frac >= 0) { // ISO200 is minimum gain - gain_frac = clamp(gain_frac, 1.0/64, 1.0); + gain_frac = std::clamp(gain_frac, 1.0f/64, 1.0f); // linearize gain response // TODO: will be wrong for front camera @@ -1718,7 +1719,7 @@ void actuator_move(CameraState *s, uint16_t target) { } int dest_step_pos = s->cur_step_pos + step; - dest_step_pos = clamp(dest_step_pos, 0, 255); + dest_step_pos = std::clamp(dest_step_pos, 0, 255); struct msm_actuator_cfg_data actuator_cfg_data = {0}; actuator_cfg_data.cfgtype = CFG_MOVE_FOCUS; @@ -1804,8 +1805,8 @@ static void do_autofocus(CameraState *s) { } // stay off the walls - lens_true_pos = clamp(lens_true_pos, dac_down, dac_up); - int target = clamp(lens_true_pos - sag, dac_down, dac_up); + lens_true_pos = std::clamp(lens_true_pos, float(dac_down), float(dac_up)); + int target = std::clamp(lens_true_pos - sag, float(dac_down), float(dac_up)); s->lens_true_pos = lens_true_pos; /*char debug[4096]; diff --git a/selfdrive/common/util.h b/selfdrive/common/util.h index 18d9619c..c7a1dbfc 100644 --- a/selfdrive/common/util.h +++ b/selfdrive/common/util.h @@ -21,12 +21,6 @@ typedef void (*sighandler_t)(int sig); #endif -#define clamp(a,b,c) \ - ({ __typeof__ (a) _a = (a); \ - __typeof__ (b) _b = (b); \ - __typeof__ (c) _c = (c); \ - _a < _b ? _b : (_a > _c ? _c : _a); }) - #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0])) #undef ALIGN diff --git a/selfdrive/loggerd/tests/Makefile b/selfdrive/loggerd/tests/Makefile index d05d5491..99f834d2 100644 --- a/selfdrive/loggerd/tests/Makefile +++ b/selfdrive/loggerd/tests/Makefile @@ -11,7 +11,7 @@ WARN_FLAGS = -Werror=implicit-function-declaration \ -Wno-deprecated-declarations CFLAGS = -std=gnu11 -g -fPIC -O2 $(WARN_FLAGS) -CXXFLAGS = -std=c++11 -g -fPIC -O2 $(WARN_FLAGS) +CXXFLAGS = -std=c++1z -g -fPIC -O2 $(WARN_FLAGS) FFMPEG_LIBS = -lavformat \ -lavcodec \ diff --git a/selfdrive/modeld/visiontest.mk b/selfdrive/modeld/visiontest.mk index 8e8f199d..494e00f8 100644 --- a/selfdrive/modeld/visiontest.mk +++ b/selfdrive/modeld/visiontest.mk @@ -20,7 +20,7 @@ WARN_FLAGS = -Werror=implicit-function-declaration \ -Werror=format-extra-args CFLAGS = -std=gnu11 -g -fPIC $(OPT_FLAGS) $(WARN_FLAGS) -CXXFLAGS = -std=c++14 -fPIC $(OPT_FLAGS) $(WARN_FLAGS) +CXXFLAGS = -std=c++1z -fPIC $(OPT_FLAGS) $(WARN_FLAGS) EIGEN_FLAGS = -I$(PHONELIBS)/eigen diff --git a/selfdrive/ui/spinner/Makefile b/selfdrive/ui/spinner/Makefile index 8d80f69a..49401067 100644 --- a/selfdrive/ui/spinner/Makefile +++ b/selfdrive/ui/spinner/Makefile @@ -10,7 +10,7 @@ WARN_FLAGS = -Werror=implicit-function-declaration \ -Werror=format-extra-args CFLAGS = -std=gnu11 -fPIC -O2 $(WARN_FLAGS) -CXXFLAGS = -std=c++11 -fPIC -O2 $(WARN_FLAGS) +CXXFLAGS = -std=c++1z -fPIC -O2 $(WARN_FLAGS) NANOVG_FLAGS = -I$(PHONELIBS)/nanovg diff --git a/selfdrive/ui/test/Makefile b/selfdrive/ui/test/Makefile index f321593e..76a7eba0 100644 --- a/selfdrive/ui/test/Makefile +++ b/selfdrive/ui/test/Makefile @@ -10,7 +10,7 @@ WARN_FLAGS = -Werror=implicit-function-declaration \ -Werror=format-extra-args CFLAGS = -std=gnu11 -g -fPIC -O2 $(WARN_FLAGS) -CXXFLAGS = -std=c++11 -g -fPIC -O2 $(WARN_FLAGS) +CXXFLAGS = -std=c++1z -g -fPIC -O2 $(WARN_FLAGS) ZMQ_FLAGS = -I$(PHONELIBS)/zmq/aarch64/include ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib \ diff --git a/selfdrive/ui/text/Makefile b/selfdrive/ui/text/Makefile index fbde1077..ac0d720d 100644 --- a/selfdrive/ui/text/Makefile +++ b/selfdrive/ui/text/Makefile @@ -10,7 +10,7 @@ WARN_FLAGS = -Werror=implicit-function-declaration \ -Werror=format-extra-args CFLAGS = -std=gnu11 -fPIC -O2 $(WARN_FLAGS) -CXXFLAGS = -std=c++11 -fPIC -O2 $(WARN_FLAGS) +CXXFLAGS = -std=c++1z -fPIC -O2 $(WARN_FLAGS) NANOVG_FLAGS = -I$(PHONELIBS)/nanovg