dxx-rebirth/common/misc/vgrphys.cpp
Kp 6ac840c52c Fix pch=1 build
PCH mode causes the Valgrind-wrapper header to be included in places
it is not meant to be used, which leads to spurious compiler errors.

PCH mode causes the Valgrind-wrapper __real_* stub functions to see
the physfsx.h PHYSFS macros, which also causes errors.

Fortunately, both cases can be easily fixed.

Add preprocessor guards to the Valgrind-wrapper header to cause it to
compile out when the PCH phase runs.  It has no include guard, so it
will be rescanned with the proper macros when the two consuming files
are built normally.

Modify the Valgrind-wrapper __real_* stub functions to use
the standard macro avoidance trick so that they do not call the
physfsx.h PHYSFS macros.
2017-01-31 04:25:06 +00:00

17 lines
458 B
C++

#define DXX_VG_DECLARE_EXTERN_C(F) \
decltype(F) __real_##F
#define DXX_VG_DEFINE_WRITE(F,V) \
int __real_##F(PHYSFS_File *const file, V val) { \
return (F)(file, val); \
}
#include "vg-wrap-physfs.h"
#if DXX_ENABLE_wrap_PHYSFS_write
PHYSFS_sint64 __real_PHYSFS_write(PHYSFS_File *const handle, const void *const buffer, const PHYSFS_uint32 objSize, const PHYSFS_uint32 objCount)
{
return (PHYSFS_write)(handle, buffer, objSize, objCount);
}
#endif