diff options
Diffstat (limited to 'winsup/cygwin/gentls_offsets')
-rwxr-xr-x | winsup/cygwin/gentls_offsets | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/winsup/cygwin/gentls_offsets b/winsup/cygwin/gentls_offsets index 21c9d1e7a..0ab6b64ab 100755 --- a/winsup/cygwin/gentls_offsets +++ b/winsup/cygwin/gentls_offsets @@ -21,12 +21,11 @@ $pre =~ s/\n#ifndef _[^\n]+\n/\n/os; $pre .= "\n//*/"; $tls =~ s%/\*\s*gentls_offsets.*?/\*\s*gentls_offsets\s*\*/%%ogs; foreach ($tls =~ /^.*\n/mg) { - $def .= $_ if $struct; - last if /^};/o; - /^\s*typedef/o and do { + /^}|\s*(?:typedef|const)/o and do { $def .= $_ ; next; }; + $def .= $_ if $struct; if (!s/;.*$//o) { if (!$struct && /^\s*(?:struct|class)\s*([a-z_0-9]+)/o) { $def .= $_; @@ -55,9 +54,9 @@ $def int main(int argc, char **argv) { - $struct foo[1]; -# define foo_end ((char *) (foo + 1)) -# define offset(f) (((char *) &(foo->f)) - foo_end) + $struct *foo; +# define foo_beg ((char *) foo) +# define offset(f) (-CYGTLS_PADSIZE + ((char *) &(foo->f)) - foo_beg) # define poffset(f) (((char *) &(foo->f)) - ((char *) foo)) EOF print TMP 'puts ("//;# autogenerated: Do not edit.\n");', "\n\n"; |