Changes between Version 20 and Version 21 of Documentation/T3Q/Quality-Checks/Code-Style


Ignore:
Timestamp:
11/13/25 21:59:35 (2 months ago)
Author:
phdmakk
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/T3Q/Quality-Checks/Code-Style

    v20 v21  
    423423}}} 
    424424 
    425 ==== There Must Be No Uninitialized Fields in Templates ==== 
    426  * '''Symbolic Name in XML Configuration''': checkNoUninitializedFieldsInTemplates 
    427  * '''Dependant Tags in XML Configuration''': checkNoUninitializedFieldsInTemplatesRecursion 
    428  
    429 This check makes sure there are no uninitialized fields in templates. This currently covers declared templates (on the module level only) for structured types declared in TTCN-3 (support for structured types declared in ASN.1 is currently being investigated). 
     425 
     426==== **There Must Be No Uninitialized Fields in Templates**==== 
     427 
     428* **Symbolic Name in XML Configuration**: checkNoUninitializedFieldsInTemplates 
     429* **Dependant Tags in XML Configuration**: checkNoUninitializedFieldsInTemplatesRecursion 
     430 
     431This check makes sure there are no uninitialized fields in templates. This currently covers declared templates (on the module level only) for structured types declared in TTCN-3 and ASN.1 (see ASN.1 Support for details). 
    430432 
    431433{{{ 
     
    493495}}} 
    494496 
    495 By default only the first level of modified templates is checked in case a template modifies another template, and the field specifications in the base template are considered. With the option '''checkNoUnititializedFieldsInTemplatesRecursion''' multiple levels of modified templates are considered. 
     497By default only the first level of modified templates is checked in case a template modifies another template or is assigned to another template, and the field specifications in the base template are considered. With the option **checkNoUnititializedFieldsInTemplatesRecursion** multiple levels of modified or assigned templates are considered. 
    496498 
    497499{{{ 
     
    514516    //-> no warning if checkNoUnititializedFieldsInTemplatesRecursion is true 
    515517    //-> warning if checkNoUnititializedFieldsInTemplatesRecursion is false (only f2 from B2 considered) 
     518 
     519  template tr t_tr_mod_base_full_assigned (charstring p_c) := t_tr_mod_base_full("a", {}) //no warning 
     520 
     521  template tr t_tr_mod_base_full (charstring p_c) modifies t_tr_base_full := { 
     522      common := (p_c) //no warning 
     523  }  
     524   
     525  template tr t_tr_base_full (integer p_ind) := {  
     526      common := "yes", //no warning 
     527      indication := p_ind, 
     528      version := 1 
     529  } 
     530   
     531  template tr t_tr_ref_ref_mod_c(charstring p_c) modifies t_tr_ref_ref := { 
     532      common := (p_c) //no warning 
     533  }   
     534 
     535  template tr t_tr_ref_mod_c(charstring p_c) modifies t_tr_ref := { 
     536      common := (p_c) //no warning 
     537  }   
     538 
     539  template tr t_tr_ref_ref_mod(charstring p_c) modifies t_tr_ref_ref := { 
     540      version := (p_c) //warning 
     541  }   
     542 
     543  template tr t_tr_ref_mod(charstring p_c) modifies t_tr_ref := { 
     544      version := (p_c) //warning 
     545  }   
     546  
     547  template tr t_tr_ref_ref (integer p_i) := t_tr_ref(p_i) //warning  
     548 
     549  template tr t_tr_ref(integer p_i) := t_tr_base(p_i) //warning 
     550  template tr t_tr_ref_no_par(integer p_i) := t_tr_base //warning 
     551    
     552  template tr t_tr_base(integer p_ind) := {  
     553//      common := "yes", //common not specified 
     554 
     555 
     556      indication := p_ind, 
     557      version := 1 
     558  } 
     559     
     560  type record tr { 
     561      charstring common, 
     562      integer indication, 
     563      integer version 
     564  } 
     565 
     566    template rx_sub rx_sub_par(template rx_sub p_rx) := p_rx //skipped 
     567     
     568    template rx_sub t_rx := { 
     569        version := 1,  
     570        extensions := "x1", 
     571        size := 3  
     572    } 
     573     
     574    type rx rx_sub 
     575    type record rx { 
     576        integer version, 
     577        charstring extensions, 
     578        integer size 
     579    } 
    516580}  
    517581}}} 
    518582 
     583==== **There Must Be No Zero or Multiple Fields in Union Templates**==== 
     584 
     585* **Symbolic Name in XML Configuration**: checkNoZeroOrMultipleFieldsInUnionTemplates 
     586* **Dependant Tags in XML Configuration**: checkNoUninitializedFieldsInTemplatesRecursion 
     587 
     588This check makes sure there are no zero or multiple initialized fields in union templates. This currently covers declared templates (on the module level only) for union types declared in TTCN-3 and in ASN.1 (see ASN.1 Support for details). 
     589 
     590{{{ 
     591module unions { 
     592  template tu tu_func_mod modifies tu_func := { 
     593      //skipped 
     594  } 
     595   
     596  template tu tu_func_ref := tu_func() 
     597     //skipped 
     598   
     599  template tu tu_func_ref_np := tu_func 
     600 
     601  template tu tu_func := f_tu() 
     602  //no warning (no way to determine) -> skipped 
     603 
     604  template tu tu_func := tu_base()   
     605  
     606  template tu tu_base_mod_empty modifies tu_base := { 
     607      //no warning    
     608  } 
     609 
     610  template tu tu_base_mod_c modifies tu_base := { 
     611      common := "b" //no warning, same  
     612  }  
     613 
     614  template tu tu_base_mod modifies tu_base := {  
     615      version := 0 //warning more than one / different 
     616  }  
     617 
     618  template tu tu_base := { 
     619      common := "a" 
     620  } 
     621   
     622  function f_tu() return tu { 
     623      return tu_base 
     624  } 
     625   
     626  type union tu { 
     627      charstring common, 
     628      integer indication, 
     629      integer version 
     630  } 
     631} 
     632}}} 
     633 
     634By default only the first level of modified templates is checked in case a template modifies another template or is assigned to another template, and the field specifications in the base template are considered. With the option **checkNoUnititializedFieldsInTemplatesRecursion** multiple levels of modified or assigned templates are considered. While the TTCN-3 semantics state that in the case of modified templates the newly assigned field replaces the field specified in the base template, the warning from this check can still be beneficial in highlighting cases where that may be unintentional.