Bug #4248
closed
Missing explicit instantiation declarations for wireEncode function templates
Added by Junxiao Shi over 7 years ago.
Updated over 7 years ago.
Description
Currently, the wireEncode(EncodingImpl<T>&)
function templates are forward declared in header files, but their definitions, along with two explicit instantiations, appear in the .cpp
files only.
Such code is illegal unless every use of the function template that would trigger an implicit instantiation is preceded by an explicit instantiation declaration (extern template
).
- Assignee set to Davide Pesavento
- Subject changed from wireEncode specialization should appear in headers to Missing explicit instantiation declarations for wireEncode function templates
- Description updated (diff)
- Status changed from New to In Progress
- % Done changed from 0 to 50
- Status changed from In Progress to Feedback
- Priority changed from Normal to Low
Can we use #ifdef
to hide the declarations from doxygen?
I prefer a solution of changing Doxygen or CI config to ignore such warnings.
Can we use #ifdef
to hide the declarations from doxygen?
It looks ugly. It would be better to declare a NDN_SPECIALIZE_WIRE_ENCODE
macro:
NDN_SPECIALIZE_WIRE_ENCODE(Selectors);
This macro could be declared differently depending on Doxygen or not. It only needs to handle the most common case where wireEncode
takes one parameter of either EncodingBuffer or Estimator. A handful of classes including Data
would need manual specialization with #ifndef DOXYGEN
.
Junxiao Shi wrote:
I prefer a solution of changing Doxygen or CI config to ignore such warnings.
Please suggest a specific solution. I don't have access to the CI config and I have no idea how that thing works.
Can we use #ifdef
to hide the declarations from doxygen?
It looks ugly. It would be better to declare a NDN_SPECIALIZE_WIRE_ENCODE
macro:
A pair of #ifndef
/#endif
looks ugly? Bah... Anyway, if it makes you happy, I can write a macro. (btw it's an instantiation, not specialization)
A pair of #ifndef
/#endif
looks ugly?
In fact, the whole specialization thingy looks ugly because it's basically repeated code in every file (either .hpp or .cpp). #ifndef
adds to that mess. Having a macro covers most cases.
- Status changed from Feedback to In Progress
- % Done changed from 50 to 80
- Status changed from In Progress to Code review
- % Done changed from 80 to 100
- Status changed from Code review to Closed
Also available in: Atom
PDF