Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Error in function generation
Error in function generation [message #1768677] Fri, 21 July 2017 10:26 Go to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello everyone,

I'm working on ITS and in an instance when I try to compile the code TTCN-3, it gives me a syntax error in the generated code. In fact, I have this function:

    external function fx_dec_DENM (inout bitstring b, out DENM p) return integer
        with {extension "prototype(sliding) decode(BER:BER_ENCODE_CER)"}


that generates the following code (i indented the code in order to be easier to read):

INTEGER fx__dec__DENM(BITSTRING& b, DENM__PDU__Descriptions::DENM& p)
{
	if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
		TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
		TTCN_Logger::log_event_str("fx_dec_DENM(): Stream before decoding: ");
		b.log();
		TTCN_Logger::end_event();
	}
	TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING);
	TTCN_EncDec::clear_error();
	TTCN_Buffer ttcn_buffer(bit2oct(b));
	p.decode(DENM__PDU__Descriptions::DENM_descr_, ttcn_buffer, TTCN_EncDec::CT_BER, BER_ENCODE_CER);
	if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
		TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
		TTCN_Logger::log_event_str("fx_dec_DENM(): Decoded @DENM-PDU-Descriptions.DENM: ");
		p.log();
		TTCN_Logger::end_event();
	}
	switch (TTCN_EncDec::get_last_error_type()) {
		case TTCN_EncDec::ET_NONE:
			ttcn_buffer.cut();
			OCTETSTRING tmp_os;
			ttcn_buffer.get_string(tmp_os);
			b = oct2bit(tmp_os);
			if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
				TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
				TTCN_Logger::log_event_str("fx_dec_DENM(): Stream after decoding: ");
				b.log();
				TTCN_Logger::end_event();
			}
			return 0;
		case TTCN_EncDec::ET_INCOMPL_MSG:
		case TTCN_EncDec::ET_LEN_ERR:
			return 2;
		default:
			return 1;
	}
}


The compiler (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)) gives me the following error:

g++  -c -DLINUX -I/home/egm/titan/include -Wall   -o LibItsDenm_EncdecDeclarations.o LibItsDenm_EncdecDeclarations.cc
LibItsDenm_EncdecDeclarations.cc: In function 'INTEGER LibItsDenm__EncdecDeclarations::fx__dec__DENM(BITSTRING&, DENM__PDU__Descriptions::DENM&)':
LibItsDenm_EncdecDeclarations.cc:89:19: error: jump to case label [-fpermissive]
 case TTCN_EncDec::ET_INCOMPL_MSG:
                   ^
LibItsDenm_EncdecDeclarations.cc:79:13: note:   crosses initialization of 'OCTETSTRING tmp_os'
 OCTETSTRING tmp_os;
             ^
LibItsDenm_EncdecDeclarations.cc:90:19: error: jump to case label [-fpermissive]
 case TTCN_EncDec::ET_LEN_ERR:
                   ^
LibItsDenm_EncdecDeclarations.cc:79:13: note:   crosses initialization of 'OCTETSTRING tmp_os'
 OCTETSTRING tmp_os;
             ^
LibItsDenm_EncdecDeclarations.cc:92:1: error: jump to case label [-fpermissive]
 default:
 ^
LibItsDenm_EncdecDeclarations.cc:79:13: note:   crosses initialization of 'OCTETSTRING tmp_os'
 OCTETSTRING tmp_os;
             ^
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_UNDEF' not handled in switch [-Wswitch]
 switch (TTCN_EncDec::get_last_error_type()) {
        ^
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_UNBOUND' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_INCOMPL_ANY' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_ENC_ENUM' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_INCOMPL_MSG' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_LEN_FORM' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_INVAL_MSG' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_REPR' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_CONSTRAINT' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_TAG' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_SUPERFL' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_EXTENSION' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_DEC_ENUM' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_DEC_DUPFLD' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_DEC_MISSFLD' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_DEC_OPENTYPE' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_DEC_UCSTR' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_LEN_ERR' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_SIGN_ERR' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_INCOMP_ORDER' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_TOKEN_ERR' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_LOG_MATCHING' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_FLOAT_TR' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_FLOAT_NAN' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_OMITTED_TAG' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_NEGTEST_CONFL' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_ALL' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:76:8: warning: enumeration value 'ET_INTERNAL' not handled in switch [-Wswitch]
LibItsDenm_EncdecDeclarations.cc:95:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Makefile:141: recipe for target 'LibItsDenm_EncdecDeclarations.o' failed
make: *** [LibItsDenm_EncdecDeclarations.o] Error 1



So to compile, I have to add brackets inside case "TTCN_EncDec::ET_NONE". Is this normal behaviour of Titan?

Thanks in advance,

Best regards,
Naum
Re: Error in function generation [message #1768679 is a reply to message #1768677] Fri, 21 July 2017 11:38 Go to previous messageGo to next message
Botond Baranyi is currently offline Botond BaranyiFriend
Messages: 9
Registered: February 2016
Junior Member
Hi,

This is a bug in TITAN.
I've created a bug report for it: https://bugs.eclipse.org/bugs/show_bug.cgi?id=520008

Best regards,
Botond
Re: Error in function generation [message #1768691 is a reply to message #1768679] Fri, 21 July 2017 15:48 Go to previous message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Thank you for the fast reaction, the problem is corrected!

Have a nice weekend,

Naum.

Previous Topic:problem in RAW decoder with TAG of different length
Next Topic:RAW coder: Handle a variable-lengh length field?
Goto Forum:
  


Current Time: Mon Jun 25 00:43:37 GMT 2018

Powered by FUDForum. Page generated in 0.02029 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top