OpenLara icon indicating copy to clipboard operation
OpenLara copied to clipboard

utils.h, typedefs conflicts on OpenBSD workaround

Open c64skin opened this issue 4 years ago • 6 comments

~~``` #ifdef OpenBSD typedef int8_t int8; typedef int16_t int16; typedef int32_t int32; typedef int64_t int64; typedef uint8_t uint8; typedef uint16_t uint16; typedef uint32_t uint32; typedef uint64_t uint64; #else typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef signed long long int64; typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef unsigned long long uint64; #endif~~

c64skin avatar Feb 08 '21 12:02 c64skin

why it conflicts?

XProger avatar Feb 10 '21 23:02 XProger

another day and a another look.. it's these two that is the issue in utils.h:

inline uint16 swap16(uint16 x) {
    return ((x & 0x00FF) << 8) | ((x & 0xFF00) >> 8);
}

inline uint32 swap32(uint32 x) {
    return ((x & 0x000000FF) << 24) | ((x & 0x0000FF00) << 8) | ((x & 0x00FF0000) >> 8) | ((x & 0xFF000000) >> 24);
}

../../utils.h:160:15: error: 'uint16 __uint16_t' redeclared as different kind of symbol inline uint16 swap16(uint16 x) {

../../utils.h:165:15: error: 'uint32 __uint32_t' redeclared as different kind of symbol inline uint32 swap32(uint32 x) {

c64skin avatar Feb 11 '21 10:02 c64skin

workaround:

#ifndef __OpenBSD__
inline uint16 swap16(uint16 x) {
    return ((x & 0x00FF) << 8) | ((x & 0xFF00) >> 8);
}

inline uint32 swap32(uint32 x) {
    return ((x & 0x000000FF) << 24) | ((x & 0x0000FF00) << 8) | ((x & 0x00FF0000) >> 8) | ((x & 0xFF000000) >> 24);
}
#endif

c64skin avatar Feb 11 '21 10:02 c64skin

#ifdef BSD should be better I think. How did you replace linux/*.h headers? I compile game without joystick support, but it crashes on some OGL calls, mesa gl version is 3.2

XProger avatar Feb 13 '21 02:02 XProger

I've settled for the sdl2 version...i haven't made any effort to try building nix version. If you recommend nix instead i will do so.

c64skin avatar Feb 13 '21 03:02 c64skin

no, just my curiosity, I have never worked with BSD systems... maybe I'll try

XProger avatar Feb 13 '21 03:02 XProger