Only a partial answer: If you are interested in the information only (without the ability to feed the structure back), you can use clang with the following option:
clang -c my prog.c -Xclang -fdump-record-layouts
E.g., the following code
#include <stdio.h>
struct foo{
char c;
int i;
};
int main()
{
struct foo bar = {'a',42};
printf("%d\n%d\n",(int)bar.c,bar.i);
return 0;
}
produces
> clang -c foo.c -Xclang -fdump-record-layouts
*** Dumping AST Record Layout
0 | struct foo
0 | char c
4 | int i
| [sizeof=8, align=4]
*** Dumping IRgen Record Layout Record: RecordDecl 0x7f80fe0a47e0 <foo.c:2:1, line:5:1> line:2:8 struct foo definition |-FieldDecl
0x7f80fe0a48a0 <line:3:2, col:7> col:7 referenced c 'char' `-FieldDecl
0x7f80fe0a4900 <line:4:2, col:7> col:7 referenced i 'int'
Layout: <CGRecordLayout
LLVMType:%struct.foo = type { i8, i32 }
IsZeroInitializable:1
BitFields:[
]>