Junio C Hamano [off-list ref] writes:
Linus Torvalds [off-list ref] writes:
quoted
On Tue, 19 Dec 2006, Junio C Hamano wrote:
quoted
Jeff Garzik [off-list ref] writes:
quoted
If you are going to do this, you have to audit -every- file, to make
sure git-compat-util.h is -always- the first header.
Will do.
Well, since any cases where it isn't (and where we'd care) will show up
as just a compiler warning, I doubt we really even need to. We can fix
things up as they get reported too..
True, but I've done it already, so...
Test compile especially on non Linux boxes are appreciated (I'll
do one on an OpenBSD bochs tomorrow myself anyway, though).
I've pushed the results out, along with the index-pack updates
from Linus/Nico.
I needed to fix the changes to git-compat-util.h a bit from the
version I sent earlier to make OpenBSD happy (sys/types.h there
did not expose u_int unless _BSD_SOURCE was set, and
netinet/in.h was duplicated by mistake).
On Wed, 20 Dec 2006, Junio C Hamano wrote:
I needed to fix the changes to git-compat-util.h a bit from the
version I sent earlier to make OpenBSD happy (sys/types.h there
did not expose u_int unless _BSD_SOURCE was set, and
netinet/in.h was duplicated by mistake).
Please don't use "u_int" in the first place. It's an abomination of a
type. It should never be used.
There's simply no point. It's "unsigned int", and that doesn't need any
header files at all.
I don't understand why people are lazy, and can't write "unsigned", but
then introduce a type that requires you to have all kinds of magic. The
lazyness just results in more work, and is totally nonportable.
So "u_int" (along with its idiotic brethren "u_long", "u_short" and
"u_char") is just silly.
The only user in git seems to have been copied from a source that is
insane. It does
u_int words[NS_IN6ADDRSZ / NS_INT16SZ];
which is just insane. It actually seems to want to use "uint16_t", which
at least would make sense, and be a type that has some _point_ to it.
So please change the "u_int" to either "unsigned int" or "uint16_t".
Either is better.
Linus Torvalds [off-list ref] writes:
On Wed, 20 Dec 2006, Junio C Hamano wrote:
quoted
I needed to fix the changes to git-compat-util.h a bit from the
version I sent earlier to make OpenBSD happy (sys/types.h there
did not expose u_int unless _BSD_SOURCE was set, and
netinet/in.h was duplicated by mistake).
Please don't use "u_int" in the first place. It's an abomination of a
type. It should never be used.
I did not want to touch imported sources in compat/, but
The only user in git seems to have been copied from a source that is
insane. It does
u_int words[NS_IN6ADDRSZ / NS_INT16SZ];
which is just insane. It actually seems to want to use "uint16_t", which
at least would make sense, and be a type that has some _point_ to it.
the above argument makes 100% sense. Will fix.
However, on sane platforms we do not even compile that file.
The problem I observed was that <include/netinet/tcp.h> on
OpenBSD uses u_int wants the source code that uses that header
file to first include <sys/types.h> to get u_int, which in turn
requires __BSD_VISIBLE to be in effect.
Unfortunately I think _BSD_SOURCE needs to stay for this reason.