Project

General

Profile

Actions

Bug #4248

closed

Missing explicit instantiation declarations for wireEncode function templates

Added by Junxiao Shi over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Low
Category:
Base
Target version:
Start date:
08/13/2017
Due date:
% Done:

100%

Estimated time:

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).

Actions #1

Updated by Junxiao Shi over 6 years ago

  • Assignee set to Davide Pesavento

https://gerrit.named-data.net/4124 attempts to fix this issue, but there are Doxygen errors.
Actually I tried this before but Doxygen won't let me pass...

Actions #2

Updated by Davide Pesavento over 6 years ago

  • Subject changed from wireEncode specialization should appear in headers to Missing explicit instantiation declarations for wireEncode function templates
  • Description updated (diff)
Actions #3

Updated by Davide Pesavento over 6 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 50
Actions #4

Updated by Davide Pesavento over 6 years ago

  • Status changed from In Progress to Feedback
  • Priority changed from Normal to Low
Actions #5

Updated by Davide Pesavento over 6 years ago

Can we use #ifdef to hide the declarations from doxygen?

Actions #6

Updated by Junxiao Shi over 6 years ago

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.

Actions #7

Updated by Davide Pesavento over 6 years ago

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)

Actions #8

Updated by Junxiao Shi over 6 years ago

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.

Actions #9

Updated by Davide Pesavento over 6 years ago

  • Status changed from Feedback to In Progress
Actions #10

Updated by Davide Pesavento over 6 years ago

  • % Done changed from 50 to 80
Actions #11

Updated by Davide Pesavento over 6 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 80 to 100
Actions #12

Updated by Davide Pesavento over 6 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF