"wangyanan (Y)" <wangyana...@huawei.com> writes:

> Hi Markus,
>
> On 2021/10/11 13:26, Markus Armbruster wrote:
>> Yanan Wang <wangyana...@huawei.com> writes:
>>
>>> Functionally smp_parse() is only called once and in one place
>>> i.e. machine_set_smp, the possible second place where it'll be
>>> called should be some unit tests if any.
>>>
>>> Actually we are going to introduce an unit test for the parser.
>>> For necessary isolation of the tested code, split smp_parse out
>>> into a separate header as an inline API.
>> Why inline?
> The motivation of the splitting is to isolate the tested smp_parse
> from the other unrelated code in machine.c, so that we can solve
> the build dependency problem for the unit test.
>
> I once tried to split smp_parse out into a source file in [1] for the
> test, but it looks more concise and convenient to make it as an
> inline function in a header compared to [1]. Given that we only call
> it in one place, it may not be harmful to keep it an inline.
>
> Anyway, I not sure the method in this patch is most appropriate
> and compliant. If it's just wrong I can change back to [1]. :)
>
> [1]
> https://lore.kernel.org/qemu-devel/20210910073025.16480-16-wangyana...@huawei.com/#t

I'd prefer to keep it in .c, but I'm not the maintainer.


Reply via email to