capicxx-core-tools icon indicating copy to clipboard operation
capicxx-core-tools copied to clipboard

Removed reserved _ from template name

Open kheaactua opened this issue 2 years ago • 4 comments

The C++ templates here use the symbol _AttributeExtensions which is reserved.

https://github.com/COVESA/capicxx-core-tools/blob/1e6e696fcf3a0dcf470e0d3a761cffd85321609f/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend#L162-L163

In addition to the names documented in this manual, reserved names include all external identifiers (global functions and variables) that begin with an underscore (‘_’) and all identifiers regardless of use that begin with either two underscores or an underscore followed by a capital letter are reserved names. This is so that the library and header files can define functions, variables, and macros for internal purposes without risk of conflict with names in user programs.

Reserved Names

I haven't encountered any problems with this, but it does introduce undefined behaviour which concerns me.

This addressed https://github.com/COVESA/capicxx-core-tools/issues/42. I haven't tested this PR as I have build issues with maven.

kheaactua avatar Nov 13 '23 16:11 kheaactua

@kheaactua very well, let's wait them until you find the problems. Meanwhile the CI will run to check the results here. cc @DiogoPedrozza @dibpinto

goncaloalmeida avatar Nov 13 '23 16:11 goncaloalmeida

I don't think I'll have time to be able to get the generators to work. Last time I was successfully about to was in 2020, it took 2 days and a lot of support from people I don't have contact with anymore.

kheaactua avatar Nov 13 '23 17:11 kheaactua

I just managed to build this with the shinyay/docker-mvn-jdk8:3.6.3. I'll brush up on what I was doing here and give the built generators a try.

In case any one else hit annoying issues, these were my steps:

# Pull a maven jdk8 image
❯ docker pull shinyay/docker-mvn-jdk8:3.6.3

# Run the image
❯ docker run -it shinyay/docker-mvn-jdk8 bash 

# Download git
❯ yum install git

# Clones the tools
❯ git clone https://github.com/COVESA/capicxx-core-tools

# Changes directories
❯ cd capicxx-core-tools/org.genivi.commonapi.core.releng

# Ran maven
❯ mvn -Dtarget.id=org.genivi.commonapi.core.target clean verify

# Repeat maven command when it hits random failures 

kheaactua avatar Jun 10 '24 18:06 kheaactua

The change appears to be successful and the generated code builds:

For a sample (the diff is backwards)

diff -r bld-neutrino-new_gen/RelWithDebInfo/main/fidl/capi-src-gen/core/proxy/v1/com/test/example/CapicxxExampleProxy.hpp bld-neutrino-old_gen/RelWithDebInfo/main/fidl/capi-src-gen/core/proxy/v1/com/test/example/CapicxxExampleProxy.hpp                                                                         
3c3                                                                                                                                                                                                                                                                                                                           
< * Used org.genivi.commonapi.core 3.2.14.v202406101807.                                                                                                                                                                                                                                                                      
---                                                                                                                                                                                                                                                                                                                           
> * Used org.genivi.commonapi.core 3.2.14.v202310241605.                                                                                                                                                                                                                                                                      
35c35                                                                                                                                                                                                                                                                                                                         
< template <typename ... TAttributeExtensions>                                                                                                                                                                                                                                                                                
---                                                                                                                                                                                                                                                                                                                           
> template <typename ... _AttributeExtensions>                                                                                                                                                                                                                                                                                
39c39                                                                                                                                                                                                                                                                                                                         
<       virtual public TAttributeExtensions... {                                                                                                                                                                                                                                                                              
---                                                                                                                                                                                                                                                                                                                           
>       virtual public _AttributeExtensions... {                                                                                                                                                                                                                                                                              
226,228c226,228                                                                                                                                                                                                                                                                                                               
< template <typename ... TAttributeExtensions>                                                                                                                                                                                                                                                                                
< CapicxxExampleProxy<TAttributeExtensions...>::CapicxxExampleProxy(std::shared_ptr<CommonAPI::Proxy> delegate):                                                                                                                                                                                                              
<         TAttributeExtensions(*(std::dynamic_pointer_cast< CapicxxExampleProxyBase>(delegate)))...,                                                                                                                                                                                                                          
---                                                                                                                                                                                                                                                                                                                           
> template <typename ... _AttributeExtensions>                                                                                                                                                                                                                                                                                
> CapicxxExampleProxy<_AttributeExtensions...>::CapicxxExampleProxy(std::shared_ptr<CommonAPI::Proxy> delegate):                                                                                                                                                                                                              
>         _AttributeExtensions(*(std::dynamic_pointer_cast< CapicxxExampleProxyBase>(delegate)))...,                                                                                                                                                                                                                          
232,233c232,233                                                                                                                                                                                                                                                                                                               
< template <typename ... TAttributeExtensions>                                                                                                                                                                                                                                                                                
< CapicxxExampleProxy<TAttributeExtensions...>::~CapicxxExampleProxy() {                                                                                                                                                                                                                                                      
---                                                                                                                                                                                                                                                                                                                           
> template <typename ... _AttributeExtensions>                                                                                                                                                                                                                                                                                
> CapicxxExampleProxy<_AttributeExtensions...>::~CapicxxExampleProxy() {                                                                                                                                                                                                                                                      
236,237c236,237                                                                                                                                                                                                                                                                                                               
< template <typename ... TAttributeExtensions>                                                                                                                                                                                                                                                                                
< void CapicxxExampleProxy<TAttributeExtensions...>::getColor(CommonAPI::CallStatus &_internalCallStatus, ExampleTypes::Color &_color, const CommonAPI::CallInfo *_info) {                                                                                                                                                    
---                                                                                                                                                                                                                                                                                                                           
> template <typename ... _AttributeExtensions>                                                                                                                                                                                                                                                                                
> void CapicxxExampleProxy<_AttributeExtensions...>::getColor(CommonAPI::CallStatus &_internalCallStatus, ExampleTypes::Color &_color, const CommonAPI::CallInfo *_info) {

kheaactua avatar Jun 11 '24 19:06 kheaactua