diff --git a/compiler2/makefile.c b/compiler2/makefile.c index fccbda2f470dd19207a4e55f06556be651df1510..adcb011132521254fe1983abfde4ab312091ac13 100644 --- a/compiler2/makefile.c +++ b/compiler2/makefile.c @@ -267,6 +267,7 @@ struct makefile_struct { boolean omit_in_value_list; boolean warnings_for_bad_variants; boolean activate_debugger; + boolean ignore_untagged_on_top_union; boolean disable_predef_ext_folder; struct string_list* solspeclibraries; /* not owned */ struct string_list* sol8speclibraries; /* not owned */ @@ -335,6 +336,8 @@ static void init_makefile_struct(struct makefile_struct *makefile) makefile->omit_in_value_list = FALSE; makefile->warnings_for_bad_variants = FALSE; makefile->activate_debugger = FALSE; + makefile->ignore_untagged_on_top_union = FALSE; + makefile->disable_predef_ext_folder = FALSE; makefile->solspeclibraries = NULL; makefile->sol8speclibraries = NULL; makefile->linuxspeclibraries = NULL; @@ -2223,7 +2226,7 @@ static void print_makefile(struct makefile_struct *makefile) "AR = ar\n" "ARFLAGS = \n\n" "# Flags for the TTCN-3 and ASN.1 compiler:\n" - "COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n" + "COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n" "# Execution mode: (either ttcn3 or ttcn3-parallel)\n" "TTCN3_LIB = ttcn3%s%s%s\n\n" #ifdef LICENSE @@ -2262,6 +2265,7 @@ static void print_makefile(struct makefile_struct *makefile) (makefile->omit_in_value_list ? " -M" : ""), (makefile->warnings_for_bad_variants ? " -E" : ""), (makefile->activate_debugger ? " -n" : ""), + (makefile->ignore_untagged_on_top_union ? " -N" : ""), (makefile->tcov_file_name ? makefile->tcov_file_name : ""), (makefile->profiled_file_list ? " -z $(PROFILED_FILE_LIST)" : ""), /* end of COMPILER FLAGS */ @@ -4647,7 +4651,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[], boolean disablexer, boolean disablejson, boolean forcexerinasn, boolean defaultasomit, boolean gccmsgformat, boolean linenumbersonlymsg, boolean includesourceinfo, boolean addsourcelineinfo, boolean suppresswarnings, boolean outparamboundness, boolean omit_in_value_list, boolean warnings_for_bad_variants, boolean activate_debugger, - boolean disable_predef_ext_folder, struct string_list* solspeclibraries, + boolean ignore_untagged_on_top_union, boolean disable_predef_ext_folder, struct string_list* solspeclibraries, struct string_list* sol8speclibraries, struct string_list* linuxspeclibraries, struct string_list* freebsdspeclibraries, struct string_list* win32speclibraries, const char* ttcn3preprocessor, struct string_list* linkerlibraries, struct string_list* additionalObjects, struct string_list* linkerlibsearchpath, char* generatorCommandOutput, @@ -4699,6 +4703,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[], makefile.omit_in_value_list = omit_in_value_list; makefile.warnings_for_bad_variants = warnings_for_bad_variants; makefile.activate_debugger = activate_debugger; + makefile.ignore_untagged_on_top_union = ignore_untagged_on_top_union; makefile.disable_predef_ext_folder = disable_predef_ext_folder; makefile.solspeclibraries = solspeclibraries; makefile.sol8speclibraries = sol8speclibraries; @@ -4845,7 +4850,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[], static void usage(void) { fprintf(stderr, "\n" - "usage: %s [-abc" C_flag "dDEfFglLmMnprRsStTVwWXZ] [-K file] [-z file ] [-P dir]" + "usage: %s [-abc" C_flag "dDEfFglLmMnNprRsStTVwWXZ] [-K file] [-z file ] [-P dir]" " [-J file] [-U none|type|'number'] [-e ets_name] [-o dir|file]\n" " [-t project_descriptor.tpd [-b buildconfig]]\n" " [-O file] ... module_name ... testport_name ...\n" @@ -4870,6 +4875,7 @@ static void usage(void) " -m: always use makedepend for dependencies\n" " -M: allow 'omit' in template value lists (legacy behavior)\n" " -n: activate debugger (generates extra code for debugging)\n" + " -N: ignore UNTAGGED encoding instruction on top level unions (legacy behaviour)\n" " -o dir|file: write the Makefile to the given directory or file\n" " -O file: add the given file to the Makefile as other file\n" " -p: generate Makefile with TTCN-3 preprocessing\n" @@ -4917,7 +4923,8 @@ int main(int argc, char *argv[]) gfflag = FALSE, lnflag = FALSE, isflag = FALSE, asflag = FALSE, Sflag = FALSE, Vflag = FALSE, Dflag = FALSE, Wflag = FALSE, djflag = FALSE, Zflag = FALSE, Hflag = FALSE, Mflag = FALSE, - diflag = FALSE, zflag = FALSE, Eflag = FALSE, nflag = FALSE; + diflag = FALSE, zflag = FALSE, Eflag = FALSE, nflag = FALSE, + Nflag = FALSE; boolean error_flag = FALSE; char *output_file = NULL; char *ets_name = NULL; @@ -4977,7 +4984,7 @@ int main(int argc, char *argv[]) } for ( ; ; ) { - int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgI:J:K:o:lLmMnpP:rRsSt:TU:vVwWXYz:ZH"); + int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgI:J:K:o:lLmMnNpP:rRsSt:TU:vVwWXYz:ZH"); if (c == -1) break; switch (c) { case 'O': @@ -5058,6 +5065,9 @@ int main(int argc, char *argv[]) case 'n': SET_FLAG(n); break; + case 'N': + SET_FLAG(N); + break; case 'p': SET_FLAG(p); break; @@ -5351,7 +5361,7 @@ int main(int argc, char *argv[]) &Rflag, &lflag, &mflag, &Pflag, &Lflag, rflag, Fflag, Tflag, output_file, &abs_work_dir, sub_project_dirs, program_name, prj_graph_fp, create_symlink_list, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, &csmode, &quflag, &dsflag, &cxxcompiler, &optlevel, &optflags, &dbflag, &drflag, &dtflag, &dxflag, &djflag, &fxflag, &doflag, &gfflag, &lnflag, &isflag, - &asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &diflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, &ttcn3prep, + &asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &Nflag, &diflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, &ttcn3prep, linkerlibraries, additionalObjects, linkerlibsearchpath, Vflag, Dflag, &Zflag, &Hflag, &generatorCommandOutput, target_placement_list, Wflag, run_command_list, required_configs, &profiled_file_list, search_paths, n_search_paths, &makefileScript); @@ -5398,7 +5408,7 @@ int main(int argc, char *argv[]) Rflag, lflag, mflag, Cflag, code_splitting_mode, tcov_file_name, profiled_file_list, file_list_file_name, Lflag, Zflag, Hflag, rflag ? sub_project_dirs : NULL, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, csmode, quflag, dsflag, cxxcompiler, optlevel, optflags, dbflag, - drflag, dtflag, dxflag, djflag, fxflag, doflag, gfflag, lnflag, isflag, asflag, wflag, Yflag, Mflag, Eflag, nflag, diflag, solspeclibraries, + drflag, dtflag, dxflag, djflag, fxflag, doflag, gfflag, lnflag, isflag, asflag, wflag, Yflag, Mflag, Eflag, nflag, Nflag, diflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, ttcn3prep, linkerlibraries, additionalObjects, linkerlibsearchpath, generatorCommandOutput, target_placement_list); if (makefileScript != NULL) { diff --git a/compiler2/xpather.cc b/compiler2/xpather.cc index 02c6522180824228d156fc49101afc5c8d80ed8f..63d60c1add5cc450621b6f267fa03f27bcf6b3ad 100644 --- a/compiler2/xpather.cc +++ b/compiler2/xpather.cc @@ -1268,7 +1268,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char* tpdName, c struct string_list* prep_defines, struct string_list* prep_undefines, char **p_csmode, boolean *p_quflag, boolean* p_dsflag, char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag, boolean* p_djflag, boolean* p_fxflag, boolean* p_doflag, boolean* p_gfflag, boolean* p_lnflag, boolean* p_isflag, - boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean *p_Eflag, boolean* p_nflag, + boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean *p_Eflag, boolean* p_nflag, boolean* p_Nflag, boolean* p_diflag, struct string_list* solspeclibs, struct string_list* sol8speclibs, struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3prep, struct string_list* linkerlibs, struct string_list* additionalObjects, struct string_list* linkerlibsearchp, boolean Vflag, boolean Dflag, @@ -1288,7 +1288,7 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg, struct string_list* prep_defines, struct string_list* prep_undefines, char **p_csmode, boolean *p_quflag, boolean* p_dsflag, char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag, boolean* p_djflag, boolean* p_fxflag, boolean* p_doflag, boolean* p_gfflag, boolean* p_lnflag, boolean* p_isflag, - boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean* p_Eflag, boolean* p_nflag, + boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean* p_Eflag, boolean* p_nflag, boolean* p_Nflag, boolean* p_diflag, struct string_list* solspeclibs, struct string_list* sol8speclibs, struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3prep, string_list* linkerlibs, string_list* additionalObjects, string_list* linkerlibsearchp, boolean Vflag, boolean Dflag, boolean *p_Zflag, @@ -1318,7 +1318,8 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg, prep_undefines, p_csmode, p_quflag, p_dsflag, cxxcompiler, optlevel, optflags, p_dbflag, p_drflag, p_dtflag, p_dxflag, p_djflag, p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag, - p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_diflag, solspeclibs, sol8speclibs, + p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_Nflag, + p_diflag, solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep, linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag, p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir, @@ -1346,7 +1347,8 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg, prep_undefines, p_csmode, p_quflag, p_dsflag, cxxcompiler, optlevel, optflags, p_dbflag, p_drflag, p_dtflag, p_dxflag, p_djflag, p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag, - p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_diflag, solspeclibs, sol8speclibs, + p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_Nflag, + p_diflag, solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep, linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag, p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir, @@ -1449,7 +1451,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c struct string_list* prep_defines, struct string_list* prep_undefines, char **p_csmode, boolean *p_quflag, boolean* p_dsflag, char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag, boolean* p_djflag, boolean* p_fxflag, boolean* p_doflag, boolean* p_gfflag, boolean* p_lnflag, boolean* p_isflag, - boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean* p_Eflag, boolean* p_nflag, + boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean* p_Eflag, boolean* p_nflag, boolean* p_Nflag, boolean* p_diflag, struct string_list* solspeclibs, struct string_list* sol8speclibs, struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3prep, string_list* linkerlibs, string_list* additionalObjects, string_list* linkerlibsearchp, boolean Vflag, boolean Dflag, boolean *p_Zflag, @@ -2054,6 +2056,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c xsdbool2boolean(xpathCtx, actcfg, "warningsForBadVariants", p_Eflag); xsdbool2boolean(xpathCtx, actcfg, "activateDebugger", p_nflag); xsdbool2boolean(xpathCtx, actcfg, "disablePredefinedExternalFolder", p_diflag); + xsdbool2boolean(xpathCtx, actcfg, "ignoreUntaggedOnTopLevelUnion", p_Nflag); projDesc = projGenHelper.getTargetOfProject(*p_project_name); if (projDesc) projDesc->setLinkingStrategy(*p_lflag); @@ -2944,6 +2947,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c my_dtflag = 0, my_dxflag = 0, my_djflag = 0, my_fxflag = 0, my_doflag = 0, my_gfflag = 0, my_lnflag = 0, my_isflag = 0, my_asflag = 0, my_swflag = 0, my_Yflag = 0, my_Mflag = *p_Mflag, my_Eflag = 0, my_nflag = *p_nflag, + my_Nflag = 0, my_diflag = *p_diflag; char *my_ets = NULL; @@ -2996,7 +3000,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c prep_includes, prep_defines, prep_undefines, &my_csmode, &my_quflag, &my_dsflag, cxxcompiler, optlevel, optflags, &my_dbflag, &my_drflag, &my_dtflag, &my_dxflag, &my_djflag, &my_fxflag, &my_doflag, - &my_gfflag, &my_lnflag, &my_isflag, &my_asflag, &my_swflag, &my_Yflag, &my_Mflag, &my_Eflag, &my_nflag, &my_diflag, + &my_gfflag, &my_lnflag, &my_isflag, &my_asflag, &my_swflag, &my_Yflag, &my_Mflag, &my_Eflag, &my_nflag, &my_Nflag, &my_diflag, solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep, linkerlibs, additionalObjects, linkerlibsearchp, Vflag, FALSE, &my_Zflag, &my_Hflag, NULL, NULL, prefix_workdir, run_command_list, seen_tpd_files, required_configs, profiled_file_list, diff --git a/compiler2/xpather.h b/compiler2/xpather.h index f23e1d9cf6b35ab2a18bcaae0d756a94024dc830..6a30d0b07c71781db228bc0bcc7f7f72516b4a50 100644 --- a/compiler2/xpather.h +++ b/compiler2/xpather.h @@ -286,7 +286,7 @@ tpd_result process_tpd(const char **p_tpd_name, const char *actcfg, char** cxxcompiler, char** optlevel, char** optflags, boolean *disableber, boolean *disableraw, boolean *disabletext, boolean *disablexer, boolean *disablejson, boolean *forcexerinasn, boolean *defaultasomit, boolean *gccmessageformat, boolean *linenumber, boolean *includesourceinfo, boolean *addsourcelineinfo, boolean *suppresswarnings, - boolean *outparamboundness, boolean *omit_in_value_list, boolean *warnings_for_bad_variants, boolean *activate_debugger, + boolean *outparamboundness, boolean *omit_in_value_list, boolean *warnings_for_bad_variants, boolean *activate_debugger, boolean* ignore_untagged_union, boolean *disable_predef_exp_folder, struct string_list* solspeclibs, struct string_list* sol8speclibs, struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3preprocessor, struct string_list* linkerlibs, struct string_list* additionalObjects, struct string_list* linkerlibsearchpath, boolean Vflag, boolean Dflag, diff --git a/etc/xsd/TPD.xsd b/etc/xsd/TPD.xsd index 11a335b22f9016db38582d077efe2f49581cfaa4..60531a964bc7765567eda6687b1d26ac1a2a2fd1 100644 --- a/etc/xsd/TPD.xsd +++ b/etc/xsd/TPD.xsd @@ -137,6 +137,7 @@ <xs:element name="CxxCompiler" minOccurs="0" maxOccurs="1" type="xs:normalizedString" /> <xs:element name="optimizationLevel" minOccurs="0" maxOccurs="1" type="xs:normalizedString" /> <xs:element name="otherOptimizationFlags" minOccurs="0" maxOccurs="1" type="xs:string" /> + <xs:element name="ignoreUntaggedOnTopLevelUnion" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="profiledFileList" minOccurs="0" maxOccurs="1" type="ResourceType" /> <xs:element name="SolarisSpecificLibraries" minOccurs="0" maxOccurs="1"> diff --git a/regression_test/compileonly/Makefile b/regression_test/compileonly/Makefile index faa264f9640f3889c0b23c9f9533a4576cf3c2fe..598f9621567e88fc1fca955c9466cd63f435818b 100644 --- a/regression_test/compileonly/Makefile +++ b/regression_test/compileonly/Makefile @@ -28,7 +28,7 @@ CODIRS := dynamicTemplate styleGuide topLevelPdu \ isbound namedActualParameters assignmentNotation \ attribQualif HT48786 selectCase openTypeNames \ defaultParamUsageBeforeDecl deterministic readFromFile \ - asn1_hyphen nameClash portTranslation + asn1_hyphen nameClash portTranslation UntaggedOnTopLevelUnionSwitch ifdef DYN CODIRS += mfgen-xsd diff --git a/regression_test/compileonly/UntaggedOnTopLevelUnionSwitch/Makefile b/regression_test/compileonly/UntaggedOnTopLevelUnionSwitch/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..74497522d9d4083a1df689bb420893be8ac1a816 --- /dev/null +++ b/regression_test/compileonly/UntaggedOnTopLevelUnionSwitch/Makefile @@ -0,0 +1,46 @@ +############################################################################## +# 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: +# Szabo, Bence Janos +# +############################################################################## +TOPDIR := ../../ +include $(TOPDIR)/Makefile.regression + +ifdef LCOV +COVERAGE_FLAG := -C +endif + +# ${MAKEPROG} has the same content as the built-in ${MAKE}, +# except the special handling of ${MAKE} does not apply. +# If we used ${MAKE} in the rules below, 'make -n' would succeed once, +# then fail on every subsequent invocation until a 'make clean' is done. + +MAKEPROG := ${MAKE} + +all: GenerateMakefile GenerateMakefileFromTPD + + +GenerateMakefile: + $(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) -N -o MakefileN + if [ `grep -c "\-N" ./MakefileN` -ne 1 ]; \ + then echo "Makefilegen generation with -N flag failed: Overall verdict: fail" && exit 1; fi + +GenerateMakefileFromTPD: + $(TTCN3_DIR)/bin/ttcn3_makefilegen -t UntaggedOnTopUnionSwitchTest.tpd -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) -o MakefileN + if [ `grep -c "\-N" ./binDefault/MakefileN` -ne 1 ]; \ + then echo "Makefilegen generation with -N flag failed: Overall verdict: fail" && exit 1; fi + +clean: + -rm -rf MakefileN binDefault + +distclean: clean + -rm -f *.out + +.PHONY: all clean distclean GenerateMakefile GenerateMakefileFromTPD + diff --git a/regression_test/compileonly/UntaggedOnTopLevelUnionSwitch/UntaggedOnTopUnionSwitchTest.tpd b/regression_test/compileonly/UntaggedOnTopLevelUnionSwitch/UntaggedOnTopUnionSwitchTest.tpd new file mode 100644 index 0000000000000000000000000000000000000000..6fd0cc61b852f0516e5babb7618b3030f185c8de --- /dev/null +++ b/regression_test/compileonly/UntaggedOnTopLevelUnionSwitch/UntaggedOnTopUnionSwitchTest.tpd @@ -0,0 +1,29 @@ +<!-- + 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: + Szabo, Bence Janos – initial implementation +--> +<TITAN_Project_File_Information version="1.0"> + <ProjectName>UntaggedOnTopUnionSwitchTest</ProjectName> + <ReferencedProjects> + </ReferencedProjects> + <ActiveConfiguration>Default</ActiveConfiguration> + <Configurations> + <Configuration name="Default"> + <ProjectProperties> + <MakefileSettings> + <targetExecutable>binDefault</targetExecutable> + <ignoreUntaggedOnTopLevelUnion>true</ignoreUntaggedOnTopLevelUnion> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + </ProjectProperties> + </Configuration> + </Configurations> +</TITAN_Project_File_Information> diff --git a/usrguide/referenceguide.doc b/usrguide/referenceguide.doc index c103a2285c6f0be226f1be38a92e768712de65f7..5505ea3d80d37311cc30796e1d8b73803dbc9383 100644 Binary files a/usrguide/referenceguide.doc and b/usrguide/referenceguide.doc differ