Make it compile in visual studio again, without warnings.

This commit is contained in:
Dale Weiler 2013-08-16 09:03:36 +00:00
parent b30c3ff8d4
commit 772dbfae26
16 changed files with 113 additions and 69 deletions

1
exec.c
View file

@ -30,6 +30,7 @@
#include "gmqcc.h"
opts_cmd_t opts; /* command line options */
static void loaderror(const char *fmt, ...)
{
int err = errno;

10
ftepp.c
View file

@ -183,6 +183,9 @@ static char *ftepp_predef_timestamp(lex_file *context) {
char *find;
char *value;
size_t size;
#ifdef _MSC_VER
char buffer[64];
#endif
if (stat(context->name, &finfo))
return util_strdup("\"<failed to determine timestamp>\"");
@ -190,7 +193,14 @@ static char *ftepp_predef_timestamp(lex_file *context) {
* ctime and its fucking annoying newline char, no worries, we're
* professionals here.
*/
#ifndef _MSC_VER
find = ctime(&finfo.st_mtime);
#else
ctime_s(buffer, sizeof(buffer), &finfo.st_mtime);
find = buffer;
#endif
value = (char*)mem_a(strlen(find) + 1);
memcpy(&value[1], find, (size = strlen(find)) - 1);

View file

@ -16,7 +16,7 @@ LIBS += -lm
#objects
OBJ_C = main.o lexer.o parser.o fs.o stat.o util.o code.o ast.o ir.o conout.o ftepp.o opts.o utf8.o correct.o fold.o intrin.o
OBJ_P = util.o fs.o conout.o opts.o pak.o stat.o
OBJ_T = test.o util.o opts.o conout.o fs.o stat.o
OBJ_T = test.o util.o conout.o fs.o stat.o
OBJ_X = exec-standalone.o util.o opts.o conout.o fs.o stat.o
#gource flags

View file

@ -57,7 +57,7 @@
vec_push(intrin->parser->globals, (ast_expression*)(VALUE)); \
} while (0)
#define QC_M_E 2.71828182845905
#define QC_M_E 2.71828182845905f
static ast_expression *intrin_pow (intrin_t *intrin) {
/*

View file

@ -10,6 +10,34 @@
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\ast.c" />
<ClCompile Include="..\..\code.c" />
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\correct.c" />
<ClCompile Include="..\..\fold.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\ftepp.c" />
<ClCompile Include="..\..\intrin.c" />
<ClCompile Include="..\..\ir.c" />
<ClCompile Include="..\..\lexer.c" />
<ClCompile Include="..\..\main.c" />
<ClCompile Include="..\..\opts.c" />
<ClCompile Include="..\..\parser.c" />
<ClCompile Include="..\..\stat.c" />
<ClCompile Include="..\..\utf8.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\ast.h" />
<ClInclude Include="..\..\gmqcc.h" />
<ClInclude Include="..\..\ir.h" />
<ClInclude Include="..\..\lexer.h" />
<ClInclude Include="..\..\parser.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\opts.def" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A6BD74E1-31BB-4D00-A9E0-09FF1BC76ED6}</ProjectGuid>
<RootNamespace>gmqcc</RootNamespace>
@ -41,6 +69,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>NVALGRIND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -52,6 +81,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NVALGRIND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -59,31 +89,6 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\ast.c" />
<ClCompile Include="..\..\code.c" />
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\correct.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\ftepp.c" />
<ClCompile Include="..\..\ir.c" />
<ClCompile Include="..\..\lexer.c" />
<ClCompile Include="..\..\main.c" />
<ClCompile Include="..\..\opts.c" />
<ClCompile Include="..\..\parser.c" />
<ClCompile Include="..\..\utf8.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\ast.h" />
<ClInclude Include="..\..\gmqcc.h" />
<ClInclude Include="..\..\intrin.h" />
<ClInclude Include="..\..\ir.h" />
<ClInclude Include="..\..\lexer.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\opts.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View file

@ -5,22 +5,25 @@
<ClCompile Include="..\..\code.c" />
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\correct.c" />
<ClCompile Include="..\..\fold.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\ftepp.c" />
<ClCompile Include="..\..\intrin.c" />
<ClCompile Include="..\..\ir.c" />
<ClCompile Include="..\..\lexer.c" />
<ClCompile Include="..\..\main.c" />
<ClCompile Include="..\..\opts.c" />
<ClCompile Include="..\..\parser.c" />
<ClCompile Include="..\..\stat.c" />
<ClCompile Include="..\..\utf8.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\ast.h" />
<ClInclude Include="..\..\gmqcc.h" />
<ClInclude Include="..\..\intrin.h" />
<ClInclude Include="..\..\ir.h" />
<ClInclude Include="..\..\lexer.h" />
<ClInclude Include="..\..\parser.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\opts.def" />

View file

@ -10,6 +10,20 @@
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\opts.c" />
<ClCompile Include="..\..\pak.c" />
<ClCompile Include="..\..\stat.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gmqcc.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\opts.def" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A6F66BE9-57EF-4E93-AA9D-6E0C8B0990AD}</ProjectGuid>
<RootNamespace>pak</RootNamespace>
@ -41,6 +55,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>NVALGRIND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -52,6 +67,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NVALGRIND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -59,19 +75,6 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\opts.c" />
<ClCompile Include="..\..\pak.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\opts.def" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gmqcc.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View file

@ -5,12 +5,13 @@
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\opts.c" />
<ClCompile Include="..\..\pak.c" />
<ClCompile Include="..\..\stat.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\opts.def" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gmqcc.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\opts.def" />
</ItemGroup>
</Project>

View file

@ -10,6 +10,16 @@
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\exec.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\stat.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gmqcc.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DC980E20-C7A8-4112-A517-631DBDA788E7}</ProjectGuid>
<RootNamespace>qcvm</RootNamespace>
@ -41,7 +51,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>QCVM_EXECUTOR;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NVALGRIND;QCVM_EXECUTOR;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -53,7 +63,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>QCVM_EXECUTOR;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NVALGRIND;QCVM_EXECUTOR;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -61,15 +71,6 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\exec.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gmqcc.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View file

@ -3,8 +3,9 @@
<ItemGroup>
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\exec.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\stat.c" />
<ClCompile Include="..\..\util.c" />
<ClCompile Include="..\..\fs.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gmqcc.h" />

View file

@ -10,6 +10,20 @@
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\opts.c" />
<ClCompile Include="..\..\stat.c" />
<ClCompile Include="..\..\test.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gmqcc.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\opts.def" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7E2839D9-9C1A-4489-9FF9-FDC854EBED3D}</ProjectGuid>
<RootNamespace>testsuite</RootNamespace>
@ -41,6 +55,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>NVALGRIND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -52,6 +67,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NVALGRIND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -59,15 +75,6 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\test.c" />
<ClCompile Include="..\..\util.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gmqcc.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View file

@ -1,12 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\conout.c" />
<ClCompile Include="..\..\fs.c" />
<ClCompile Include="..\..\opts.c" />
<ClCompile Include="..\..\stat.c" />
<ClCompile Include="..\..\test.c" />
<ClCompile Include="..\..\util.c" />
<ClCompile Include="..\..\conout.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gmqcc.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\opts.def" />
</ItemGroup>
</Project>

2
opts.c
View file

@ -55,7 +55,7 @@ const opts_flag_def_t opts_flag_list[COUNT_FLAGS+1] = {
};
unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS];
opts_cmd_t opts; /* command lien options */
opts_cmd_t opts; /* command line options */
static void opts_setdefault(void) {
memset(&opts, 0, sizeof(opts_cmd_t));

View file

@ -3866,7 +3866,7 @@ static bool parse_function_body(parser_t *parser, ast_value *var)
self_think = (ast_expression*)ast_entfield_new(ctx, gbl_self, fld_think);
time_plus_1 = (ast_expression*)ast_binary_new(ctx, INSTR_ADD_F,
gbl_time, (ast_expression*)fold_constgen_float(parser->fold, 0.1));
gbl_time, (ast_expression*)fold_constgen_float(parser->fold, 0.1f));
if (!self_frame || !self_nextthink || !self_think || !time_plus_1) {
if (self_frame) ast_delete(self_frame);

2
stat.c
View file

@ -412,7 +412,7 @@ GMQCC_INLINE size_t util_hthash(hash_table_t *ht, const char *key) {
uint32_t k;
uint32_t h = 0x1EF0 ^ len;
for (i = -block; i; i++) {
for (i = -((int)block); i; i++) {
k = blocks[i];
k *= mask1;
k = GMQCC_ROTL32(k, 15);

7
test.c
View file

@ -162,8 +162,13 @@ static int task_pclose(FILE **handles) {
char *cmd = NULL;
popen_t *open = (popen_t*)mem_a(sizeof(popen_t));
#ifndef _MSC_VER
tmpnam(open->name_err);
tmpnam(open->name_out);
#else
tmpnam_s(open->name_err, L_tmpnam);
tmpnam_s(open->name_out, L_tmpnam);
#endif
(void)mode; /* excluded */
@ -188,6 +193,8 @@ static int task_pclose(FILE **handles) {
mem_d(open);
}
# define popen _popen
# define pclose _pclose
#endif /*! _WIN32 */
#define TASK_COMPILE 0