Code Review
/
ric-plt
/
lib
/
rmr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Address code analysis issues
[ric-plt/lib/rmr.git]
/
src
/
rmr
/
common
/
include
/
vet_mtypes.ksh
diff --git
a/src/rmr/common/include/vet_mtypes.ksh
b/src/rmr/common/include/vet_mtypes.ksh
index
c4e1b82
..
8d36853
100755
(executable)
--- 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.
#
# 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.
#
# 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.
# 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]++;
ncount[$2]++;
+ lines[$2] = lines[$2] " " NR
+ lines[$NF] = lines[$NF] " " NR
next
next
- }
+ }
- END {
+ END {
vgood = 0
ngood = 0
bad = 0
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 )
exit( !! bad )
- }'
${1:-RIC_message_types.h}
+ }'