mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Compile without -fno-strict-aliasing.
git-svn-id: https://svn.eduke32.com/eduke32@7224 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1cbdb901bd
commit
c1caf149d7
5 changed files with 35 additions and 14 deletions
|
@ -691,7 +691,7 @@ ifneq (0,$(KRANDDEBUG))
|
||||||
COMMONFLAGS += -fno-inline -fno-inline-functions -fno-inline-functions-called-once
|
COMMONFLAGS += -fno-inline -fno-inline-functions -fno-inline-functions-called-once
|
||||||
endif
|
endif
|
||||||
|
|
||||||
COMMONFLAGS += -fno-strict-aliasing -fno-threadsafe-statics $(F_JUMP_TABLES) $(F_NO_STACK_PROTECTOR)
|
COMMONFLAGS += -fno-threadsafe-statics $(F_JUMP_TABLES) $(F_NO_STACK_PROTECTOR) $(F_NO_STRICT_ALIASING)
|
||||||
|
|
||||||
|
|
||||||
##### Warnings
|
##### Warnings
|
||||||
|
|
|
@ -129,6 +129,14 @@
|
||||||
# define inline __inline
|
# define inline __inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAY_ALIAS
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
# define MAY_ALIAS
|
||||||
|
# else
|
||||||
|
# define MAY_ALIAS __attribute__((may_alias))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FORCE_INLINE
|
#ifndef FORCE_INLINE
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# define FORCE_INLINE __forceinline
|
# define FORCE_INLINE __forceinline
|
||||||
|
@ -783,7 +791,7 @@ typedef reg_t unative_t;
|
||||||
#endif
|
#endif
|
||||||
EDUKE32_STATIC_ASSERT(sizeof(native_t) == sizeof(unative_t));
|
EDUKE32_STATIC_ASSERT(sizeof(native_t) == sizeof(unative_t));
|
||||||
|
|
||||||
typedef struct {
|
typedef struct MAY_ALIAS {
|
||||||
int32_t x, y;
|
int32_t x, y;
|
||||||
} vec2_t;
|
} vec2_t;
|
||||||
|
|
||||||
|
@ -795,7 +803,7 @@ typedef struct {
|
||||||
uint32_t x, y;
|
uint32_t x, y;
|
||||||
} vec2u_t;
|
} vec2u_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct MAY_ALIAS {
|
||||||
int32_t x, y, z;
|
int32_t x, y, z;
|
||||||
} vec3_t;
|
} vec3_t;
|
||||||
|
|
||||||
|
|
|
@ -833,8 +833,10 @@ skip_check:
|
||||||
case CON_FTOI:
|
case CON_FTOI:
|
||||||
insptr++;
|
insptr++;
|
||||||
{
|
{
|
||||||
int32_t bits=Gv_GetVarX(*insptr), scale=*(insptr+1);
|
union { int32_t ival; float fval; };
|
||||||
float fval = *((float *)&bits);
|
|
||||||
|
ival=Gv_GetVarX(*insptr);
|
||||||
|
int32_t const scale=*(insptr+1);
|
||||||
// rounding must absolutely be!
|
// rounding must absolutely be!
|
||||||
//OSD_Printf("ftoi: bits:%8x, scale=%d, fval=%f, (int32_t)(fval*scale)=%d\n", bits, scale, fval, (int32_t)(fval*scale));
|
//OSD_Printf("ftoi: bits:%8x, scale=%d, fval=%f, (int32_t)(fval*scale)=%d\n", bits, scale, fval, (int32_t)(fval*scale));
|
||||||
Gv_SetVarX(*insptr, (int32_t)Blrintf(fval * scale));
|
Gv_SetVarX(*insptr, (int32_t)Blrintf(fval * scale));
|
||||||
|
@ -845,9 +847,12 @@ skip_check:
|
||||||
case CON_ITOF:
|
case CON_ITOF:
|
||||||
insptr++;
|
insptr++;
|
||||||
{
|
{
|
||||||
int32_t scaled=Gv_GetVarX(*insptr), scale=*(insptr+1);
|
union { int32_t ival; float fval; };
|
||||||
float fval = (float)scaled/(float)scale;
|
|
||||||
Gv_SetVarX(*insptr, *((int32_t *)&fval));
|
ival=Gv_GetVarX(*insptr);
|
||||||
|
int32_t const scale=*(insptr+1);
|
||||||
|
fval = (float)ival/(float)scale;
|
||||||
|
Gv_SetVarX(*insptr, ival);
|
||||||
}
|
}
|
||||||
insptr += 2;
|
insptr += 2;
|
||||||
continue;
|
continue;
|
||||||
|
@ -2737,8 +2742,10 @@ badindex:
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
int32_t ii = 0;
|
int32_t ii = 0;
|
||||||
|
union { int32_t ival; float fval; };
|
||||||
|
ival = arg[i++];
|
||||||
|
|
||||||
Bsprintf(buf, "%f", *((float *)&arg[i++]));
|
Bsprintf(buf, "%f", fval);
|
||||||
|
|
||||||
ii = Bstrlen(buf);
|
ii = Bstrlen(buf);
|
||||||
Bmemcpy(&tmpbuf[j], buf, ii);
|
Bmemcpy(&tmpbuf[j], buf, ii);
|
||||||
|
|
|
@ -350,10 +350,12 @@ int32_t __fastcall Gv_GetVarX(int32_t id)
|
||||||
return (aGameVars[id].val.plValues[vm.g_st] ^ -negateResult) + negateResult;
|
return (aGameVars[id].val.plValues[vm.g_st] ^ -negateResult) + negateResult;
|
||||||
case GAMEVAR_FLOATPTR:
|
case GAMEVAR_FLOATPTR:
|
||||||
{
|
{
|
||||||
float fval = *(float *)aGameVars[id].val.lValue;
|
union { int32_t ival; float fval; };
|
||||||
|
|
||||||
|
fval = *(float *)aGameVars[id].val.plValues;
|
||||||
if (negateResult)
|
if (negateResult)
|
||||||
fval *= -1;
|
fval *= -1;
|
||||||
return *(int32_t *)&fval;
|
return ival;
|
||||||
}
|
}
|
||||||
case GAMEVAR_INTPTR:
|
case GAMEVAR_INTPTR:
|
||||||
return (*((int32_t *)aGameVars[id].val.lValue) ^ -negateResult) + negateResult;
|
return (*((int32_t *)aGameVars[id].val.lValue) ^ -negateResult) + negateResult;
|
||||||
|
@ -465,8 +467,9 @@ void __fastcall Gv_SetVarX(int32_t id, int32_t lValue)
|
||||||
return;
|
return;
|
||||||
case GAMEVAR_FLOATPTR:
|
case GAMEVAR_FLOATPTR:
|
||||||
{
|
{
|
||||||
int32_t ival = lValue;
|
union { int32_t ival; float fval; };
|
||||||
float fval = *(float *)&ival;
|
ival = lValue;
|
||||||
|
|
||||||
if (fval!=fval || fval<-3.4e38 || fval > 3.4e38)
|
if (fval!=fval || fval<-3.4e38 || fval > 3.4e38)
|
||||||
{
|
{
|
||||||
M32_ERROR("Gv_SetVarX(): tried to set float var to NaN or infinity");
|
M32_ERROR("Gv_SetVarX(): tried to set float var to NaN or infinity");
|
||||||
|
|
|
@ -83,7 +83,10 @@ enet_address_set_host (ENetAddress * address, const char * name)
|
||||||
int
|
int
|
||||||
enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength)
|
enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength)
|
||||||
{
|
{
|
||||||
char * addr = inet_ntoa (* (struct in_addr const *) & address -> host);
|
struct in_addr in;
|
||||||
|
memcpy(&in, &address->host, sizeof(struct in_addr));
|
||||||
|
char *addr = inet_ntoa (in);
|
||||||
|
|
||||||
if (addr == NULL)
|
if (addr == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue