COVESA / capicxx-someip-tools

Common API C++ SOMEIP tooling
Mozilla Public License 2.0
76 stars 55 forks source link

While Running .fdepl files with commonapi-core-generator getting an error #45

Open swatitupat123 opened 7 months ago

swatitupat123 commented 7 months ago

While running .fdepl files with commonapi getting an error message as the one which is mentioned below -

raise CommonApiGenError("call of '%s' failed: code %s" % (call, ret_code))

main__.CommonApiGenError: call of 'C:\TAF\eclipse_workspace\CommonAPI_3.2\commonapi_core_generator-3.2.12\commonapi-core-generator-windows-x86_64 -sk -d src-gen\core C:\f-file_structure\crossif13\idl\instances\MGU\de.infotainment.navigation.mapcontrol.fdepl' failed: code 1

dprogm commented 7 months ago

@swatitupat123 Can you tell me whether you are using enumeration inheritance (enumeration X extends Y {}) in your Franca IDL? I am experiencing the same issue and boiled it down to this inheritance relationship.

The problem is that when trying to access the currents enumeration width by calling getSomeIpEnumWidth(_obj) on an enumeration that has a base type this leads to a null pointer. Therefore the subsequent comparison with the base width is going to fail. The following snippet silently ignores this null pointer, but this means we wouldn't have any width in case of an inheritance relation.

diff --git a/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend b/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend
index 03e4e50..9361f28 100644
--- a/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend
+++ b/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend
@@ -336,7 +336,11 @@ class FrancaSomeIPDeploymentAccessorHelper {
                     if (itsBaseAccessor !== null)
                         enumBaseWidth = itsBaseAccessor.getSomeIpEnumWidthHelper(_obj.base)
                 }
-                return (enumBaseWidth !== null && enumBaseWidth > enumWidth ? enumBaseWidth : enumWidth)
+
+                if(enumBaseWidth !== null && enumWidth !== null && enumBaseWidth > enumWidth) {
+                    enumWidth = enumBaseWidth;
+                }
+                return enumWidth;
             }

             if (_obj instanceof FTypeDef) {
@@ -362,7 +366,10 @@ class FrancaSomeIPDeploymentAccessorHelper {
                     if (itsBaseAccessor !== null)
                         enumBaseBitWidth = itsBaseAccessor.getSomeIpEnumBitWidthHelper(_obj.base)
                 }
-                return (enumBaseBitWidth !== null && enumBaseBitWidth > enumBitWidth ? enumBaseBitWidth : enumBitWidth)
+                if(enumBaseBitWidth !== null && enumBitWidth !== null && enumBaseBitWidth > enumBitWidth) {
+                    enumBitWidth = enumBaseBitWidth;
+                }
+                return enumBitWidth;
             }

             if (_obj instanceof FTypeDef) {
@@ -1046,7 +1053,7 @@ class FrancaSomeIPDeploymentAccessorHelper {
                 return itsBaseAccessor.hasDeployment(_enum.base)
         }

-        return false 
+        return false
     }

     def dispatch boolean hasDeployment(PropertyAccessor _accessor, FStructType _struct) {
@@ -1217,7 +1224,7 @@ class FrancaSomeIPDeploymentAccessorHelper {
             itsByteBufferMaxLength = _accessor.getSomeIpByteBufferMaxLength(_element)
         }
         if (itsSpecificByteBufferMaxLength !== null
-            && itsSpecificByteBufferMaxLength != itsByteBufferMaxLength 
+            && itsSpecificByteBufferMaxLength != itsByteBufferMaxLength
             && itsSpecificByteBufferMaxLength != SOMEIP_DEFAULT_MAX_LENGTH) {
             return true
         }
@@ -1250,7 +1257,7 @@ class FrancaSomeIPDeploymentAccessorHelper {
             itsStringLengthWidth = itsBaseAccessor.getSomeIpStringLengthWidth(_element)
         }
         if (itsSpecificStringLengthWidth !== null
-            && itsSpecificStringLengthWidth != itsStringLengthWidth 
+            && itsSpecificStringLengthWidth != itsStringLengthWidth
             && itsSpecificStringLengthWidth != SOMEIP_DEFAULT_LENGTH_WIDTH) {
             return true
         }
@@ -1383,7 +1390,7 @@ class FrancaSomeIPDeploymentAccessorHelper {

         return false
     }
-    
+
     def boolean hasNonArrayDeployment(PropertyAccessor _accessor,
                                       FTypedElement _attribute) {
         if (_attribute.type.derived !== null