diff options
| author | Viresh Kumar <viresh.kumar@linaro.org> | 2021-07-01 07:32:37 +0530 |
|---|---|---|
| committer | Viresh Kumar <viresh.kumar@linaro.org> | 2021-07-01 07:32:37 +0530 |
| commit | c503c193db7d7ccc0c58b1ef694eaef331318149 (patch) | |
| tree | 44d3215196f385e88fa5da6affc58649c90e0ea9 /tools/include/linux | |
| parent | 9821a195d4e263801884b105554e801642c59f2a (diff) | |
| parent | 1eb5dde674f57b1a1918dab33f09e35cdd64eb07 (diff) | |
Merge branch 'cpufreq/cppc-fie' into cpufreq/arm/linux-next
Diffstat (limited to 'tools/include/linux')
| -rw-r--r-- | tools/include/linux/bits.h | 2 | ||||
| -rw-r--r-- | tools/include/linux/const.h | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/tools/include/linux/bits.h b/tools/include/linux/bits.h index 7f475d59a097..87d112650dfb 100644 --- a/tools/include/linux/bits.h +++ b/tools/include/linux/bits.h @@ -22,7 +22,7 @@ #include <linux/build_bug.h> #define GENMASK_INPUT_CHECK(h, l) \ (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ - __builtin_constant_p((l) > (h)), (l) > (h), 0))) + __is_constexpr((l) > (h)), (l) > (h), 0))) #else /* * BUILD_BUG_ON_ZERO is not available in h files included from asm files, diff --git a/tools/include/linux/const.h b/tools/include/linux/const.h index 81b8aae5a855..435ddd72d2c4 100644 --- a/tools/include/linux/const.h +++ b/tools/include/linux/const.h @@ -3,4 +3,12 @@ #include <vdso/const.h> +/* + * This returns a constant expression while determining if an argument is + * a constant expression, most importantly without evaluating the argument. + * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de> + */ +#define __is_constexpr(x) \ + (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) + #endif /* _LINUX_CONST_H */ |
