[dpdk-stable] [PATCH v2 04/13] app/test: fix macro definition

Lukasz Wojciechowski l.wojciechow at partner.samsung.com
Wed Apr 8 18:15:30 CEST 2020


Hi Thomas,

Before my patch there was just a definition:
#define RTE_TEST_TRACE_FAILURE TEST_TRACE_FAILURE
without #ifndef condition.

It caused a build problem to me when working on security test, which 
uses both rte_test.h and test.h
As libraries should go first on the include list before local files I used:

#include <rte_test.h>
#include "test.h"

sequence, which cause obvious build error as RTE_TEST_TRACE_FAILURE was 
first defined as an empty macro inside rte_test.h, and redefinition in 
test.h caused a problem.


So I had two ways to solve the issue:
1) to wrap it with #ifndef condition and leave the definition there
2) to remove the redefinition from test.h

I've chosen the 1) solution because:
* Author of the former patch had placed the definition there for some 
purpose
* In my opinion it is better to have the definition present and pointing 
to the same macro for both RTE_TEST_TRACE_FAILURE and TEST_TRACE_FAILURE 
as it would make logs look more consistent when printing information the 
same way.

Best regards
Lukasz


W dniu 08.04.2020 o 14:53, Thomas Monjalon pisze:
> 08/04/2020 05:13, Lukasz Wojciechowski:
>> Wrap RTE_TEST_TRACE_FAILURE macro definition into #ifndef clause
>> as it might be already defined.
> I think it should not be defined at all.
> Why not including rte_test.h?
>
>
>
-- 

Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciechow at partner.samsung.com



More information about the stable mailing list