diff options
| author | Jakob Kaivo <jkk@ung.org> | 2019-02-28 16:10:05 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2019-02-28 16:10:05 -0500 |
| commit | e6dfff4a2b3a230ff017b637e6f5446fff72dace (patch) | |
| tree | 9320ccdcc70885eaab2dfc8f337d5cf9a40b47f4 | |
| parent | 184ac5165e70d4fac213a87ae34a312ec7197f3d (diff) | |
add guards to prevent multiple definitions of the same types
| -rw-r--r-- | mk.sh | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -72,6 +72,9 @@ get_declaration () { ;; TYPE|TYPE_LONG|RECORD|FNTYPE) + base=$(basename $1 .c) + printf '#ifndef __TYPE_%s_DEFINED__\n#define __TYPE_%s_DEFINED__\n' "$base" "$base" + if grep -q '^#if' $1; then sed -ne '/^#if/,/#endif/p' $1 elif grep -qE '^(typedef|struct|union) .*{' $1; then @@ -81,6 +84,8 @@ get_declaration () { else grep -E '^(typedef|struct|union) ' $1 fi + + printf '#endif\n\n' ;; EXTERN) |
