[ovs-dev] [PATCH] lib: Fix compiler warnings on x86_64
Ben Pfaff
blp at nicira.com
Mon Dec 27 20:12:56 UTC 2010
On Mon, Dec 27, 2010 at 02:50:29PM -0500, Ethan Jackson wrote:
> On Mon, Dec 27, 2010 at 12:40 PM, Ben Pfaff <blp at nicira.com> wrote:
> > I don't understand what difference the change to lib/multipath.c would
> > make. What warning does it suppress, for example?
>
> I was getting a warning:
> error: cast from function call of type 'uint16_t' to non-matching
> type 'enum nx_mp_fields'
OK, weird. That's fine then, thanks. (Please add the warning to the
commit message though.)
> > I don't see why it
> > would be x86-64 specific, are you sure that this isn't a GCC version
> > issue? (What GCC version are you using again?)
>
> I'm using gcc 4.5.0
I guess I need to upgrade eventually (although I keep seeing
linux-kernel messages saying that GCC 4.5.0 miscompiles the kernel).
> > Why did you change minLen and maxLen to unsigned long long int? I don't
> > understand what this would fix. OVSDB is not going to survive someone
> > creating a string longer than 4 GB--its performance would be
> > unacceptably bad.
>
> Yes this deserves some more explanation I think. On my system I was
> getting a lot of warnings because the database initializers were
> incorrectly setting the string maxLen to 2^64 - 1 instead of 2^32 - 1.
> This is because python/ovs/db/types.py incorrectly assumes sys.maxint
> is the maximum possible value for the length of a string. Of course,
> this is true on a 32 bit system but on a 64bit system this is untrue
> and was causing warnings (which probably lead to bugs that I haven't
> run into yet). There are two possible solutions to this problem.
> Change the string maximum length to unsigned long long so that
> sys.maxint is correct. Or change the python code to realize that the
> maximum length of a string is 2^32 - 1. I figured limiting the length
> of a string to 32 bits was arbitrary so I increased it. We can do it
> the other way if you prefer.
Funny that sys.maxint isn't the maximum value of an int. That's a bit
deceptive--if it's the maximum value of a long it should be sys.maxlong.
I'd rather do it the other way. Thank you.
More information about the dev
mailing list