3 #==================================================================================
4 # Copyright (c) 2019 Nokia
5 # Copyright (c) 2018-2019 AT&T Intellectual Property.
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #==================================================================================
21 # This provides a quick sanity check on the message types in
22 # the header file. The check is only to ensure that there are
23 # no duplicate constant names or values for any #define in the file.
25 # By default RIC_message_types.h is parsed, but it will accept the
26 # filename as the first positional parameter on the command line should
29 # The script exits with a 0 return code if all is good, 1 to indicate errors.
31 # CAUTION: this breaks if any define is more than a simple key/value
32 # pair in the header file.
34 sed 's!//.*!!' ${1:-RIC_message_types.h} | awk '
38 lines[$2] = lines[$2] " " NR
39 lines[$NF] = lines[$NF] " " NR
49 if( vcount[x] != 1 ) {
50 printf( "duplicate value? %s on lines: %s\n", x, lines[x] );
58 if( ncount[x] != 1 ) {
59 printf( "duplicate name? %s on lines: %s\n", x, lines[x] );
66 printf( "good values=%d good names=%d bad things=%d\n", vgood, ngood, bad )