From aa5eb299eff5ed7334d00631307d59112c8f076a Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 23 Feb 2026 14:30:20 -0800 Subject: [PATCH 1/3] switch to system compiler (GCC on Linux, Clang on macOS) Remove hardcoded CC='clang'/CXX='clang++', add -Wno-cpp for GCC Cython compat, use -Wshadow=local on GCC, fix unused-result warnings, and rename constructor params to avoid GCC shadow warnings. Co-Authored-By: Claude Opus 4.6 --- SConstruct | 6 ++---- msgq/event.cc | 2 +- msgq/visionipc/visionbuf.cc | 2 +- msgq/visionipc/visionipc_client.cc | 2 +- msgq/visionipc/visionipc_server.cc | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/SConstruct b/SConstruct index 476672be5..a3605c336 100644 --- a/SConstruct +++ b/SConstruct @@ -51,15 +51,13 @@ elif GetOption('asan'): env = Environment( ENV=os.environ, - CC='clang', - CXX='clang++', CCFLAGS=[ "-g", "-fPIC", "-O2", "-Wunused", "-Werror", - "-Wshadow", + "-Wshadow" if arch == "Darwin" else "-Wshadow=local", "-Wno-vla-cxx-extension", "-Wno-unknown-warning-option", ] + ccflags, @@ -78,7 +76,7 @@ Export('env', 'arch', 'common') envCython = env.Clone(LIBS=[]) envCython["CPPPATH"] += [np.get_include()] -envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-shadow", "-Wno-deprecated-declarations"] +envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-cpp", "-Wno-shadow", "-Wno-deprecated-declarations"] envCython["CCFLAGS"].remove('-Werror') if arch == "Darwin": envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"] diff --git a/msgq/event.cc b/msgq/event.cc index 854c620b9..81defe204 100644 --- a/msgq/event.cc +++ b/msgq/event.cc @@ -129,7 +129,7 @@ int Event::clear() const { uint64_t val = 0; // read the eventfd to clear it - read(this->event_fd, &val, sizeof(uint64_t)); + [[maybe_unused]] ssize_t ret = read(this->event_fd, &val, sizeof(uint64_t)); return val; } diff --git a/msgq/visionipc/visionbuf.cc b/msgq/visionipc/visionbuf.cc index e4b8725de..2365dac0e 100644 --- a/msgq/visionipc/visionbuf.cc +++ b/msgq/visionipc/visionbuf.cc @@ -25,7 +25,7 @@ static void *malloc_with_fd(size_t len, int *fd) { unlink(full_path); - ftruncate(*fd, len); + [[maybe_unused]] int ret = ftruncate(*fd, len); void *addr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, *fd, 0); assert(addr != MAP_FAILED); diff --git a/msgq/visionipc/visionipc_client.cc b/msgq/visionipc/visionipc_client.cc index 75374ffc8..1812b3386 100644 --- a/msgq/visionipc/visionipc_client.cc +++ b/msgq/visionipc/visionipc_client.cc @@ -22,7 +22,7 @@ static int connect_to_vipc_server(const std::string &name, bool blocking) { return socket_fd; } -VisionIpcClient::VisionIpcClient(std::string name, VisionStreamType type, bool conflate) : name(name), type(type) { +VisionIpcClient::VisionIpcClient(std::string name_, VisionStreamType type_, bool conflate) : name(name_), type(type_) { msg_ctx = Context::create(); sock = SubSocket::create(msg_ctx, get_endpoint_name(name, type), "127.0.0.1", conflate, false); diff --git a/msgq/visionipc/visionipc_server.cc b/msgq/visionipc/visionipc_server.cc index b444f81c9..7ea6d71c7 100644 --- a/msgq/visionipc/visionipc_server.cc +++ b/msgq/visionipc/visionipc_server.cc @@ -26,7 +26,7 @@ std::string get_ipc_path(const std::string& name) { return path + "visionipc_" + name; } -VisionIpcServer::VisionIpcServer(std::string name) : name(name) { +VisionIpcServer::VisionIpcServer(std::string name_) : name(name_) { msg_ctx = Context::create(); std::random_device rd("/dev/urandom"); From d7534d190ade4edccec20a28b33e9b61b12fc52c Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 23 Feb 2026 14:35:39 -0800 Subject: [PATCH 2/3] rm that --- setup.sh | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/setup.sh b/setup.sh index f768b4db9..78e74d10a 100755 --- a/setup.sh +++ b/setup.sh @@ -6,25 +6,6 @@ cd $DIR PLATFORM=$(uname -s) -echo "installing dependencies" -if [[ $PLATFORM == "Darwin" ]]; then - if ! command -v python3 &>/dev/null; then - export HOMEBREW_NO_AUTO_UPDATE=1 - brew install python3 - fi -elif [[ $PLATFORM == "Linux" ]]; then - # for AGNOS since we clear the apt lists - if [[ ! -d /"var/lib/apt/" ]]; then - sudo apt update - fi - - sudo apt-get install -y --no-install-recommends \ - curl ca-certificates \ - python3-dev python3-pip python3-venv -else - echo "WARNING: unsupported platform. skipping apt/brew install." -fi - # catch2 if [ ! -d $DIR/msgq/catch2/ ]; then rm -rf /tmp/catch2/ $DIR/msgq/catch2/ From bb8d15e098598408330e9836c399e1e0394cd706 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 23 Feb 2026 14:39:32 -0800 Subject: [PATCH 3/3] properly check return values instead of [[maybe_unused]] Co-Authored-By: Claude Opus 4.6 --- msgq/event.cc | 3 ++- msgq/visionipc/visionbuf.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/msgq/event.cc b/msgq/event.cc index 81defe204..1f55a9595 100644 --- a/msgq/event.cc +++ b/msgq/event.cc @@ -129,7 +129,8 @@ int Event::clear() const { uint64_t val = 0; // read the eventfd to clear it - [[maybe_unused]] ssize_t ret = read(this->event_fd, &val, sizeof(uint64_t)); + ssize_t ret = read(this->event_fd, &val, sizeof(uint64_t)); + assert(ret == sizeof(uint64_t)); return val; } diff --git a/msgq/visionipc/visionbuf.cc b/msgq/visionipc/visionbuf.cc index 2365dac0e..ad2399754 100644 --- a/msgq/visionipc/visionbuf.cc +++ b/msgq/visionipc/visionbuf.cc @@ -25,7 +25,8 @@ static void *malloc_with_fd(size_t len, int *fd) { unlink(full_path); - [[maybe_unused]] int ret = ftruncate(*fd, len); + int ret = ftruncate(*fd, len); + assert(ret == 0); void *addr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, *fd, 0); assert(addr != MAP_FAILED);