Add developer option to test header completeness

This commit is contained in:
Kp 2014-11-17 04:02:25 +00:00
parent c72ec87296
commit 57ed5c24fd
6 changed files with 61 additions and 2 deletions

View file

@ -866,6 +866,7 @@ class FilterHelpText:
class DXXCommon(LazyObjectConstructor):
__shared_program_instance = [0]
__shared_header_file_list = []
__endian = checkEndian()
@property
def program_message_prefix(self):
@ -959,6 +960,7 @@ class DXXCommon(LazyObjectConstructor):
{
'variable': BoolVariable,
'arguments': (
('check_header_includes', False, 'compile test each header (developer option)'),
('debug', False, 'build DEBUG binary which includes asserts, debugging output, cheats and more output'),
('memdebug', self.default_memdebug, 'build with malloc tracking'),
('lto', False, 'enable gcc link time optimization'),
@ -1182,7 +1184,47 @@ class DXXCommon(LazyObjectConstructor):
env.Depends(target, name)
f.write('/* END PCH GENERATED FILE */\n')
def create_header_targets(self):
fs = SCons.Node.FS.get_default_fs()
builddir = self.user_settings.builddir
check_header_includes = os.path.join(builddir, 'check_header_includes.cpp')
if not self.__shared_header_file_list:
open(check_header_includes, 'wt')
git = subprocess.Popen(['git', 'ls-files', '-z', '--', '*.h'], executable='/usr/bin/git', stdout=subprocess.PIPE, close_fds=True)
headers = git.communicate(None)[0]
excluded_directories = (
'common/arch/cocoa/',
'common/arch/carbon/',
)
self.__shared_header_file_list.extend([h for h in headers.split('\0') if h and not h.startswith(excluded_directories)])
dirname = os.path.join(builddir, self.srcdir)
kwargs = {
'CXXFLAGS' : self.env['CXXFLAGS'][:],
'source' : check_header_includes
}
Depends = self.env.Depends
StaticObject = self.env.StaticObject
OBJSUFFIX = self.env['OBJSUFFIX']
for name in self.__shared_header_file_list:
if not name:
continue
if self.srcdir == 'common' and not name.startswith('common/'):
# Skip game-specific headers when testing common
continue
if self.srcdir[0] == 'd' and name[0] == 'd' and not name.startswith(self.srcdir):
# Skip d1 in d2 and d2 in d1
continue
CPPFLAGS = self.env['CPPFLAGS'][:]
if name[:24] == 'common/include/compiler-':
CPPFLAGS.extend(['-include', 'dxxsconf.h'])
CPPFLAGS.extend(['-include', name])
if self.user_settings.verbosebuild:
kwargs['CXXCOMSTR'] = "Checking %s %s %s" % (self.target, builddir, name)
Depends(StaticObject(target=os.path.join('%s/chi/%s%s' % (dirname, name, OBJSUFFIX)), CPPFLAGS=CPPFLAGS, **kwargs), fs.File(name))
def create_pch_node(self,dirname,configure_pch_flags):
if self.user_settings.check_header_includes:
self.create_header_targets()
if not configure_pch_flags:
self.env._dxx_pch_node = None
return

View file

@ -30,6 +30,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
struct grs_canvas;
struct editor_view;
struct vsegptridx_t;
struct segment_array_t;
void meddraw_init_views( grs_canvas * canvas);
void draw_world(grs_canvas *screen_canvas,editor_view *v,vsegptridx_t mine_ptr,int depth);

View file

@ -29,6 +29,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifdef __cplusplus
struct vms_matrix;
struct vsegptr_t;
void GetMouseRotation( int idx, int idy, vms_matrix * RotMat );
extern int Gameview_lockstep; //In medmisc.c

View file

@ -28,6 +28,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifdef __cplusplus
struct vsegptr_t;
struct vsegptridx_t;
void assign_light_to_side(vsegptr_t sp, int sidenum);
extern void assign_default_lighting_all(void);

View file

@ -37,9 +37,15 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define PARALLAX 0 // If !0, then special debugging info for Parallax eyes only enabled.
#ifdef __cplusplus
#include "pstypes.h"
#include "countarray.h"
#include "vecmat.h"
struct point_seg;
struct vobjptr_t;
struct objptridx_t;
struct vobjptridx_t;
struct PHYSFS_File;
#define PLAYER_AWARENESS_INITIAL_TIME (3*F1_0)
#define MAX_PATH_LENGTH 30 // Maximum length of path in ai path following.
@ -295,8 +301,8 @@ static inline std::size_t operator-(point_seg_array_t::iterator i, point_seg_arr
}
#endif
extern int ai_save_state(PHYSFS_file * fp);
extern int ai_restore_state(PHYSFS_file *fp, int version, int swap);
int ai_save_state(PHYSFS_File * fp);
int ai_restore_state(PHYSFS_File *fp, int version, int swap);
int create_path_points(vobjptridx_t objp, segnum_t start_seg, segnum_t end_seg, point_seg_array_t::iterator point_segs, short *num_points, int max_depth, int random_flag, int safety_flag, segnum_t avoid_seg);

View file

@ -30,8 +30,14 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <physfs.h>
#ifdef __cplusplus
#include "maths.h"
struct vms_vector;
struct objptridx_t;
struct cobjptridx_t;
struct vobjptr_t;
struct vcobjptr_t;
struct vobjptridx_t;
// explosion types
#define ET_SPARKS 0 //little sparks, like when laser hits wall