[dpdk-dev] [PATCH v3 04/12] eal: allow empty compile time flags

Tony Lu zlu at ezchip.com
Thu Jul 9 06:20:43 CEST 2015



>-----Original Message-----
>From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
>Sent: Thursday, July 09, 2015 8:46 AM
>To: Zhigang Lu
>Cc: dev at dpdk.org
>Subject: Re: [dpdk-dev] [PATCH v3 04/12] eal: allow empty compile time
flags
>
>2015-07-06 16:51, Zhigang Lu:
>> The rte_cpu_check_supported() code breaks with a "comparison is always
>> false due to limited range of data type" when the compile_time_flags[]
>> array is empty.  Assigning the array dimension to a local variable
>> apparently solves this.
>
>How is it related to the title "allow empty compile time flags"?

Changed the title and commit log a little bit as follows.

    eal: allow empty compile time flags RTE_COMPILE_TIME_CPUFLAGS
    
    When RTE_COMPILE_TIME_CPUFLAGS is empty, the rte_cpu_check_supported()
    code breaks with a "comparison is always false due to limited range of
    data type".  This is because the compile_time_flags[] array is empty.
    Assigning the array dimension to a local variable apparently solves
this.

>
>> -	unsigned i;
>> +	unsigned count = RTE_DIM(compile_time_flags), i;
>>  	int ret;
>
>Please define a "const unsigned count =" here to improve readability.

If define as a const unsigned count, we also get the following compiler
warning.
error: comparison of unsigned expression < 0 is always false

>
>> -	for (i = 0; i <
sizeof(compile_time_flags)/sizeof(compile_time_flags[0]); i++)
>{
>> +	for (i = 0; i < count; i++) {
>
>




More information about the dev mailing list