Skip to content

fix(io): serializer registration is not unique

Description

SIGHT_REGISTER_SERIALIZER macro is originally made unique based on the LINE keyword, which refers to the line number in the file, where the macro is situated. This works well for declaring the variable inside because it is static, thus we ensure it does not conflict inside the compile target. However, this is also used to make the class declaration unique, but it may not if the line number is identical inside the compile target.

As release inlines all, the line is different each time, and it can work fine.

For debug, if the macro is at the same line number, the macro is no more unique.

To solve this, we reused the same pattern used in other registration macro. The class declaration is made unique thanks to a template specialisation with the registered data type.

Closes #1027 (closed)

How to test it?

Put SIGHT_REGISTER_SERIALIZER on the same line in two different data with serialization and verify that both serializers are registered.

Edited by Flavien BRIDAULT

Merge request reports