On Fri, Jun 26, 2020 at 2:06 PM Jerin Jacob <jerinjac...@gmail.com> wrote:
>
> On Fri, Jun 26, 2020 at 5:13 PM David Marchand
> <david.march...@redhat.com> wrote:
> >
> > On Fri, Jun 26, 2020 at 1:16 PM Jerin Jacob <jerinjac...@gmail.com> wrote:
> > > > > Alternative is to keep variable declaration outside,
> > > > > as David suggested, and I tend to agree that it is a
> > > > > bit better. Macro name says 'register'. It is not
> > > > > 'declare and register'. Also it avoids static-vs-extern
> > > > > problem completely. The solution allows to keep the
> > > > > variable declaration untouched and put constructor (macro)
> > > > > at the end of fine where constructors typically reside.
> > > >
> > > > My only concern with that approach is that, We can not save a lot of
> > > > code duplication
> > > > with that scheme. ie. it is [1] vs [2]. We can change the MACRO name
> > > > accordingly if that is a concern. Any suggestions?
> > > >
> > > > Let me know your preference on [1] vs [2], I will stick with for the
> > > > next version.
> > >
> > > If there are no other comments, I change RTE_LOG_REGISTER to static 
> > > version
> > > and RTE_LOG_REGISTER_EXTERN for a non-static version and send the next 
> > > version.
> >
> > - Having a macro that does more than what its name tells is inconvenient.
>
> I agree. What could be that name if we want to declare and register?
> RTE_LOG_DECLARE_AND_REGISTER_EXTERN?

(sorry, gmail ctrl+enter ...)

Or no declaration in macro and leave code as it is.


> > - Having components set log levels at init time in the macro is a bug to me.
> > This has been worked around with
> > rte_log_register/rte_log_register_and_pick_level but the initial
> > problem is that rte_log_set_level* should only be called by the user.
>
> I agree with the below stuff, That's is not introduced by this patch.
> It is already there.
> Be it macro or no macro code.
>
> I think this patch helps to change to new scheme as it takes care of
> changing the
> registration part to commonplace so that we can set to the same level
> in the future if
> everyone agrees to it

We will still expose this macro meaning that we will have an API breakage later.
So if we go with introducing this, let's make it good from the start.


-- 
David Marchand

Reply via email to