Closed GoogleCodeExporter closed 9 years ago
Just read these on my phone, they look good! Thanks for posting these. I hope
to get to these some time over the weekend.
Can you confirm which platform these are from, e.g. compiler version (for the
commit description)? Is strdup not in string.h for that platform? I'm guessing
the PTR_SIZ came about from a 64 bit platform (good catch)?
Original comment by clac...@gmail.com
on 28 Jun 2013 at 2:28
Whoo! this is the first patch I've ever submitted to anything, I'm glad it was
good.
I'm running 64-bit arch linux with gcc 4.8.
Strdup() is in string.h, but when passing '-ansi -pedantic' to gcc, it will
warn 'assignment makes pointer from integer without a cast', this is because
strdup is not in ISO C89 and its declaration is skipped for this reason, when
gcc see's this "undeclared" function it assumes that the return type is int.
PTR_SIZ is a more portable way to cast a pointer to integer, on x86, arm, and
x86_64 linux/mac/bsd sizeof(long)==sizeof(void*) oddly enough, it's 64-bit
windows where long is still 32bits that requires the 'long long' fallback.
Original comment by x0thatgu...@gmail.com
on 28 Jun 2013 at 4:26
I'm still hoping to get to this over the weekend.
RE the strdup() warnings, those are legitimate warnings if the pedantic flag is
issued so I'm tempted to not silence those. I'll remove the strdup() prototype
we had already as that should go.
I re-scanned PTR_SIZE, the macro looks fine but I'm probably going to change
that to a (mmap.h) MAP_FAILED check instead, thanks for pointing this out :-)
Original comment by clac...@gmail.com
on 29 Jun 2013 at 6:45
Another option for the strdup warning would be to put "-D_XOPEN_SOURCE=500" in
the cflags, then gcc won't complain unless there is actually a problem while
keeping the source free of strdup declarations.
Original comment by x0thatgu...@gmail.com
on 29 Jun 2013 at 7:20
submitted as r196
Original comment by clac...@gmail.com
on 30 Jun 2013 at 3:51
Original issue reported on code.google.com by
x0thatgu...@gmail.com
on 28 Jun 2013 at 7:40Attachments: