Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Arnd Bergmann and committed by
Masahiro Yamada
10f94d8f 72a9913a

+6 -6
+6 -6
scripts/unifdef.c
··· 203 203 static int delcount; /* count of deleted lines */ 204 204 static unsigned blankcount; /* count of blank lines */ 205 205 static unsigned blankmax; /* maximum recent blankcount */ 206 - static bool constexpr; /* constant #if expression */ 206 + static bool constexpression; /* constant #if expression */ 207 207 static bool zerosyms = true; /* to format symdepth output */ 208 208 static bool firstsym; /* ditto */ 209 209 ··· 819 819 /* 820 820 * Function for evaluating the innermost parts of expressions, 821 821 * viz. !expr (expr) number defined(symbol) symbol 822 - * We reset the constexpr flag in the last two cases. 822 + * We reset the constexpression flag in the last two cases. 823 823 */ 824 824 static Linetype 825 825 eval_unary(const struct ops *ops, int *valp, const char **cpp) ··· 877 877 cp = skipcomment(cp); 878 878 if (defparen && *cp++ != ')') 879 879 return (LT_ERROR); 880 - constexpr = false; 880 + constexpression = false; 881 881 } else if (!endsym(*cp)) { 882 882 debug("eval%d symbol", ops - eval_ops); 883 883 sym = findsym(cp); ··· 895 895 lt = *valp ? LT_TRUE : LT_FALSE; 896 896 cp = skipargs(cp); 897 897 } 898 - constexpr = false; 898 + constexpression = false; 899 899 } else { 900 900 debug("eval%d bad expr", ops - eval_ops); 901 901 return (LT_ERROR); ··· 955 955 int val = 0; 956 956 957 957 debug("eval %s", *cpp); 958 - constexpr = killconsts ? false : true; 958 + constexpression = killconsts ? false : true; 959 959 ret = eval_table(eval_ops, &val, cpp); 960 960 debug("eval = %d", val); 961 - return (constexpr ? LT_IF : ret == LT_ERROR ? LT_IF : ret); 961 + return (constexpression ? LT_IF : ret == LT_ERROR ? LT_IF : ret); 962 962 } 963 963 964 964 /*