From: Denys Fedoryshchenko <denys.f@collabora.com>
To: linux-media@vger.kernel.org
Subject: [PATCH] v4l-utils: add missing <cstdlib> includes
Date: Wed, 2 Sep 2026 19:13:26 +0300 [thread overview]
Message-ID: <20260902161325.2122745-2-denys.f@collabora.com> (raw)
Several utilities call std::exit() but include only <stdlib.h>, or no
standard library header at all. This relies on transitive includes to make
std::exit() available.
The issue can be reproduced with libc++ by configuring with:
CXX=clang++ \
CXXFLAGS="-stdlib=libc++ -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES=1" \
meson setup build
ninja -C build
Include <cstdlib> for std::exit(). cec-test-fuzzing.cpp calls random() and
cec-tuner.cpp calls abs() unqualified, so include <stdlib.h> there.
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
---
utils/cec-compliance/cec-compliance.h | 1 +
utils/cec-compliance/cec-test-fuzzing.cpp | 1 +
utils/cec-ctl/cec-ctl.cpp | 1 +
utils/cec-follower/cec-tuner.cpp | 1 +
utils/common/cv4l-helpers.h | 1 +
utils/edid-decode/calc-ovt.cpp | 1 +
utils/edid-decode/edid-decode.cpp | 1 +
utils/rds-ctl/rds-ctl.cpp | 1 +
utils/v4l2-compliance/v4l2-compliance.h | 1 +
utils/v4l2-ctl/v4l2-ctl.h | 1 +
utils/v4l2-dbg/v4l2-dbg.cpp | 1 +
11 files changed, 11 insertions(+)
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index 8cb316f..93606b2 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -13,6 +13,7 @@
#include <cec-info.h>
+#include <cstdlib>
#include <vector>
#define TAG_AUDIO_RATE_CONTROL 1
diff --git a/utils/cec-compliance/cec-test-fuzzing.cpp b/utils/cec-compliance/cec-test-fuzzing.cpp
index 0fe1d5a..0f550d4 100644
--- a/utils/cec-compliance/cec-test-fuzzing.cpp
+++ b/utils/cec-compliance/cec-test-fuzzing.cpp
@@ -9,6 +9,7 @@
#include <sys/ioctl.h>
#include "cec-compliance.h"
+#include <stdlib.h>
int testFuzzing(struct node &node, unsigned me, unsigned la)
{
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 5638ca8..8209466 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -27,6 +27,7 @@
#include "cec-ctl.h"
#include "compiler.h"
+#include <cstdlib>
static struct timespec start_monotonic;
static struct timeval start_timeofday;
diff --git a/utils/cec-follower/cec-tuner.cpp b/utils/cec-follower/cec-tuner.cpp
index a2cb6ca..b0a8870 100644
--- a/utils/cec-follower/cec-tuner.cpp
+++ b/utils/cec-follower/cec-tuner.cpp
@@ -10,6 +10,7 @@
#include "cec-follower.h"
#include "compiler.h"
+#include <stdlib.h>
#define NUM_ANALOG_FREQS 3
#define NUM_DIGITAL_CHANS 3
diff --git a/utils/common/cv4l-helpers.h b/utils/common/cv4l-helpers.h
index ab9c64b..ba47e26 100644
--- a/utils/common/cv4l-helpers.h
+++ b/utils/common/cv4l-helpers.h
@@ -9,6 +9,7 @@
#ifndef _CV4L_HELPERS_H_
#define _CV4L_HELPERS_H_
+#include <cstdlib>
#include <limits.h>
#include <v4l-helpers.h>
diff --git a/utils/edid-decode/calc-ovt.cpp b/utils/edid-decode/calc-ovt.cpp
index 91472d8..2528ac9 100644
--- a/utils/edid-decode/calc-ovt.cpp
+++ b/utils/edid-decode/calc-ovt.cpp
@@ -12,6 +12,7 @@
#include <numeric>
#include "edid-decode.h"
+#include <cstdlib>
#define MinVblankDuration 460
#define MinVblankLines 20
diff --git a/utils/edid-decode/edid-decode.cpp b/utils/edid-decode/edid-decode.cpp
index 4505cf3..ca2e8dc 100644
--- a/utils/edid-decode/edid-decode.cpp
+++ b/utils/edid-decode/edid-decode.cpp
@@ -17,6 +17,7 @@
#include <unistd.h>
#include "edid-decode.h"
+#include <cstdlib>
#define STR(x) #x
#define STRING(x) STR(x)
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index bff9d04..de4ac69 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -28,6 +28,7 @@
#include <v4l2-info.h>
#include <libv4l2rds.h>
#include <v4l-getsubopt.h>
+#include <cstdlib>
using dev_vec = std::vector<std::string>;
using dev_map = std::map<std::string, std::string>;
diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index b43c581..7ca4744 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -25,6 +25,7 @@
#include <set>
#include <string>
#include <cstdint>
+#include <cstdlib>
#include <linux/videodev2.h>
#include <linux/v4l2-subdev.h>
diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
index ae6f43f..c4d955d 100644
--- a/utils/v4l2-ctl/v4l2-ctl.h
+++ b/utils/v4l2-ctl/v4l2-ctl.h
@@ -4,6 +4,7 @@
#include <cstdint>
#include <linux/videodev2.h>
#include <linux/v4l2-subdev.h>
+#include <cstdlib>
#include <stdlib.h>
#include <v4l-getsubopt.h>
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index 6c8fa69..5c92bfb 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -42,6 +42,7 @@
#include "v4l2-dbg-ac97.h"
#include "v4l2-dbg-tvp5150.h"
#include "v4l2-dbg-micron.h"
+#include <cstdlib>
struct board_list {
const char *name;
--
2.53.0
reply other threads:[~2026-09-02 16:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260902161325.2122745-2-denys.f@collabora.com \
--to=denys.f@collabora.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.