eProsima / Fast-DDS-Gen

Fast-DDS IDL code generator tool. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
77 stars 58 forks source link

Modules create invalid header guard #167

Closed burak-yildizoz closed 1 month ago

burak-yildizoz commented 1 year ago

As requested by issue eProsima/Fast-DDS#195, the generated C++ code honors the module name in the header guard. However, the technique used to convert lowercase to uppercase must be locale-free. For instance, if the module name is invalid, the generated header guard becomes İNVALİD in Turkish locale. toUpperCase method in commit f058a03 should be replaced with std::toupper. Another issue is that if there are nested modules, the header guard uses the innermost module name of the last struct. It would be better if it uses the outermost module name.

brianwing90 commented 1 year ago

It would be better if it uses the outermost module name.

Actually, having dealt with this exact issue, it is preferred that header guards use the entire module namespace. This avoids issues such as some::company::namespace::HelloMessage and some::other::company::namespace::HelloMessage producing the same header guard and being exclusively includable within the same C++ application.

All of that being said, I believe this issue actually belongs to the FastDDSGen issue board since it applies to the code generated using FastDDSGen.

jsan-rt commented 1 year ago

Hi @burak-yildizoz thanks for your report,

As @brianwing90 said, this is an issue of Fast DDS-Gen so I'll be moving it there.

gozdekirbiz commented 1 month ago

I'm having the same issue. Any planned updates for this problem?

JesusPoderoso commented 1 month ago

Hi, Fast DDS Gen in master branch uses java string toUpperCase() method in the guard generation. We are not planning to change it in shot-middle terms. Maybe running the Fast DDS Gen from a docker with the desired Locale suits your needs.