[LTP] [COMMITTED] save_restore: remove the duplicate 'const' declaration

Richard Palethorpe rpalethorpe@suse.de
Thu Mar 10 13:09:08 CET 2022


Hello,

"xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com> writes:

> Hi Richard
>> Hi Li
>>> --- a/lib/newlib_tests/test19.c
>>> +++ b/lib/newlib_tests/test19.c
>>> @@ -23,7 +23,7 @@ static struct tst_test test = {
>>>    	.needs_root = 1,
>>>    	.test_all = run,
>>>    	.setup = setup,
>>> -	.save_restore = (const struct tst_path_val const[]) {
>>> +	.save_restore = (const struct tst_path_val[]) {
>>>    		{"?/proc/nonexistent", NULL},
>>>    		{"!/proc/sys/kernel/numa_balancing", NULL},
>>>    		{"/proc/sys/kernel/core_pattern", NULL},
>>
>> Since tst_path_val is a struct array, we should use {NULL, NULL} or {}
>> terminated instead of NULL terminated , otherwise it will report missing
>> braces warning.
> Since we have the following rule
> LTP-005 Array must terminate with a sentinel value (i.e. NULL or '{}')
>
> Can we check struct array whether use {} terminated instead of NULL?

I think so, however naively enabling the check causes a segfault in
ptr_list_empty. Probably because there is no list, it's just NULL.

It already reports the missing braces, but I suppose this is not very
helpful.

>
> Best Regards
> Yang Xu
>>
>> Best Regards
>> Yang Xu
>>


-- 
Thank you,
Richard.


More information about the ltp mailing list