Lunatic: partially fix LTO=1 build with GCC.

Having to tag these few variables and functions as ATTRIBUTE((used))
seems sensible, but what follows is just strange. OSD_Printf? headspritesect?

git-svn-id: https://svn.eduke32.com/eduke32@3932 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-07-04 19:38:53 +00:00
parent baebd63bac
commit 6e443944c3
7 changed files with 20 additions and 18 deletions

View file

@ -43,12 +43,15 @@ enum rendmode_t {
#ifdef LUNATIC #ifdef LUNATIC
# define NEW_MAP_FORMAT # define NEW_MAP_FORMAT
// Merely a marker for LuaJIT C function callbacks: // A marker for LuaJIT C function callbacks, but not merely:
# define LUNATIC_CB # define LUNATIC_CB ATTRIBUTE((used))
// Used for variables and functions referenced from Lua:
# define LUNATIC_EXTERN ATTRIBUTE((used))
#else #else
# ifdef NEW_MAP_FORMAT # ifdef NEW_MAP_FORMAT
# error "New map format can only be used with Lunatic" # error "New map format can only be used with Lunatic"
# endif # endif
# define LUNATIC_EXTERN static
#endif #endif
// additional space beyond wall, in walltypes: // additional space beyond wall, in walltypes:

View file

@ -63,16 +63,18 @@ L_State g_engState;
//#define DEBUG_TILESIZY_512 //#define DEBUG_TILESIZY_512
//#define DEBUG_TILEOFFSETS //#define DEBUG_TILEOFFSETS
#if !defined DEBUG_MAIN_ARRAYS #ifdef LUNATIC
const int32_t engine_main_arrays_are_static = 0; // for Lunatic # if !defined DEBUG_MAIN_ARRAYS
#else LUNATIC_EXTERN const int32_t engine_main_arrays_are_static = 0; // for Lunatic
const int32_t engine_main_arrays_are_static = 1; # else
LUNATIC_EXTERN const int32_t engine_main_arrays_are_static = 1;
# endif
#endif #endif
#if MAXSECTORS==MAXSECTORSV8 #if MAXSECTORS==MAXSECTORSV8
const int32_t engine_v8 = 1; LUNATIC_EXTERN const int32_t engine_v8 = 1;
#else #else
const int32_t engine_v8 = 0; LUNATIC_EXTERN const int32_t engine_v8 = 0;
#endif #endif
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS

View file

@ -134,9 +134,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef LUNATIC #ifdef LUNATIC
# include "lunatic_game.h" # include "lunatic_game.h"
# define LUNATIC_EXTERN
#else
# define LUNATIC_EXTERN static
#endif #endif
static inline int32_t G_HaveEvent(int32_t iEventID) static inline int32_t G_HaveEvent(int32_t iEventID)

View file

@ -181,8 +181,8 @@ __attribute__((packed)) struct {
int16_t cgg; int16_t cgg;
const int16_t lightId, lightcount, lightmaxrange; const int16_t lightId, lightcount, lightmaxrange;
// NOTE: on 32-bit, C's lightptr+filler <=> this dummy:
const union { intptr_t ptr; uint64_t dummy; } _light; const union { intptr_t ptr; uint64_t dummy; } _light;
// XXX: 32-bit has filler
} }
]] ]]

View file

@ -323,12 +323,12 @@ Returns one value from the global engine-side pseudo-random number generator
in the integer range [0{nbsp}..{nbsp}65535]. in the integer range [0{nbsp}..{nbsp}65535].
[[timing_funcs]] [[timing_funcs]]
`gv.getticks()`, `gv.gethiticksms()`:: `gv.getticks()`, `gv.gethitickms()`::
Each of these functions return a number that increases at a rate of 1 per Each of these functions return a number that increases at a rate of 1 per
millisecond. Their only intended application is to profile bits of code; they millisecond. Their only intended application is to profile bits of code; they
should not be used to control the game world. The two functions differ in their should not be used to control the game world. The two functions differ in their
precision: `getticks()` always returns integral values, while the result of precision: `getticks()` always returns integral values, while the result of
`gethiticksms()` also has an unspecified precision in the fractional part. (It `gethitickms()` also has an unspecified precision in the fractional part. (It
can be expected to give a time precision of at least one microsecond.) can be expected to give a time precision of at least one microsecond.)
`gv.doQuake(gametics [, snd])`:: `gv.doQuake(gametics [, snd])`::

View file

@ -53,7 +53,7 @@ typedef struct {
// See: Good Practice in (Pseudo) Random Number Generation for // See: Good Practice in (Pseudo) Random Number Generation for
// Bioinformatics Applications, by David Jones // Bioinformatics Applications, by David Jones
ATTRIBUTE_OPTIMIZE("O2") ATTRIBUTE_OPTIMIZE("O2")
uint32_t rand_jkiss_u32(rng_jkiss_t *s) LUNATIC_EXTERN uint32_t rand_jkiss_u32(rng_jkiss_t *s)
{ {
uint64_t t; uint64_t t;
s->x = 314527869 * s->x + 1234567; s->x = 314527869 * s->x + 1234567;
@ -63,7 +63,7 @@ uint32_t rand_jkiss_u32(rng_jkiss_t *s)
} }
ATTRIBUTE_OPTIMIZE("O2") ATTRIBUTE_OPTIMIZE("O2")
double rand_jkiss_dbl(rng_jkiss_t *s) LUNATIC_EXTERN double rand_jkiss_dbl(rng_jkiss_t *s)
{ {
double x; double x;
unsigned int a, b; unsigned int a, b;

View file

@ -45,8 +45,8 @@ local mt = {
getu32 = ffiC.rand_jkiss_u32, getu32 = ffiC.rand_jkiss_u32,
getdbl = ffiC.rand_jkiss_dbl, getdbl = ffiC.rand_jkiss_dbl,
-- Initialize the JKISS PRNG using the MD4 of the lower bits of the -- Initialize the JKISS PRNG using the CRC32 of the result of several
-- profiling timer. -- profiling timer calls interpreted as byte sequence.
init_time_md4 = function(s) init_time_md4 = function(s)
local tin = ffi.new("uchar_double_u_t") local tin = ffi.new("uchar_double_u_t")
local tout = ffi.new("uint32_t [4]") local tout = ffi.new("uint32_t [4]")