Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2018-11-23 13:08:16 +0000
committerHenrik Rentz-Reichert2018-11-23 16:07:24 +0000
commit5f90e312dbeeffaa057b682e3becb2cee79f6ea0 (patch)
tree714ee95ab99632e9f6a612024ae28458e0c2bce1 /plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c
parent4c57977d9e3f098ffae44ee5f3373878b351feca (diff)
downloadorg.eclipse.etrice-5f90e312dbeeffaa057b682e3becb2cee79f6ea0.tar.gz
org.eclipse.etrice-5f90e312dbeeffaa057b682e3becb2cee79f6ea0.tar.xz
org.eclipse.etrice-5f90e312dbeeffaa057b682e3becb2cee79f6ea0.zip
reduced warnings in eTrice Java and Xtend sources
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c')
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend16
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend6
5 files changed, 21 insertions, 11 deletions
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
index b1aa47ff5..43f124459 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
@@ -40,10 +40,10 @@ import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.RoomClass
import org.eclipse.etrice.core.room.RoomModel
import org.eclipse.etrice.core.room.util.RoomHelpers
+import org.eclipse.etrice.generator.c.Main
+import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.xtext.util.Pair
-import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
-import org.eclipse.etrice.generator.c.Main
@Singleton
class CExtensions implements ILanguageExtension {
@@ -54,7 +54,7 @@ class CExtensions implements ILanguageExtension {
override String getTypedDataDefinition(EObject msg) {
if (msg instanceof Message) {
- generateArglistAndTypedData((msg as Message).data).get(TypedDataKind.DECLARATION_AND_INITIALIZATION.ordinal)
+ generateArglistAndTypedData(msg.data).get(TypedDataKind.DECLARATION_AND_INITIALIZATION.ordinal)
}
else {
""
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend
index ebb1976f6..cc3f0fda4 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend
@@ -68,7 +68,7 @@ class Initialization {
DataClass:
'''
{
- «FOR subA : (aType as DataClass).allAttributes SEPARATOR ','»
+ «FOR subA :aType.allAttributes SEPARATOR ','»
«initAttributeArray(instance, path.union(subA))»
«ENDFOR»
}'''
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend
index 428b3071c..7bf1c8885 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend
@@ -36,7 +36,7 @@ class MainGen {
prepFS.prepare
for (e: resource.contents){
if (e instanceof Root) {
- doGenerate(e as Root)
+ doGenerate(e)
}
}
}
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
index a1aadf370..3edaff61e 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
@@ -43,11 +43,11 @@ import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.base.logging.ILogger
import org.eclipse.etrice.generator.c.Main
+import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
import org.eclipse.etrice.generator.fsm.base.IntelligentSeparator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
-import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
@Singleton
class NodeGen {
@@ -388,7 +388,7 @@ class NodeGen {
/* nothing to do */
«ELSE»
«FOR pi:ai.orderedIfItemInstances»
- «IF pi.protocol.getPortClass(pi.conjugated)?.attributes?.size > 0»
+ «IF pi.portClassAttributesSize > 0»
static «pi.protocol.getPortClassName(pi.conjugated)»_var «pi.path.pathName»_var«IF pi.replicated»[«pi.peers.size»]«ENDIF»={
«FOR Integer i:1.. if(pi.peers.size==0)1 else pi.peers.size SEPARATOR ', '»
«attrInitGenAddon.generateAttributeInit(pi, pi.interfaceItem.portClass.attributes)»
@@ -410,6 +410,16 @@ class NodeGen {
'''
}
+
+ private def int getPortClassAttributesSize(InterfaceItemInstance pi) {
+ val attribs = pi.protocol.getPortClass(pi.conjugated)?.attributes
+ if (attribs===null) {
+ 0
+ }
+ else {
+ attribs.size
+ }
+ }
def private genActorInstanceInitializer(Root root, ActorInstance ai) {
val instName = ai.path.pathName
@@ -810,7 +820,7 @@ class NodeGen {
while (iter.hasNext) {
val obj = iter.next
if (obj instanceof PortInstance) {
- val pi = obj as PortInstance
+ val pi = obj
if (!pi.port.relay) {
// only data driven
if (pi.protocol.commType==CommunicationType::DATA_DRIVEN) {
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
index 1a1e47090..901ccf7cc 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
@@ -69,7 +69,7 @@ class StateMachineGen extends GenericStateMachineGenerator {
/**
* @param generateImplementation NOT used
*/
- override public genExtra(GraphContainer gc, boolean generateImplementation) {
+ override genExtra(GraphContainer gc, boolean generateImplementation) {
val mc = gc.component
val allStates = gc.graph.allStateNodes.map[stateGraphNode].filter(typeof(State)).toList
val states = allStates.getLeafStatesLast
@@ -93,7 +93,7 @@ class StateMachineGen extends GenericStateMachineGenerator {
'''
}
- override public stateType() {
+ override stateType() {
"etInt16"
}
@@ -106,7 +106,7 @@ class StateMachineGen extends GenericStateMachineGenerator {
((void)trigger__et); /* avoids unused warning */
'''
}
- override public unreachableReturn() {
+ override unreachableReturn() {
"/* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */"
}

Back to the top