blob: 746d366dbec17c6c2ce6d00123fe8c632100d634 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#!/bin/bash
2#
3# @author Howard Chen
4# @brief if the input file violate rules, return 1, else 0
5#
6
7if [ $# != 1 ] || [ ! -f $F ] || [ ! ${F##*.} = "c" ]
8then
9 echo "usage: wimac_rul.sh <c_source>"
10 exit 1
11fi
12
13
14F=$1
15CMD_P=$(cat -n $F | grep @nostrict-g)
16if [ "$CMD_P" != "" ]
17then
18 echo "[PASS]: $F"
19 exit 0
20fi
21
22LINES=$(cat -n $F | sed -e /@nostrict/d | sed -e /\#include/d | gcc -E - | grep extern | sed -e /@nostrict/d )
23
24if [ "$LINES" != "" ]
25then
26 echo ""
27 echo ""
28 echo "[FAIL]: $F"
29 echo "$LINES"
30 echo "--------------------------------------------------------------------------------"
31 exit 1
32else
33 echo "[PASS]: $F"
34 exit 0
35fi
36