static void dumpCheckData( char *include_file ) { SRCFILE src; time_t stamp; auto char buff[_MAX_PATH]; PCHWriteVar( GenSwitches ); PCHWriteVar( TargetSwitches ); PCHWriteUInt( ErrPCHVersion() ); PCHWriteUInt( TYPC_LAST ); PCHWriteUInt( sizeof( COMP_FLAGS ) ); PCHWriteVar( CompFlags ); dumpFileString( WholeFName ); include_file = IoSuppFullPath( include_file, buff, sizeof( buff ) ); dumpFileString( include_file ); getcwd( buff, sizeof( buff ) ); dumpFileString( buff ); HFileListStart(); for( ; ; ) { HFileListNext( buff ); dumpFileString( buff ); if( buff[0] == '\0' ) break; } src = SrcFileNotReadOnly( SrcFileWalkInit() ); for( ; src != NULL; ) { if( ! IsSrcFilePrimary( src ) ) { dumpFileString( SrcFileName( src ) ); stamp = SrcFileTimeStamp( src ); PCHWriteVar( stamp ); } src = SrcFileNotReadOnly( SrcFileWalkNext( src ) ); } buff[0] = '\0'; dumpFileString( buff ); PCHDumpMacroCheck(); }
extern dw_client DwarfInit( void ) /********************************/ { dw_init_info info; dw_cu_info cu; char dir[_MAX_PATH2]; char fname[_MAX_PATH]; char * full_fname; int i; char * incbuf; char * inccurr; unsigned incsize; dw_client client; DwioInit(); for( i = 0 ; i < DW_DEBUG_MAX ; i++ ) { dw_sections[i].file = DwioCreateFile(); dw_sections[i].offset = 0; dw_sections[i].length = 0; } HFileListStart(); incsize = HFileListSize(); if( incsize != 0 ) { incbuf = CMemAlloc( incsize ); inccurr = incbuf; for(;;) { HFileListNext( inccurr ); if( *inccurr == '\0' ) break; inccurr = strend( inccurr ) + 1; } incsize = inccurr - incbuf; } info.language = DWLANG_CPP; info.compiler_options = DW_CM_BROWSER; info.producer_name = "WATCOM C++ V1"; memcpy( info.exception_handler, Environment, sizeof( jmp_buf ) ); info.funcs.reloc = &dw_reloc; info.funcs.write = &dw_write; info.funcs.seek = &dw_seek; info.funcs.tell = &dw_tell; info.funcs.alloc = &dw_alloc; info.funcs.free = &dw_free; client = DWInit( &info ); if( client == NULL ) { CFatal( "dwarf: error in DWInit()" ); } getcwd( dir, sizeof( dir ) ), full_fname = IoSuppFullPath( WholeFName, fname, sizeof( fname ) ); cu.source_filename = full_fname; cu.directory = dir; cu.flags = 1; cu.offset_size = TARGET_NEAR_POINTER; cu.segment_size = 0; cu.model = DW_MODEL_NONE; cu.inc_list = incbuf; cu.inc_list_len = incsize; cu.dbg_pch = 0; DWBeginCompileUnit( client, &cu ); if( incsize != 0 ) { CMemFree( incbuf ); } return( client ); }
static bool stalePCH( char *include_file ) { time_t stamp; cg_switches test_gen; cg_target_switches test_target; auto char buff1[_MAX_PATH]; auto char buff2[_MAX_PATH]; auto COMP_FLAGS testflags; PCHReadVar( test_gen ); PCHReadVar( test_target ); if( test_gen != GenSwitches || test_target != TargetSwitches ) { pchWarn( WARN_PCH_CONTENTS_OPTIONS ); return( true ); } if( PCHReadUInt() != ErrPCHVersion() ) { pchWarn( WARN_PCH_CONTENTS_HEADER_ERROR ); return( true ); } if( PCHReadUInt() != TYPC_LAST ) { pchWarn( WARN_PCH_CONTENTS_HEADER_ERROR ); return( true ); } if( PCHReadUInt() != sizeof( COMP_FLAGS ) ) { pchWarn( WARN_PCH_CONTENTS_HEADER_ERROR ); return( true ); } PCHReadVar( testflags ); if( checkCompFlags( &testflags ) ) { pchWarn( WARN_PCH_CONTENTS_OPTIONS ); return( true ); } readFileString( buff1 ); if( FNAMECMPSTR( buff1, WholeFName ) == 0 ) { if( CompFlags.pch_debug_info_opt ) { // this source file created the PCH but it is being recompiled // so we have to recreate the PCH along with the debug info pchWarn( WARN_PCH_DEBUG_OPTIMIZE ); return( true ); } } readFileString( buff1 ); include_file = IoSuppFullPath( include_file, buff2, sizeof( buff2 ) ); if( FNAMECMPSTR( buff1, include_file ) != 0 ) { pchWarn( WARN_PCH_CONTENTS_INCFILE ); return( true ); } readFileString( buff1 ); getcwd( buff2, sizeof( buff2 ) ); if( stringIsDifferent( buff1, buff2, WARN_PCH_CONTENTS_CWD ) ) { return( true ); } if( CompFlags.pch_min_check ) { flushUntilNullString( buff2 ); } else { HFileListStart(); for(;;) { HFileListNext( buff1 ); readFileString( buff2 ); if( stringIsDifferent( buff1, buff2, WARN_PCH_CONTENTS_INCLUDE ) ) { return( true ); } if( buff1[0] == '\0' ) break; } } for( ; *readFileString( buff1 ) != '\0'; ) { PCHReadVar( stamp ); if( ! sameStamp( buff1, stamp ) ) { PCHWarn2p( WARN_PCH_CONTENTS_HFILE, buff1 ); return( true ); } } if( ! PCHVerifyMacroCheck() ) { return( true ); } transferCompFlags( &testflags ); return( false ); }