Re: [crossfire] [PATCH] Crossfire client linking fails in trunk

2014-08-13 Thread Kevin Zheng
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/12/2014 03:12, Tolga Dalman wrote:
 Actually, the current `configure` script already adds
 -std=gnu99 or some variant thereof behind your back. While
 getaddrinfo(3) is a POSIX extension, it is still relatively
 portable. On Windows, this issue is taken care of with a few
 preprocessor definitions.
 
 What configure script ?? I just did
 
 $ mkdir build; cd build; cmake ..; make

The `configure` script from Autotools, not CMake.

 Yes, replacing std=c99 by std=gnu99 defines the necessary POSIX
 extension macros and, thus, fixes all errors.

If the code compiles correctly using -std=gnu99, then use it. While
portability is definitely a desirable, it's probably better done along
with some other massive change (i.e. GIO networking).

Thanks,
Kevin Zheng
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQEcBAEBAgAGBQJT68VnAAoJEOrPD3bCLhCQLG4IAKmxxcI6c1X14iG3iGqkn0XB
7nTchsmUiDdM0wyhxxUOAjdw0GG6Hx474yR1nh1wZwQkmiVHYxQbGV7fpVrGnPXx
IouDiTBH2ZSlmfxVZVMrXhwUy3bmcaXTTZHG07jCMduQvsZZFg7pa7mm5gz9qg/3
zFegVmm/sPLLxUNR8ClqFLNEXZB1VXCmgtT8t2rCmoe7qCcnUc7Rq0Gqp0coEVt7
GoHWlsvTsawwcUTSoU5wJzv9gKwmflW0xD0wZ/hEBhxW3lpOfT2OK9fpfMdxyYly
ggYbKL2+6aqqsygg+FwvGYYGdKtCkIFEymXVyCsoZlxH4aKgOQ8Tnz/f1Ald5yo=
=jguB
-END PGP SIGNATURE-
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


Re: [crossfire] [PATCH] Crossfire client linking fails in trunk

2014-08-12 Thread Tolga Dalman
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/12/2014 04:42 AM, Kevin Zheng wrote:
 On 08/11/2014 14:16, Tolga Dalman wrote:
 Naturally, I would compile with -std=gnu99, but that's not a portable 
 solution :)
 
 Actually, the current `configure` script already adds -std=gnu99 or some
 variant thereof behind your back. While getaddrinfo(3) is a POSIX 
 extension, it is still relatively portable. On Windows, this issue is taken
 care of with a few preprocessor definitions.

What configure script ?? I just did

$ mkdir build; cd build; cmake ..; make

 It may not even be this problem at all. I need to go take a closer look at
 the code; it may be just that we're missing a header file.
 
 /home/tdalman/src/crossfire/client/trunk/common/client.c:497:5: warning: 
 implicit declaration of function 'freeaddrinfo'
 [-Wimplicit-function-declaration] freeaddrinfo(res); ^
 
 Ditto, although I'm fairly certain this is due to a missing header.

Yes, replacing std=c99 by std=gnu99 defines the necessary POSIX extension
macros and, thus, fixes all errors.

-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQEcBAEBAgAGBQJT6cxsAAoJEATLYSm2cxP9yzAH/2186LXDDXT65vVDw8Gt6Fol
QeVls90TagNp75bXx5YARTO2gaFi+s8QUBnm5LafIVQZqY7wTn5tq1sc70q7CA7l
BFzGKaKmtaB0iUVtrPM6GGPSf6jTK6g2xIhvcwHMgXj435bVeMlKk2VK3jMAzIQ5
l1xmpaEYlqFkuZdHaEj221o2+VM6XTN+9YV7MUwq3Xu0qbhBO+PNYWSzN3NCFIC9
zfhXcbTsPph60GIVLpI2un6SXiwMI/qAuXY7UJhBTlYbImLDtTxJUlB20qCuUpFl
gMcdnQJlVq3GQgmLluQT3nzt7STUiDKotwnKGaaohMwMwTePrYwuLjuBpYtK30I=
=L3xX
-END PGP SIGNATURE-
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


Re: [crossfire] [PATCH] Crossfire client linking fails in trunk

2014-08-11 Thread Tolga Dalman
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/11/2014 04:24 PM, Kevin Zheng wrote:
 On 08/11/2014 06:24, Tolga Dalman wrote:
 the attached patch fixes the client compilation on trunk. Thanks!
 
 Committed in r19602 with minor changes, thanks!

Great!


 Have you tried the CMake build system? I intend to support both Autotools
 and CMake for the next release, but start to phase out the former in the
 distant future.

CMake is definitely the way to go. Unfortunately, it doesn't yet work
as expected.

[  7%] Building C object common/CMakeFiles/cfclient.dir/client.c.o
/home/tdalman/src/crossfire/client/trunk/common/client.c: In function
'init_connection':
/home/tdalman/src/crossfire/client/trunk/common/client.c:344:21: error:
storage size of 'hints' isn't known
 struct addrinfo hints;
 ^

A quick analysis shows the reason explained here:

https://stackoverflow.com/questions/12024703/why-cant-getaddrinfo-be-found-when-compiling-with-gcc-and-std-c99

Naturally, I would compile with -std=gnu99, but that's not a portable
solution :)


/home/tdalman/src/crossfire/client/trunk/common/client.c:497:5: warning:
implicit declaration of function 'freeaddrinfo' 
[-Wimplicit-function-declaration]
 freeaddrinfo(res);
 ^

Don't know, what this is. Probably a follow-up error from above.
I also noticed that sys/types.h is not included first in this file - this
could lead to further errors.


/home/tdalman/src/crossfire/client/trunk/common/client.c: In function
'negotiate_connection':
/home/tdalman/src/crossfire/client/trunk/common/client.c:578:9: warning:
implicit declaration of function 'usleep' [-Wimplicit-function-declaration]
 usleep(10*1000);/* 10 milliseconds */
 ^

unistd.h is not included.


Best regards
Tolga Dalman



-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQEcBAEBAgAGBQJT6RaUAAoJEATLYSm2cxP9QYAH/RkhjqaAPkKPe6fsrHCLukwc
2NCzKgE5tSg31V2bKZ1MSTs9QUoA7nT5W76pl0xkwJEcPvGkxWTUbHsI8y6Q7qqx
BcdqAxpT/lwUaMOjzSLP7KxkFPXEYKCYxm6qDkopMBLT/dK0MvKwohu5EYMPkNcO
nlLaCTfRLN11O4lWT/T7iW/0h11cB2qpLl6u9FkPqZgNBbsiXKeOIFCUrJLiAI6G
yo27jrg/tj1YLbiUKsD3GwA49oUUFswDwteu1g/dRH7t58d/2pImtrSmtWpwN782
pZ5BY+WWcuRmtfR4b2/aPcXsUmFL4RQGnXXLB0NXVrkUXXfmLqwRHCOkdMv20Q4=
=1Q5L
-END PGP SIGNATURE-
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire