dxx-rebirth/common/misc/vg-wrap-physfs.h
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

35 lines
991 B
C

#include "dxxsconf.h"
#ifndef DXX_ENABLE_wrap_PHYSFS_write
#define DXX_ENABLE_wrap_PHYSFS_write DXX_HAVE_POISON_VALGRIND
#endif
#if DXX_ENABLE_wrap_PHYSFS_write
#include <physfs.h>
#ifdef DXX_VG_DECLARE_EXTERN_C
extern "C" {
DXX_VG_DECLARE_EXTERN_C(PHYSFS_write);
DXX_VG_DECLARE_EXTERN_C(PHYSFS_writeSBE16);
DXX_VG_DECLARE_EXTERN_C(PHYSFS_writeSBE32);
DXX_VG_DECLARE_EXTERN_C(PHYSFS_writeSLE16);
DXX_VG_DECLARE_EXTERN_C(PHYSFS_writeSLE32);
DXX_VG_DECLARE_EXTERN_C(PHYSFS_writeULE16);
DXX_VG_DECLARE_EXTERN_C(PHYSFS_writeULE32);
}
#endif
#ifdef DXX_VG_DECLARE_WRITE_HELPER
DXX_VG_DECLARE_WRITE_HELPER;
#endif
#ifdef DXX_VG_DEFINE_WRITE
DXX_VG_DEFINE_WRITE(PHYSFS_writeSBE16, PHYSFS_sint16);
DXX_VG_DEFINE_WRITE(PHYSFS_writeSBE32, PHYSFS_sint32);
DXX_VG_DEFINE_WRITE(PHYSFS_writeSLE16, PHYSFS_sint16);
DXX_VG_DEFINE_WRITE(PHYSFS_writeSLE32, PHYSFS_sint32);
DXX_VG_DEFINE_WRITE(PHYSFS_writeULE16, PHYSFS_uint16);
DXX_VG_DEFINE_WRITE(PHYSFS_writeULE32, PHYSFS_uint32);
#endif
#endif