Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed reserved _ from template name #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kheaactua
Copy link

@kheaactua kheaactua commented Nov 13, 2023

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

template <typename ... _AttributeExtensions>
class «fInterface.proxyClassName»

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 #42. I haven't tested this PR as I have build issues with maven.

These C++ templates used the symbol `_AttributeExtensions` which is reserved.

Docs:
> 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.

See: Reserved Names (https://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/Reserved-Names.html)

This wasn't causing any visible issues, but best to fix it before it
does.
@goncaloalmeida
Copy link
Contributor

@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

@kheaactua
Copy link
Author

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
Copy link
Author

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 directoriescd 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
Copy link
Author

kheaactua commented Jun 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants