[openib-general] compilation platform dependencies

Roland Dreier rolandd at cisco.com
Tue Nov 1 10:09:26 PST 2005


    Sean> Did you notice if any other data structures had this issue?

I use the perl script below to check this.  You feed it a header file,
and it prints out a C program that prints the size of every struct.
Then compile and run the program on both 32-bit and 64-bit
architectures and diff the output.

With the patch I just sent, ib_user_cm.h is clean.

 - R.

#!/usr/bin/env perl

use English;
use strict;

my @structs;

while (<>) {
  if (m/(struct [^\s]+) \{/) {
    push @structs, $1;
  }
  s/__be/__u/;
  print;
}

print <<'EOT';
#include <stdio.h>

int main(int argc, char *argv[])
{
	printf("Word size: %zd\n", sizeof (long));

EOT

for my $s (@structs) {
  print <<"EOT";
	printf("%-40s:\\t%zd\\n",
	       "$s",
	       sizeof ($s));
EOT
}

print <<"EOT";

	return 0;
}
EOT



More information about the general mailing list