Coder Social home page Coder Social logo

Build warnings on Debian about 3zb2 HOT 3 CLOSED

yquake2 avatar yquake2 commented on August 28, 2024
Build warnings on Debian

from 3zb2.

Comments (3)

Yamagi avatar Yamagi commented on August 28, 2024

The games can be divided into three groups:

  • A full cleanup was applied baseq2, xatrix and rogue. They should be as good as it gets.
  • ctf has gotten a lesser amount of cleanup, but enough to be fine.
  • Everything else is handled on a best effort base. It might be good enough but it's far from being fine.

3zb2 falls into the later group. I hacked this "port" in two hours. I did just enough changes that it builds with a modern toolchain and works good enough for multiplayer testing.

In file included from /home/arjen/dev/Q2RTX/workingdir/_yquake2/3zb2/src/g_ctf.c:1:
/home/arjen/dev/Q2RTX/workingdir/_yquake2/3zb2/src/g_ctf.c: In function ‘SelectCTFSpawnPoint’:
/home/arjen/dev/Q2RTX/workingdir/_yquake2/3zb2/src/header/local.h:537:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  537 | #define FOFS(x) (int)&(((edict_t *)0)->x)
      |                 ^
/home/arjen/dev/Q2RTX/workingdir/_yquake2/3zb2/src/g_ctf.c:410:31: note: in expansion of macro ‘FOFS’
  410 |  while ((spot = G_Find (spot, FOFS(classname), cname)) != NULL)
      |                               ^~~~

This means that the code isn't 64 bit clean. On x86 / i386 pointers and integers were 32 bit long. It was a common pattern to cast pointers into integers, the code exactly does this. It cannot work on 64 bit platforms like Linux and Unix were pointers are 64 bit and integers stayed at 32 bits. In this case you can properly use size_t instead: https://github.com/yquake2/xatrix/blob/master/src/header/local.h#L493

3zb2 is under the SDK license which is incompatible to the GPL. You can copy code from the other addons but not from the GPL licensed YQ2 itself and ctf.

from 3zb2.

DanielGibson avatar DanielGibson commented on August 28, 2024

note that the warnings should be harmless - an unused variable doesn't matter at all, and the FOFS macro is used to calculate the offset of a member of the edict_t struct within that struct, which will easily fit into a 32bit int (as sizeof(edict_t) is a lot smaller than 2GB). Would probably be cleaner to use offsetof() than hacking a custom offsetof-like thing, but it should work anyway..

from 3zb2.

abalfoort avatar abalfoort commented on August 28, 2024

I suspected it would be a 32-bit/64-bit issue as it was mentioned on stackoverflow but your explanations I can work with. Thanks.

from 3zb2.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.