summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2023-04-07 12:15:43 +0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2023-04-07 11:44:45 +0000
commit94eab59667820f46222ee21dc21ada988fa2beab (patch)
treee050153975b2fddb94a5ebb4f55ceb0dd0f8eaf3
parent56f5af937854dd82cb14ae2bf166fa9ab436f30a (diff)
downloadorc-94eab59667820f46222ee21dc21ada988fa2beab.tar.gz
Don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics should be used instead. GCC 11 has started warning about using volatile with atomic operations. In case of orc, the volatile integers were always protected with a mutex, which makes it completely unnecessary. Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/91>
-rw-r--r--orc/orc.c2
-rw-r--r--orc/orcfunctions.c4
-rw-r--r--tools/orcc.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/orc/orc.c b/orc/orc.c
index 7b4808c..40240ef 100644
--- a/orc/orc.c
+++ b/orc/orc.c
@@ -36,7 +36,7 @@ void _orc_compiler_init(void);
void
orc_init (void)
{
- static volatile int inited = FALSE;
+ static int inited = FALSE;
if (!inited) {
orc_global_mutex_lock ();
diff --git a/orc/orcfunctions.c b/orc/orcfunctions.c
index 3ddc501..9aa7f99 100644
--- a/orc/orcfunctions.c
+++ b/orc/orcfunctions.c
@@ -182,7 +182,7 @@ void
orc_memcpy (void * ORC_RESTRICT d1, const void * ORC_RESTRICT s1, int n)
{
OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
+ static int p_inited = 0;
static OrcCode *c = 0;
void (*func) (OrcExecutor *);
@@ -279,7 +279,7 @@ void
orc_memset (void * ORC_RESTRICT d1, int p1, int n)
{
OrcExecutor _ex, *ex = &_ex;
- static volatile int p_inited = 0;
+ static int p_inited = 0;
static OrcCode *c = 0;
void (*func) (OrcExecutor *);
diff --git a/tools/orcc.c b/tools/orcc.c
index 3585e93..36b0adc 100644
--- a/tools/orcc.c
+++ b/tools/orcc.c
@@ -862,7 +862,7 @@ output_code_execute (OrcProgram *p, FILE *output, int is_inline)
fprintf(output, " OrcProgram *p = _orc_program_%s;\n", p->name);
}
} else {
- fprintf(output, " static volatile int p_inited = 0;\n");
+ fprintf(output, " static int p_inited = 0;\n");
if (use_code) {
fprintf(output, " static OrcCode *c = 0;\n");
} else {