mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 06:04:23 +08:00
scripts/unifdef: avoid constexpr keyword
Starting with c23, 'constexpr' is a keyword in C like in C++ and cannot be used as an identifier: scripts/unifdef.c:206:25: error: 'constexpr' can only be used in variable declarations 206 | static bool constexpr; /* constant #if expression */ | ^ scripts/unifdef.c:880:13: error: expected identifier or '(' 880 | constexpr = false; | ^ Rename this instance to allow changing to C23 at some point in the future. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-By: Tony Finch <dot@dotat.at> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
72a9913a85
commit
10f94d8fcc
@ -203,7 +203,7 @@ static int depth; /* current #if nesting */
|
|||||||
static int delcount; /* count of deleted lines */
|
static int delcount; /* count of deleted lines */
|
||||||
static unsigned blankcount; /* count of blank lines */
|
static unsigned blankcount; /* count of blank lines */
|
||||||
static unsigned blankmax; /* maximum recent blankcount */
|
static unsigned blankmax; /* maximum recent blankcount */
|
||||||
static bool constexpr; /* constant #if expression */
|
static bool constexpression; /* constant #if expression */
|
||||||
static bool zerosyms = true; /* to format symdepth output */
|
static bool zerosyms = true; /* to format symdepth output */
|
||||||
static bool firstsym; /* ditto */
|
static bool firstsym; /* ditto */
|
||||||
|
|
||||||
@ -819,7 +819,7 @@ static const struct ops {
|
|||||||
/*
|
/*
|
||||||
* Function for evaluating the innermost parts of expressions,
|
* Function for evaluating the innermost parts of expressions,
|
||||||
* viz. !expr (expr) number defined(symbol) symbol
|
* viz. !expr (expr) number defined(symbol) symbol
|
||||||
* We reset the constexpr flag in the last two cases.
|
* We reset the constexpression flag in the last two cases.
|
||||||
*/
|
*/
|
||||||
static Linetype
|
static Linetype
|
||||||
eval_unary(const struct ops *ops, int *valp, const char **cpp)
|
eval_unary(const struct ops *ops, int *valp, const char **cpp)
|
||||||
@ -877,7 +877,7 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
|
|||||||
cp = skipcomment(cp);
|
cp = skipcomment(cp);
|
||||||
if (defparen && *cp++ != ')')
|
if (defparen && *cp++ != ')')
|
||||||
return (LT_ERROR);
|
return (LT_ERROR);
|
||||||
constexpr = false;
|
constexpression = false;
|
||||||
} else if (!endsym(*cp)) {
|
} else if (!endsym(*cp)) {
|
||||||
debug("eval%d symbol", ops - eval_ops);
|
debug("eval%d symbol", ops - eval_ops);
|
||||||
sym = findsym(cp);
|
sym = findsym(cp);
|
||||||
@ -895,7 +895,7 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
|
|||||||
lt = *valp ? LT_TRUE : LT_FALSE;
|
lt = *valp ? LT_TRUE : LT_FALSE;
|
||||||
cp = skipargs(cp);
|
cp = skipargs(cp);
|
||||||
}
|
}
|
||||||
constexpr = false;
|
constexpression = false;
|
||||||
} else {
|
} else {
|
||||||
debug("eval%d bad expr", ops - eval_ops);
|
debug("eval%d bad expr", ops - eval_ops);
|
||||||
return (LT_ERROR);
|
return (LT_ERROR);
|
||||||
@ -955,10 +955,10 @@ ifeval(const char **cpp)
|
|||||||
int val = 0;
|
int val = 0;
|
||||||
|
|
||||||
debug("eval %s", *cpp);
|
debug("eval %s", *cpp);
|
||||||
constexpr = killconsts ? false : true;
|
constexpression = killconsts ? false : true;
|
||||||
ret = eval_table(eval_ops, &val, cpp);
|
ret = eval_table(eval_ops, &val, cpp);
|
||||||
debug("eval = %d", val);
|
debug("eval = %d", val);
|
||||||
return (constexpr ? LT_IF : ret == LT_ERROR ? LT_IF : ret);
|
return (constexpression ? LT_IF : ret == LT_ERROR ? LT_IF : ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user