[dpdk-dev,v2,11/12] eal: allow empty set of compile time cpuflags
Commit Message
On architectures that do not rely on RTE_COMPILE_TIME_CPUFLAGS, the
compile_time_flags[] array can end up being zero sized. This results in a
compiler complaint in the subsequent loop. Pulling out the array size
computation silences this complaint.
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
---
lib/librte_eal/common/eal_common_cpuflags.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
@@ -62,10 +62,12 @@ rte_cpu_check_supported(void)
static const enum rte_cpu_flag_t compile_time_flags[] = {
RTE_COMPILE_TIME_CPUFLAGS
};
+ unsigned count =
+ sizeof(compile_time_flags)/sizeof(compile_time_flags[0]);
unsigned i;
int ret;
- for (i = 0; i < sizeof(compile_time_flags)/sizeof(compile_time_flags[0]); i++) {
+ for (i = 0; i < count; i++) {
ret = rte_cpu_get_flag_enabled(compile_time_flags[i]);
if (ret < 0) {