ADT
        arm-eh
        ast-experimental
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        pthread-emulation
        qualifiedEnum
      
      
        
          | Last change
 on this file since 1e5dedc4 was             8d90b6b, checked in by Andrew Beach <ajbeach@…>, 6 years ago | 
        
          | 
Added a utility that counts lines post-pre-processing.
 | 
        
          | 
              
Property                 mode
 set to                 100755 | 
        
          | File size:
            1.3 KB | 
      
      
| Rev | Line |  | 
|---|
| [8d90b6b] | 1 | #!/bin/bash | 
|---|
|  | 2 |  | 
|---|
|  | 3 | # This is a quick script I used to check the length of a cfa file post- | 
|---|
|  | 4 | # preprocessing. It takes compilation flags and strips out ones that might | 
|---|
|  | 5 | # cause problems, adds the -E flag and passes all of them to gcc. | 
|---|
|  | 6 | # | 
|---|
|  | 7 | # To check the standard library go to a target's src directory and enter: | 
|---|
|  | 8 | # > make CFA=expanded-line-count.sh | 
|---|
|  | 9 | # | 
|---|
|  | 10 | # Output is placed in: | 
|---|
|  | 11 | OUTPUT_FILE=std-lib-wc.txt | 
|---|
|  | 12 |  | 
|---|
|  | 13 | has_quote() (echo "$1" | grep -q '"') | 
|---|
|  | 14 |  | 
|---|
|  | 15 | filter_args() ( | 
|---|
|  | 16 | for arg; do | 
|---|
|  | 17 | case "$arg" in | 
|---|
|  | 18 | (-I*|-D*|-W*|-f*) | 
|---|
|  | 19 | if has_quote "$arg"; then continue; fi | 
|---|
|  | 20 | echo "$arg" | 
|---|
|  | 21 | ;; | 
|---|
|  | 22 | (-*|*.Tpo|*.Po|*.lo|*.o) | 
|---|
|  | 23 | continue | 
|---|
|  | 24 | ;; | 
|---|
|  | 25 | (*) | 
|---|
|  | 26 | if has_quote "$arg"; then continue; fi | 
|---|
|  | 27 | echo "$arg" | 
|---|
|  | 28 | ;; | 
|---|
|  | 29 | esac | 
|---|
|  | 30 | done | 
|---|
|  | 31 | ) | 
|---|
|  | 32 | ARGS=($(filter_args "$@")) | 
|---|
|  | 33 |  | 
|---|
|  | 34 | find_name() ( | 
|---|
|  | 35 | next=false | 
|---|
|  | 36 | for arg; do | 
|---|
|  | 37 | if $next; then | 
|---|
|  | 38 | echo $arg | 
|---|
|  | 39 | break | 
|---|
|  | 40 | elif [ "-o" == "$arg" ]; then | 
|---|
|  | 41 | next=true | 
|---|
|  | 42 | fi | 
|---|
|  | 43 | done | 
|---|
|  | 44 | ) | 
|---|
|  | 45 | FILE_NAME="$(find_name "$@")" | 
|---|
|  | 46 |  | 
|---|
|  | 47 | deps_file() (sed -e "s|.libs/|.deps/|" -e "s|.o$|.Tpo|" <<< $1) | 
|---|
|  | 48 |  | 
|---|
|  | 49 | LINES=$(~/cfa-cc/driver/cfa -E "${ARGS[@]}" | wc -l) | 
|---|
|  | 50 | touch $(deps_file $FILE_NAME) | 
|---|
|  | 51 |  | 
|---|
|  | 52 | echo "Record of pre-processed file lengths:" >$OUTPUT_FILE | 
|---|
|  | 53 | echo $FILE_NAME=$LINES | tee -a $OUTPUT_FILE | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.