Commit 94661daf authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Fixed coder function generation for base types with inherited 'encode' attributes (bug 550623)



Change-Id: I9e0a7f54f6c4e70ef7cd046a751da7e1e06326a2
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent bae05f5b
......@@ -7580,7 +7580,23 @@ namespace Common {
t = t->get_type_refd();
}
else {
return string();
switch (t->get_typetype_ttcn3()) {
case T_NULL:
case T_BOOL:
case T_INT:
case T_REAL:
case T_ENUM_T:
case T_BSTR:
case T_HSTR:
case T_OSTR:
case T_CSTR:
case T_USTR:
case T_OID:
// if the type is a base type, then it needs its own coder functions
return t->get_genname_own(p_scope);
default:
return string();
}
}
}
}
......
Bug550623
Bug550623.exe
Bug550623*.cc
Bug550623*.hh
/******************************************************************************
* Copyright (c) 2000-2019 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
*
* Contributors:
* Baranyi, Botond
*
******************************************************************************/
// the decoder functions for base types, that inherit 'encode' attributes from a higher scope
// (in this case the parent record), weren't generated, and their usages were generated incorrectly (bug 550623)
module Bug550623 {
type record templateHexstr_rec {
hexstring x1,
hexstring x2,
hexstring x3 optional
}
with {
encode "RAW";
}
template templateHexstr_rec templateHexstr_tDecmatchSelfRef := {
x1 := '01A'H,
x2 := decmatch templateHexstr_tDecmatchSelfRef.x1,
x3 := decmatch templateHexstr_rec: { x1 := templateHexstr_tDecmatchSelfRef.x1, x2 := ?, x3 := * }
};
}
##############################################################################
# Copyright (c) 2000-2019 Ericsson Telecom AB
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
#
# Contributors:
# Botond, Baranyi
#
##############################################################################
TOPDIR := ../..
include $(TOPDIR)/Makefile.regression
.PHONY: all clean dep
TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
TTCN3_MODULES = Bug550623.ttcn
GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc)
GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
ifdef CODE_SPLIT
GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc))
else ifdef SPLIT_TO_SLICES
POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_))
POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc))
GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES)))
GENERATED_SOURCES += $(GENERATED_SOURCES2)
endif
OBJECTS = $(GENERATED_SOURCES:.cc=.o)
TARGET = Bug550623$(EXESUFFIX)
all: $(TARGET)
$(TARGET): $(GENERATED_SOURCES) $(USER_SOURCES)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \
-L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS)
$(GENERATED_SOURCES) $(GENERATED_HEADERS): $(TTCN3_MODULES)
$(TTCN3_COMPILER) $(COMPILER_FLAGS) $^
clean distclean:
$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
$(GENERATED_SOURCES) compile *.log
dep: $(GENERATED_SOURCES)
makedepend $(CPPFLAGS) $(GENERATED_SOURCES)
......@@ -30,7 +30,8 @@ CODIRS := dynamicTemplate styleGuide topLevelPdu \
defaultParamUsageBeforeDecl deterministic readFromFile \
asn1_hyphen nameClash portTranslation UntaggedOnTopLevelUnionSwitch \
typeDescrGenWIthNoXER languageSpec asn1_opentype openTypeXER \
asnStringSubtypes componentParameter realtimeKeywords Bug550526
asnStringSubtypes componentParameter realtimeKeywords Bug550526 \
Bug550623
ifdef DYN
CODIRS += mfgen-xsd
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment