From: Rosen Penev <rosenp@gmail.com>
To: alsa-devel@alsa-project.org
Subject: [alsa-devel] [PATCH 3/3] treewide: Remove extra ; warning
Date: Tue, 10 Dec 2019 01:10:47 -0800 [thread overview]
Message-ID: <20191210091047.143081-3-rosenp@gmail.com> (raw)
In-Reply-To: <20191210091047.143081-1-rosenp@gmail.com>
Enclosed defines in a do/while loop to silence this.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
src/conf.c | 20 ++++++++++----------
src/mixer/simple.c | 16 ++++++++--------
src/topology/parser.c | 2 +-
src/ucm/ucm_subs.c | 10 ++++++----
4 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/src/conf.c b/src/conf.c
index e4306504..c26999b0 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -3062,7 +3062,7 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
#ifndef DOC_HIDDEN
#define SND_CONFIG_SEARCH(config, key, result, extra_code) \
-{ \
+do { \
snd_config_t *n; \
int err; \
const char *p; \
@@ -3081,10 +3081,10 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
} else \
return _snd_config_search(config, key, -1, result); \
} \
-}
+} while(0)
#define SND_CONFIG_SEARCHA(root, config, key, result, fcn, extra_code) \
-{ \
+do { \
snd_config_t *n; \
int err; \
const char *p; \
@@ -3108,10 +3108,10 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
} else \
return _snd_config_search(config, key, -1, result); \
} \
-}
+} while(0)
#define SND_CONFIG_SEARCHV(config, result, fcn) \
-{ \
+do { \
snd_config_t *n; \
va_list arg; \
assert(config); \
@@ -3132,10 +3132,10 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
if (result) \
*result = n; \
return 0; \
-}
+} while(0)
#define SND_CONFIG_SEARCHVA(root, config, result, fcn) \
-{ \
+do { \
snd_config_t *n; \
va_list arg; \
assert(config); \
@@ -3156,10 +3156,10 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
if (result) \
*result = n; \
return 0; \
-}
+} while(0)
#define SND_CONFIG_SEARCH_ALIAS(config, base, key, result, fcn1, fcn2) \
-{ \
+do { \
snd_config_t *res = NULL; \
char *old_key; \
int err, first = 1, maxloop = 1000; \
@@ -3201,7 +3201,7 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
if (result) \
*result = res; \
return 0; \
-}
+} while(0)
#endif /* DOC_HIDDEN */
diff --git a/src/mixer/simple.c b/src/mixer/simple.c
index 2861d97c..2b9daa6e 100644
--- a/src/mixer/simple.c
+++ b/src/mixer/simple.c
@@ -82,30 +82,30 @@ int snd_mixer_selem_register(snd_mixer_t *mixer,
#ifndef DOC_HIDDEN
#define CHECK_BASIC(xelem) \
-{ \
+do { \
assert(xelem); \
assert((xelem)->type == SND_MIXER_ELEM_SIMPLE); \
-}
+} while(0)
#define CHECK_DIR(xelem, xwhat) \
-{ \
+do { \
unsigned int xcaps = ((sm_selem_t *)(elem)->private_data)->caps; \
if (! (xcaps & (xwhat))) \
return -EINVAL; \
-}
+} while(0)
#define CHECK_DIR_CHN(xelem, xwhat, xjoin, xchannel) \
-{ \
+do { \
unsigned int xcaps = ((sm_selem_t *)(elem)->private_data)->caps; \
if (! (xcaps & (xwhat))) \
return -EINVAL; \
if (xcaps & (xjoin)) \
xchannel = 0; \
-}
+} while(0)
-#define CHECK_ENUM(xelem) \
+#define CHECK_ENUM(xelem) do { \
if (!(((sm_selem_t *)(elem)->private_data)->caps & (SM_CAP_PENUM|SM_CAP_CENUM))) \
- return -EINVAL;
+ return -EINVAL; } while(0)
#define COND_CAPS(xelem, what) \
!!(((sm_selem_t *)(elem)->private_data)->caps & (what))
diff --git a/src/topology/parser.c b/src/topology/parser.c
index 5940692d..473a65e6 100644
--- a/src/topology/parser.c
+++ b/src/topology/parser.c
@@ -382,7 +382,7 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
default:
SNDERR("error: invalid object type %d\n", t->type);
return -EINVAL;
- };
+ }
}
int snd_tplg_build(snd_tplg_t *tplg, const char *outfile)
diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c
index 90e395f0..5d5fd64e 100644
--- a/src/ucm/ucm_subs.c
+++ b/src/ucm/ucm_subs.c
@@ -146,15 +146,16 @@ static char *rval_sysfs(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char
return strdup(path);
}
-#define MATCH_VARIABLE(name, id, fcn, empty_ok) \
+#define MATCH_VARIABLE(name, id, fcn, empty_ok) do { \
if (strncmp((name), (id), sizeof(id) - 1) == 0) { \
rval = fcn(uc_mgr); \
idsize = sizeof(id) - 1; \
allow_empty = (empty_ok); \
goto __rval; \
- }
+ } \
+} while(0)
-#define MATCH_VARIABLE2(name, id, fcn) \
+#define MATCH_VARIABLE2(name, id, fcn) do { \
if (strncmp((name), (id), sizeof(id) - 1) == 0) { \
idsize = sizeof(id) - 1; \
tmp = strchr(value + idsize, '}'); \
@@ -170,7 +171,8 @@ static char *rval_sysfs(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char
rval = fcn(uc_mgr, v2); \
goto __rval; \
} \
- }
+ } \
+} while(0)
int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr,
char **_rvalue,
--
2.23.0
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
prev parent reply other threads:[~2019-12-10 9:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 9:10 [alsa-devel] [PATCH 1/3] treewide: Fix -Wformat=2 warnings Rosen Penev
2019-12-10 9:10 ` [alsa-devel] [PATCH 2/3] topology/builder: Fix absolute value warning Rosen Penev
2019-12-10 9:10 ` Rosen Penev [this message]
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=20191210091047.143081-3-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=alsa-devel@alsa-project.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox