From: Fredrik Tolf Date: Thu, 24 Feb 2011 09:41:43 +0000 (+0100) Subject: Added alignment checking to sztest. X-Git-Url: http://dolda2000.com/gitweb/?p=utils.git;a=commitdiff_plain;h=2dcf548661ac398e823bd4062bd8233aca863500 Added alignment checking to sztest. --- diff --git a/sztest b/sztest index ca7182c..dcb2982 100755 --- a/sztest +++ b/sztest @@ -1,9 +1,10 @@ #!/bin/sh usage() { - echo "usage: sztest [-h] [-H SYS-HEADER] [-L LOCAL-HEADER] TYPE [CCFLAGS...]" + echo "usage: sztest [-hab] [-H SYS-HEADER] [-L LOCAL-HEADER] TYPE [CCFLAGS...]" } +mode=size sheaders= lheaders= while [ "${1:0:1}" = "-" ]; do @@ -14,6 +15,12 @@ while [ "${1:0:1}" = "-" ]; do usage exit 0 ;; + "-a") + mode=align + ;; + "-b") + mode=both + ;; "-H") sheaders="$sheaders $1" shift @@ -47,7 +54,19 @@ done cat >>"$file.c" <>"$file.c" + ;; + align) + echo " printf(\"%zi\\n\", __alignof__($type));" >>"$file.c" + ;; + both) + echo " printf(\"%zi %zi\\n\", sizeof($type), __alignof__($type));" >>"$file.c" + ;; +esac +cat >>"$file.c" <