Commit 277fb247 authored by Jacek Klimkowicz's avatar Jacek Klimkowicz
Browse files

Added disabling user information to TPD



Compiler can be instructed to not generate the user and time
information in the header of the generated .cc and .hh files
by providing '-D' flag. However, ttcn3_makefilegen cannot
generate Makefile with this flag added to COMPILER_FLAGS.

To avoid Makefile postprocessing phase, a TPD schema of
'MakefileSettings' element has been extended with optional boolean
element 'disableUserInformation'. If set to true, '-D' flag
will be added to COMPILER_FLAGS in Makefile.
Signed-off-by: default avatarJacek Klimkowicz <jakl@semihalf.com>
parent 9f94ba7f
......@@ -271,6 +271,7 @@ struct makefile_struct {
boolean ignore_untagged_on_top_union;
boolean disable_predef_ext_folder;
boolean enable_legacy_encoding;
boolean disable_userinfo;
struct string_list* solspeclibraries; /* not owned */
struct string_list* sol8speclibraries; /* not owned */
struct string_list* linuxspeclibraries; /* not owned */
......@@ -341,6 +342,7 @@ static void init_makefile_struct(struct makefile_struct *makefile)
makefile->ignore_untagged_on_top_union = FALSE;
makefile->disable_predef_ext_folder = FALSE;
makefile->enable_legacy_encoding = FALSE;
makefile->disable_userinfo = FALSE;
makefile->solspeclibraries = NULL;
makefile->sol8speclibraries = NULL;
makefile->linuxspeclibraries = NULL;
......@@ -2231,7 +2233,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%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%s%s%s\n\n"
"# Execution mode: (either ttcn3 or ttcn3-parallel)\n"
"TTCN3_LIB = ttcn3%s%s%s\n\n"
#ifdef LICENSE
......@@ -2275,6 +2277,7 @@ static void print_makefile(struct makefile_struct *makefile)
(makefile->enable_legacy_encoding ? " -e" : ""),
(makefile->tcov_file_name ? makefile->tcov_file_name : ""),
(makefile->profiled_file_list ? " -z $(PROFILED_FILE_LIST)" : ""),
(makefile->disable_userinfo ? " -D" : ""),
/* end of COMPILER FLAGS */
(makefile->use_runtime_2 ? "-rt2" : ""), /* TTCN3_LIB */
(makefile->single_mode ? "" : "-parallel"),
......@@ -4654,7 +4657,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[],
boolean disablexer, boolean disablejson, boolean disableoer, 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 ignore_untagged_on_top_union, boolean disable_predef_ext_folder, boolean enable_legacy_encoding,
boolean ignore_untagged_on_top_union, boolean disable_predef_ext_folder, boolean enable_legacy_encoding, boolean disable_userinfo,
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,
......@@ -4711,6 +4714,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[],
makefile.ignore_untagged_on_top_union = ignore_untagged_on_top_union;
makefile.disable_predef_ext_folder = disable_predef_ext_folder;
makefile.enable_legacy_encoding = enable_legacy_encoding;
makefile.disable_userinfo = disable_userinfo;
makefile.solspeclibraries = solspeclibraries;
makefile.sol8speclibraries = sol8speclibraries;
makefile.linuxspeclibraries = linuxspeclibraries;
......@@ -4931,7 +4935,7 @@ int main(int argc, char *argv[])
Sflag = FALSE, Vflag = FALSE, Dflag = FALSE, Wflag = FALSE,
djflag = FALSE, doerflag = FALSE, Zflag = FALSE, Hflag = FALSE, Mflag = FALSE,
diflag = FALSE, zflag = FALSE, Eflag = FALSE, nflag = FALSE,
Nflag = FALSE, Gflag = FALSE;
Nflag = FALSE, Gflag = FALSE, duflag = FALSE;
boolean error_flag = FALSE;
char *output_file = NULL;
char *ets_name = NULL;
......@@ -5371,7 +5375,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, &doerflag, &fxflag, &doflag, &gfflag, &lnflag, &isflag,
&asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &Nflag, &diflag, &Gflag,
&asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &Nflag, &diflag, &Gflag, &duflag,
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);
......@@ -5420,7 +5424,7 @@ int main(int argc, char *argv[])
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, doerflag, fxflag, doflag, gfflag, lnflag, isflag, asflag, wflag, Yflag, Mflag, Eflag, nflag, Nflag, diflag,
Gflag, solspeclibraries, sol8speclibraries, linuxspeclibraries,
Gflag, duflag, solspeclibraries, sol8speclibraries, linuxspeclibraries,
freebsdspeclibraries, win32speclibraries, ttcn3prep, linkerlibraries, additionalObjects,
linkerlibsearchpath, generatorCommandOutput, target_placement_list);
if (makefileScript != NULL) {
......
......@@ -1269,7 +1269,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char* tpdName, c
char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag,
boolean* p_djflag, boolean* p_doerflag, 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_Nflag,
boolean* p_diflag, boolean* p_enable_legacy_encoding, struct string_list* solspeclibs, struct string_list* sol8speclibs,
boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, 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,
boolean *p_Zflag, boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir,
......@@ -1289,7 +1289,7 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg,
char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag,
boolean* p_djflag, boolean* p_doerflag, 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_Nflag,
boolean* p_diflag, boolean* p_enable_legacy_encoding, struct string_list* solspeclibs, struct string_list* sol8speclibs,
boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, 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,
boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir,
......@@ -1319,7 +1319,7 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg,
optlevel, optflags, p_dbflag, p_drflag, p_dtflag, p_dxflag, p_djflag,
p_doerflag, p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag,
p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_Nflag,
p_diflag, p_enable_legacy_encoding, solspeclibs, sol8speclibs,
p_diflag, p_enable_legacy_encoding, p_disable_userinfo, solspeclibs, sol8speclibs,
linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep,
linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag,
p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir,
......@@ -1348,7 +1348,7 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg,
optlevel, optflags, p_dbflag, p_drflag, p_dtflag, p_dxflag, p_djflag,
p_doerflag, p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag,
p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_Nflag,
p_diflag, p_enable_legacy_encoding, solspeclibs, sol8speclibs,
p_diflag, p_enable_legacy_encoding, p_disable_userinfo, solspeclibs, sol8speclibs,
linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep,
linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag,
p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir,
......@@ -1452,7 +1452,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c
char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag,
boolean* p_djflag, boolean* p_doerflag, 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_Nflag,
boolean* p_diflag, boolean* p_enable_legacy_encoding, struct string_list* solspeclibs, struct string_list* sol8speclibs,
boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, 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,
boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir,
......@@ -2059,6 +2059,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c
xsdbool2boolean(xpathCtx, actcfg, "disablePredefinedExternalFolder", p_diflag);
xsdbool2boolean(xpathCtx, actcfg, "ignoreUntaggedOnTopLevelUnion", p_Nflag);
xsdbool2boolean(xpathCtx, actcfg, "enableLegacyEncoding", p_enable_legacy_encoding);
xsdbool2boolean(xpathCtx, actcfg, "disableUserInformation", p_disable_userinfo);
projDesc = projGenHelper.getTargetOfProject(*p_project_name);
if (projDesc) projDesc->setLinkingStrategy(*p_lflag);
......@@ -2950,7 +2951,8 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c
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;
my_diflag = *p_diflag,
my_duflag = 0;
boolean my_enable_legacy_encoding = 0;
char *my_ets = NULL;
......@@ -3004,7 +3006,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c
&my_quflag, &my_dsflag, cxxcompiler, optlevel, optflags, &my_dbflag, &my_drflag,
&my_dtflag, &my_dxflag, &my_djflag, &my_doerflag, &my_fxflag, &my_doflag,
&my_gfflag, &my_lnflag, &my_isflag, &my_asflag, &my_swflag, &my_Yflag, &my_Mflag, &my_Eflag, &my_nflag, &my_Nflag, &my_diflag,
&my_enable_legacy_encoding, solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs,
&my_enable_legacy_encoding, &my_duflag, 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,
search_paths, n_search_paths, makefileScript, all_configs);
......
......@@ -287,7 +287,7 @@ tpd_result process_tpd(const char **p_tpd_name, const char *actcfg,
boolean *disablejson, boolean *disableoer, 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* ignore_untagged_union,
boolean *disable_predef_exp_folder, boolean* enable_legacy_encoding, struct string_list* solspeclibs, struct string_list* sol8speclibs,
boolean *disable_predef_exp_folder, boolean* enable_legacy_encoding, boolean* disable_userinfo, 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,
boolean *Zflag, boolean *Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir, struct string2_list* run_command_list,
......
......@@ -135,6 +135,7 @@
<xs:element name="activateDebugger" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="quietly" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="enableLegacyEncoding" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="disableUserInformation" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="namingRules" minOccurs="0" maxOccurs="1" type="xs:normalizedString" />
<xs:element name="disableSubtypeChecking" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="CxxCompiler" minOccurs="0" maxOccurs="1" type="xs:normalizedString" />
......
......@@ -32,7 +32,8 @@ MAKEPROG := ${MAKE}
DIRLIST := buildconfig_param invalid_buildconfig_param invalid_buildconfig_tpd \
HP79745 HQ56829 HQ56834 HQ56848 library HR30356 flagTest HR30365 dependency_check \
required_config required_config_v2 disablePredefinedExternalFolder \
makefileScript diff_tpd_name_error enable_legacy_encoding disable_oer
makefileScript diff_tpd_name_error enable_legacy_encoding disable_oer \
disableUserInformation
ifdef DYN
DIRS += required_config_v3 splitting compile_once
......
##############################################################################
# Copyright (c) 2018 Semihalf sp. z o.o.
# 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:
# Klimkowicz, Jacek
#
##############################################################################
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: CheckTpd CheckTpdTrue CheckTpdFalse
BuildTpd:
$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
-t a.tpd
CheckTpd: BuildTpd
if [ ! -f "./bin/Makefile" ] \
|| [ `grep -c "COMPILER_FLAGS =.*-D" ./bin/Makefile` -ne 0 ]; \
then echo "Makefilegen disableUserInformation test: Overall verdict: fail" && exit 1; fi
BuildTpdTrue:
$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
-t a.tpd -b True
CheckTpdTrue: BuildTpdTrue
if [ ! -f "./bin2/Makefile" ] \
|| [ `grep -c "COMPILER_FLAGS =.*-D" ./bin2/Makefile` -ne 1 ]; \
then echo "Makefilegen disableUserInformation test: Overall verdict: fail" && exit 1; fi
BuildTpdFalse:
$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
-t a.tpd -b False
CheckTpdFalse: BuildTpdFalse
if [ ! -f "./bin3/Makefile" ] \
|| [ `grep -c "COMPILER_FLAGS =.*-D" ./bin3/Makefile` -ne 0 ]; \
then echo "Makefilegen disableUserInformation test: Overall verdict: fail" && exit 1; fi
clean:
-rm -rf bin bin2 bin3
distclean: clean
-rm -f *.out
.PHONY: all clean distclean CheckTpd CheckTpdTrue CheckTpdFalse BuildTpd BuildTpdTrue BuildTpdFalse
<!--
Copyright (c) 2018 Semihalf sp. z o.o.
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:
Klimkowicz, Jacek
-->
<TITAN_Project_File_Information version="1.0">
<ProjectName>a</ProjectName>
<ActiveConfiguration>Default</ActiveConfiguration>
<Configurations>
<Configuration name="Default">
<ProjectProperties>
<MakefileSettings>
<GNUMake>true</GNUMake>
<targetExecutable>bin</targetExecutable>
</MakefileSettings>
<LocalBuildSettings>
<workingDirectory>bin</workingDirectory>
</LocalBuildSettings>
</ProjectProperties>
</Configuration>
<Configuration name="True">
<ProjectProperties>
<MakefileSettings>
<GNUMake>true</GNUMake>
<targetExecutable>bin2</targetExecutable>
<disableUserInformation>true</disableUserInformation>
</MakefileSettings>
<LocalBuildSettings>
<workingDirectory>bin2</workingDirectory>
</LocalBuildSettings>
</ProjectProperties>
</Configuration>
<Configuration name="False">
<ProjectProperties>
<MakefileSettings>
<GNUMake>true</GNUMake>
<targetExecutable>bin3</targetExecutable>
<disableUserInformation>false</disableUserInformation>
</MakefileSettings>
<LocalBuildSettings>
<workingDirectory>bin3</workingDirectory>
</LocalBuildSettings>
</ProjectProperties>
</Configuration>
</Configurations>
</TITAN_Project_File_Information>
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