diff --git a/compiler2/Type_chk.cc b/compiler2/Type_chk.cc index 4a1b0278493d5c30e8c8225782283d79f9d4a552..9f27487b7f1a9db02d6068dec95253e448697ab3 100644 --- a/compiler2/Type_chk.cc +++ b/compiler2/Type_chk.cc @@ -861,6 +861,7 @@ void Type::chk_encodings() case OT_RECORD_OF: case OT_COMP_FIELD: case OT_SELTYPE: + case OT_FIELDSETTING: // ASN.1 types automatically have BER, PER, XER, OER and JSON encoding add_coding(string("BER:2002"), Ttcn::MOD_NONE, true); add_coding(string(get_encoding_name(CT_PER)), Ttcn::MOD_NONE, true); diff --git a/compiler2/Type_codegen.cc b/compiler2/Type_codegen.cc index d4d2e4bd6aafd5935b00033c6f895a5e3006767d..f6125fe50bb8b736301a44ca71bddf61f0d42e67 100644 --- a/compiler2/Type_codegen.cc +++ b/compiler2/Type_codegen.cc @@ -518,7 +518,7 @@ void Type::generate_code_xerdescriptor(output_struct* target) continue; } else { // probably a built-in type, punt with the C++ class name - last_s = ot->get_genname_value(0); + last_s = ot->get_genname_value(ot->get_my_scope()); break; } } diff --git a/regression_test/RAW/Bug522656/Bug522656.ttcn b/regression_test/RAW/Bug522656/Bug522656.ttcn index 9d3ff513a79669af4a6d082e11481155782947d2..40f225f355f5863fcdcd23a5f8b71f0616456c42 100644 --- a/regression_test/RAW/Bug522656/Bug522656.ttcn +++ b/regression_test/RAW/Bug522656/Bug522656.ttcn @@ -32,6 +32,9 @@ type record Rec { Oct1 o, Char3 c } +with { + variant ""; +} type component CT {} diff --git a/regression_test/compileonly/Makefile b/regression_test/compileonly/Makefile index a88a0e9409750028567c9ded017fbb7dadc73cee..7ec82dcf2e70ddc19a1545f476978009a46ec7f1 100644 --- a/regression_test/compileonly/Makefile +++ b/regression_test/compileonly/Makefile @@ -29,7 +29,7 @@ CODIRS := dynamicTemplate styleGuide topLevelPdu \ attribQualif HT48786 selectCase openTypeNames \ defaultParamUsageBeforeDecl deterministic readFromFile \ asn1_hyphen nameClash portTranslation UntaggedOnTopLevelUnionSwitch \ - typeDescrGenWIthNoXER languageSpec asn1_opentype + typeDescrGenWIthNoXER languageSpec asn1_opentype openTypeXER ifdef DYN CODIRS += mfgen-xsd diff --git a/regression_test/compileonly/openTypeXER/.gitignore b/regression_test/compileonly/openTypeXER/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3781f975bbd785e2d38ac1825bef34f8a7f67406 --- /dev/null +++ b/regression_test/compileonly/openTypeXER/.gitignore @@ -0,0 +1,4 @@ +openTypeXER +openTypeXER.exe +Types*.cc +Types*.hh diff --git a/regression_test/compileonly/openTypeXER/Makefile b/regression_test/compileonly/openTypeXER/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..3c62789d884c1bb8fb4a5cbff2ff39588d502560 --- /dev/null +++ b/regression_test/compileonly/openTypeXER/Makefile @@ -0,0 +1,51 @@ +############################################################################## +# Copyright (c) 2000-2017 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Baranyi, Botond +# +############################################################################## +TOPDIR := ../.. +include $(TOPDIR)/Makefile.regression + +.PHONY: all clean dep + +TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) + +TTCN3_MODULES = +ASN1_MODULES = Types.asn + +GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.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 = openTypeXER$(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) $(ASN1_MODULES) + $(TTCN3_COMPILER) -a $(COMPILER_FLAGS) $^ + +clean distclean: + $(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ + $(GENERATED_SOURCES) compile *.log + +dep: $(GENERATED_SOURCES) + makedepend $(CPPFLAGS) $(GENERATED_SOURCES) diff --git a/regression_test/compileonly/openTypeXER/Types.asn b/regression_test/compileonly/openTypeXER/Types.asn new file mode 100644 index 0000000000000000000000000000000000000000..7eb1ea8be75baedff1c9689c1ab1f7fc76187d39 --- /dev/null +++ b/regression_test/compileonly/openTypeXER/Types.asn @@ -0,0 +1,52 @@ +--///////////////////////////////////////////////////////////////////////////// +-- Copyright (c) 2000-2017 Ericsson Telecom AB +-- All rights reserved. This program and the accompanying materials +-- are made available under the terms of the Eclipse Public License v1.0 +-- which accompanies this distribution, and is available at +-- http://www.eclipse.org/legal/epl-v10.html +-- +-- Contributors: +-- Baranyi, Botond +-- +--///////////////////////////////////////////////////////////////////////////// +Types +DEFINITIONS + +AUTOMATIC TAGS +EXTENSIBILITY IMPLIED +::= + BEGIN + +IMPORTS ; -- nothing + + +ERROR-CLASS ::= CLASS +{ + &category PrintableString(SIZE(1)), + &code INTEGER, + &Type DEFAULT INTEGER +} +WITH SYNTAX {&category &code [&Type]} + +ErrorSet ERROR-CLASS ::= +{ + {"A" 1 [1] INTEGER} | + {"A" 2 [1] VisibleString} | + {"B" 1 [1] PrintableString} | + {"B" 2 [1] BOOLEAN} | + oneErrorObject +} + +oneErrorObject ERROR-CLASS ::= { "C" 3 ENUMERATED{foobar} } + +ErrorReturn ::= SEQUENCE +{ + errorCategory ERROR-CLASS.&category ({ErrorSet}) OPTIONAL, + errors SEQUENCE OF SEQUENCE + { + errorCode ERROR-CLASS.&code({ErrorSet}{@errorCategory}), + errorInfo [99] ERROR-CLASS.&Type({ErrorSet}{@errorCategory,@.errorCode}) + } OPTIONAL +} + +END