On Mon, Feb 26, 2024 at 9:20 PM Tyler Retzlaff <roret...@linux.microsoft.com> wrote: > > RTE_LOG_LINE cannot be augmented with a prefix format and arguments > without the user of RTE_LOG_LINE using the args... and ## args compiler > extension to conditionally remove trailing comma when the macro receives > only a single argument. > > Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix > format and arguments as separate parameters allowing them to be expanded > at the correct locations inside of RTE_FMT() allowing the rest of the > non-prefix format string and arguments to be collapsed to the argument > pack which can be directly forwarded with __VA_ARGS__ avoiding the need > for conditional comma removal. > > I've done my best to manually check expansions (preprocessed) and compiled > printf of the logs to validate correct output. > > note: due to drastic change in series i have not carried any series acks > forward. > > v3: > * remove leading _ from RTE_LOG_COMMA the macro is not internal > * add doxygen comment for existing RTE_LOG{,DP}_LINE function-like > macros, based on RTE_LOG{,DP} comments. > * add doxygen comment for new RTE_LOG{,DP}_LINE_PREFIX function-like > macros, based on RTE_LOG{,DP} comments. > * merge 2 vhost patches into a single patch (mistake in previous > submission)
I find this new helper less tricky to use and easier to read than the RTE_FMT_* stuff that gets copy/pasted everywhere. The changes are quite mechanical, so even though we are past -rc1, +1 for me on the series. Can we finish the job and convert remaining macros that prefix messages in lib/? -- David Marchand