COVESA / capicxx-core-tools

Common API C++ core tools
Mozilla Public License 2.0
131 stars 104 forks source link

The C++ generator uses reserved symbols which introduces undefined bahaviour #42

Open kheaactua opened 1 year ago

kheaactua commented 1 year ago

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.

goncaloalmeida commented 10 months ago

This problem is still occurring?

kheaactua commented 10 months ago

Well the code hasn't been updated, so yes. :)

goncaloalmeida commented 8 months ago

@kheaactua do you have any PR to fix this? We can consider that for a future release.

cc @Gustavo1515 @lutzbichler

kheaactua commented 8 months ago

Not yet, I'll create one.

kheaactua commented 8 months ago

I created https://github.com/COVESA/capicxx-core-tools/pull/65 but I haven't tested it.

I can't build org.genivi.commonapi.console (on master)

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

// ....

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.22.0:compile (default-compile) on project org.genivi.commonapi.console: Compilation failure: Compilation failure:                                                                                                                                    
[ERROR] /home/matt/workspace/capicxx-core-tools/org.genivi.commonapi.console/src/org/genivi/commonapi/console/ICommandLineHandler.java:[1]                                                                                                                                                                                    
[ERROR]         /* Copyright (C) 2015-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 
Gustavo1515 commented 4 months ago

I created #65 but I haven't tested it.

I can't build org.genivi.commonapi.console (on master)

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

// ....

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.22.0:compile (default-compile) on project org.genivi.commonapi.console: Compilation failure: Compilation failure:                                                                                                                                    
[ERROR] /home/matt/workspace/capicxx-core-tools/org.genivi.commonapi.console/src/org/genivi/commonapi/console/ICommandLineHandler.java:[1]                                                                                                                                                                                    
[ERROR]         /* Copyright (C) 2015-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 

This error seems to be related with a wrong java version. Java 8 is the version that must be used.

kheaactua commented 4 months ago

Oh, I'm pretty sure I was in the latest jdk, k, I'll set up java 8 and try

kheaactua commented 4 months ago

I tried with https://hub.docker.com/r/eucm/maven , but got:

[WARNING] Error injecting: org.eclipse.xtend.maven.XtendCompile                                                                                                                                                                                                                                                               
com.google.inject.ProvisionException: Unable to provision, see the following errors:                                                                                                                                                                                                                                          

1) [Guice/ErrorInjectingConstructor]: com.google.inject.internal.util.$ComputationException: com.google.inject.internal.util.$ComputationException: com.google.inject.internal.util.$ComputationException: com.google.inject.internal.util.$ComputationException: com.google.inject.internal.util.$ComputationException: Excep
tionInInitializerError                                                                                                                                                                                                                                                                                                        
  at XtendCompile.<init>(XtendCompile.java:29)                                                                                                                                                                                                                                                                                
  while locating XtendCompile                                                                                                                                                                                                                                                                                                 

Learn more:                                                                                                                                                                                                                                                                                                                   
  https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR                                                                                                                                                                                                                                                            

1 error                                                                                                                                                                                                                                                                                                                       

======================                                                                                                                                                                                                                                                                                                        
Full classname legend:                                                                                                                                                                                                                                                                                                        
======================                                                                                                                                                                                                                                                                                                        
XtendCompile:                "org.eclipse.xtend.maven.XtendCompile"                                                                                                                                                                                                                                                           
========================                                                                                                                                                                                                                                                                                                      
End of classname legend:                                                                                                                                                                                                                                                                                                      
========================

I don't think it's a downloading error. I'll give it another shot, and if it still fails I'll try a different container.

kheaactua commented 4 months ago

Using eclipse/ubuntu_jdk8, I got:

[INFO] --- xtend-maven-plugin:2.20.0:compile (default) @ org.genivi.commonapi.core.target ---
[INFO] skip compiling sources because the configured directory '[/workspace/capicxx-core-tools/org.genivi.commonapi.core.target/src/main/java]' does not exist.
[INFO] 
[INFO] --- tycho-packaging-plugin:0.22.0:package-target-definition (default-package-target-definition) @ org.genivi.commonapi.core.target ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building org.genivi.commonapi.console 3.2.14-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ org.genivi.commonapi.console ---
[INFO] Deleting /workspace/capicxx-core-tools/org.genivi.commonapi.console/target
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] org.genivi.commonapi.core.releng ................... SUCCESS [ 23.246 s]
[INFO] org.genivi.commonapi.core.target ................... SUCCESS [  0.053 s]
[INFO] org.genivi.commonapi.console ....................... FAILURE [  1.061 s]
[INFO] org.genivi.commonapi.console.franca.feature ........ SKIPPED
[INFO] org.genivi.commonapi.console.feature ............... SKIPPED
[INFO] org.genivi.commonapi.core .......................... SKIPPED
[INFO] org.genivi.commonapi.core.cli ...................... SKIPPED
[INFO] org.genivi.commonapi.core.cli.feature .............. SKIPPED
[INFO] org.genivi.commonapi.core.cli.product .............. SKIPPED
[INFO] org.genivi.commonapi.core.ui ....................... SKIPPED
[INFO] org.genivi.commonapi.core.feature .................. SKIPPED
[INFO] org.genivi.commonapi.core.validator ................ SKIPPED
[INFO] org.genivi.commonapi.core.validator.feature ........ SKIPPED
[INFO] org.genivi.commonapi.core.updatesite ............... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:00 min
[INFO] Finished at: 2024-02-21T23:10:38+00:00
[INFO] Final Memory: 163M/1656M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project org.genivi.commonapi.console: Failed to clean project: Failed to delete /workspace/capicxx-core-tools/org.genivi.commonapi.console/target/classes -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :org.genivi.commonapi.console