X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fcommon%2Finclude%2Fvet_mtypes.ksh;h=8d36853558bc37bbbdcc1fc0c05114ff013a501b;hb=fcea3951d44de0cc55d33c5e114487abe79d3406;hp=c4e1b82dee01b09d572823b586764e8f70b50028;hpb=076ac47a850308908ca46f4978f4f3476647e310;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/common/include/vet_mtypes.ksh b/src/rmr/common/include/vet_mtypes.ksh index c4e1b82..8d36853 100755 --- a/src/rmr/common/include/vet_mtypes.ksh +++ b/src/rmr/common/include/vet_mtypes.ksh @@ -22,7 +22,7 @@ # the header file. The check is only to ensure that there are # no duplicate constant names or values for any #define in the file. # -# By default RIC_message_types.h is parsed, but it will accept the +# By default RIC_message_types.h is parsed, but it will accept the # filename as the first positional parameter on the command line should # it be necessary. # @@ -31,37 +31,39 @@ # CAUTION: this breaks if any define is more than a simple key/value # pair in the header file. -awk ' - /#define/ { - vcount[$NF]++; +sed 's!//.*!!' ${1:-RIC_message_types.h} | awk ' + /#define/ { + vcount[$NF]++; ncount[$2]++; + lines[$2] = lines[$2] " " NR + lines[$NF] = lines[$NF] " " NR next - } + } - END { + END { vgood = 0 ngood = 0 bad = 0 - for( x in vcount ) { - if( vcount[x] != 1 ) { - printf( "duplicate value? %s\n", x ); - bad++ - } else { - vgood++ - } - } + for( x in vcount ) { + if( vcount[x] != 1 ) { + printf( "duplicate value? %s on lines: %s\n", x, lines[x] ); + bad++ + } else { + vgood++ + } + } - for( x in ncount ) { - if( ncount[x] != 1 ) { - printf( "duplicate name? %s\n", x ); - bad++ - } else { - ngood++ - } - } + for( x in ncount ) { + if( ncount[x] != 1 ) { + printf( "duplicate name? %s on lines: %s\n", x, lines[x] ); + bad++ + } else { + ngood++ + } + } - printf( "good values=%d good names=%d bad things=%d\n", vgood, ngood, bad ) + printf( "good values=%d good names=%d bad things=%d\n", vgood, ngood, bad ) exit( !! bad ) - }' ${1:-RIC_message_types.h} + }'