pokerth/pokerth — pull request #166 by evgeni (2012-12-28 11:17:05+00:00)
Title: Fix compilation on FreeBSD and Hurd

PokerTH fails to build on Debian GNU/kFreeBSD and GNU/Hurd with:

```
In file included from src/third_party/protobuf/pokerth.pb.cc:4:0:
src/third_party/protobuf/pokerth.pb.h:936:37: error: expected unqualified-id before 'int'
src/third_party/protobuf/pokerth.pb.h:936:37: error: expected ')' before 'int'
src/third_party/protobuf/pokerth.pb.h:936:37: error: expected ')' before 'int'
src/third_party/protobuf/pokerth.pb.h:943:37: error: expected unqualified-id before 'int'
src/third_party/protobuf/pokerth.pb.h:943:37: error: expected ')' before 'int'
src/third_party/protobuf/pokerth.pb.h:943:37: error: expected ')' before 'int'
src/third_party/protobuf/pokerth.pb.h:9618:60: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.h:9640:60: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc: In member function 'virtual void AnnounceMessage_Version::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const':
src/third_party/protobuf/pokerth.pb.cc:1581:72: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1581:72: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc:1586:72: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1586:72: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc: In member function 'virtual int AnnounceMessage_Version::ByteSize() const':
src/third_party/protobuf/pokerth.pb.cc:1599:17: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1599:17: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc:1606:17: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1606:17: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc: In member function 'void AnnounceMessage_Version::MergeFrom(const AnnounceMessage_Version&)':
src/third_party/protobuf/pokerth.pb.cc:1625:22: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1625:22: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc:1628:22: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1628:22: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc: At global scope:
src/third_party/protobuf/pokerth.pb.cc:14319:6: warning: unused parameter 'output' [-Wunused-parameter]
src/third_party/protobuf/pokerth.pb.cc:18344:6: warning: unused parameter 'output' [-Wunused-parameter]
make[2]: *** [obj/pokerth.pb.o] Error 1
```

Renaming the vars to majorVersion/minorVersion fixes this issue.

The problem on kFreeBSD is, that
`/usr/include/sys/kern/types.h`
has
```
#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
```
and this is included somewhere when you include stdlib.h, which protobuf's
headers do.

Hurd has similar definitions in `/usr/include/i386-gnu/sys/sysmacros.h`.