[dpdk-dev] [RFC PATCH 1/5] graph: introduce graph subsystem

Gaetan Rivet grive at u256.net
Mon Feb 3 10:14:37 CET 2020


On 02/02/2020 12:21, Jerin Jacob wrote:
> On Sun, Feb 2, 2020 at 4:08 PM Stephen Hemminger
> <stephen at networkplumber.org> wrote:
>>
>> On Fri, 31 Jan 2020 22:31:57 +0530
>> <jerinj at marvell.com> wrote:
>>
>>> +
>>> +#define set_err(err, where, fmt, ...) do {                                  \
>>> +     graph_err(fmt, ##__VA_ARGS__);                                         \
>>> +     rte_errno = err;                                                       \
>>> +     goto where;                                                            \
>>> +} while (0)
>>
>> I dislike this macro, it makes static analysis harder and requires
>> the reader to know that the argument is a goto target. And since it is lower
>> case, implies that it is a function. Usually macros are in upper case.
>>
>> It makes the code smaller but a cost of being different which impacts the
>> readability of the code.
> 
> I don't like macro either. That's the only case where I have used
> macro, Even in the fast path,
> I did multiple rework to remove macro. Without that macro, that code bloats
> and will have a lot repeatable code. I have a preference in using _goto_ to have
> a unified exit to simply the stuff and therefor maintain the code.
> You could see the amount of verification done in rte_graph_create(). So, IMO,
> In this case, it is justified to use the macro.
> 

Hi Jerin,

Renaming it in uppercase and making clear there will be a jump could alleviate some concerns?
Something like SET_ERR_JMP() maybe or SET_ERR_GOTO().


More information about the dev mailing list