From 772dbfae26460d361ba0ee60e3becc377517b099 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Fri, 16 Aug 2013 09:03:36 +0000 Subject: [PATCH] Make it compile in visual studio again, without warnings. --- exec.c | 1 + ftepp.c | 10 +++++ include.mk | 2 +- intrin.c | 2 +- msvc/gmqcc/gmqcc.vcxproj | 55 +++++++++++++----------- msvc/gmqcc/gmqcc.vcxproj.filters | 5 ++- msvc/pak/pak.vcxproj | 29 +++++++------ msvc/pak/pak.vcxproj.filters | 5 ++- msvc/qcvm/qcvm.vcxproj | 23 +++++----- msvc/qcvm/qcvm.vcxproj.filters | 3 +- msvc/testsuite/testsuite.vcxproj | 25 +++++++---- msvc/testsuite/testsuite.vcxproj.filters | 7 ++- opts.c | 2 +- parser.c | 2 +- stat.c | 2 +- test.c | 7 +++ 16 files changed, 112 insertions(+), 68 deletions(-) diff --git a/exec.c b/exec.c index de917db..33037dc 100644 --- a/exec.c +++ b/exec.c @@ -30,6 +30,7 @@ #include "gmqcc.h" +opts_cmd_t opts; /* command line options */ static void loaderror(const char *fmt, ...) { int err = errno; diff --git a/ftepp.c b/ftepp.c index a28bbec..8edb644 100644 --- a/ftepp.c +++ b/ftepp.c @@ -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("\"\""); @@ -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); diff --git a/include.mk b/include.mk index a1d7430..f4b118b 100644 --- a/include.mk +++ b/include.mk @@ -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 diff --git a/intrin.c b/intrin.c index 26012e7..30c7424 100644 --- a/intrin.c +++ b/intrin.c @@ -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) { /* diff --git a/msvc/gmqcc/gmqcc.vcxproj b/msvc/gmqcc/gmqcc.vcxproj index f184b3b..8335978 100755 --- a/msvc/gmqcc/gmqcc.vcxproj +++ b/msvc/gmqcc/gmqcc.vcxproj @@ -10,6 +10,34 @@ Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + {A6BD74E1-31BB-4D00-A9E0-09FF1BC76ED6} gmqcc @@ -41,6 +69,7 @@ Level3 Disabled + NVALGRIND;%(PreprocessorDefinitions) true @@ -52,6 +81,7 @@ MaxSpeed true true + NVALGRIND;%(PreprocessorDefinitions) true @@ -59,31 +89,6 @@ true - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/msvc/gmqcc/gmqcc.vcxproj.filters b/msvc/gmqcc/gmqcc.vcxproj.filters index 9272e9f..7797df3 100755 --- a/msvc/gmqcc/gmqcc.vcxproj.filters +++ b/msvc/gmqcc/gmqcc.vcxproj.filters @@ -5,22 +5,25 @@ + + + - + diff --git a/msvc/pak/pak.vcxproj b/msvc/pak/pak.vcxproj index ab075a9..4ab71bf 100755 --- a/msvc/pak/pak.vcxproj +++ b/msvc/pak/pak.vcxproj @@ -10,6 +10,20 @@ Win32 + + + + + + + + + + + + + + {A6F66BE9-57EF-4E93-AA9D-6E0C8B0990AD} pak @@ -41,6 +55,7 @@ Level3 Disabled + NVALGRIND;%(PreprocessorDefinitions) true @@ -52,6 +67,7 @@ MaxSpeed true true + NVALGRIND;%(PreprocessorDefinitions) true @@ -59,19 +75,6 @@ true - - - - - - - - - - - - - diff --git a/msvc/pak/pak.vcxproj.filters b/msvc/pak/pak.vcxproj.filters index 745f4ce..8784b71 100755 --- a/msvc/pak/pak.vcxproj.filters +++ b/msvc/pak/pak.vcxproj.filters @@ -5,12 +5,13 @@ + - + - + \ No newline at end of file diff --git a/msvc/qcvm/qcvm.vcxproj b/msvc/qcvm/qcvm.vcxproj index 8892daa..c7ce04f 100755 --- a/msvc/qcvm/qcvm.vcxproj +++ b/msvc/qcvm/qcvm.vcxproj @@ -10,6 +10,16 @@ Win32 + + + + + + + + + + {DC980E20-C7A8-4112-A517-631DBDA788E7} qcvm @@ -41,7 +51,7 @@ Level3 Disabled - QCVM_EXECUTOR;%(PreprocessorDefinitions) + NVALGRIND;QCVM_EXECUTOR;%(PreprocessorDefinitions) true @@ -53,7 +63,7 @@ MaxSpeed true true - QCVM_EXECUTOR;%(PreprocessorDefinitions) + NVALGRIND;QCVM_EXECUTOR;%(PreprocessorDefinitions) true @@ -61,15 +71,6 @@ true - - - - - - - - - diff --git a/msvc/qcvm/qcvm.vcxproj.filters b/msvc/qcvm/qcvm.vcxproj.filters index 526cd89..cbdf8a3 100755 --- a/msvc/qcvm/qcvm.vcxproj.filters +++ b/msvc/qcvm/qcvm.vcxproj.filters @@ -3,8 +3,9 @@ - + + diff --git a/msvc/testsuite/testsuite.vcxproj b/msvc/testsuite/testsuite.vcxproj index f0207f9..bad2db1 100755 --- a/msvc/testsuite/testsuite.vcxproj +++ b/msvc/testsuite/testsuite.vcxproj @@ -10,6 +10,20 @@ Win32 + + + + + + + + + + + + + + {7E2839D9-9C1A-4489-9FF9-FDC854EBED3D} testsuite @@ -41,6 +55,7 @@ Level3 Disabled + NVALGRIND;%(PreprocessorDefinitions) true @@ -52,6 +67,7 @@ MaxSpeed true true + NVALGRIND;%(PreprocessorDefinitions) true @@ -59,15 +75,6 @@ true - - - - - - - - - diff --git a/msvc/testsuite/testsuite.vcxproj.filters b/msvc/testsuite/testsuite.vcxproj.filters index 5cd16e3..fccab25 100755 --- a/msvc/testsuite/testsuite.vcxproj.filters +++ b/msvc/testsuite/testsuite.vcxproj.filters @@ -1,12 +1,17 @@  - + + + + + + \ No newline at end of file diff --git a/opts.c b/opts.c index 98421a3..4f6660e 100644 --- a/opts.c +++ b/opts.c @@ -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)); diff --git a/parser.c b/parser.c index fbe7257..87b8726 100644 --- a/parser.c +++ b/parser.c @@ -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); diff --git a/stat.c b/stat.c index ffb5b22..7a2d195 100644 --- a/stat.c +++ b/stat.c @@ -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); diff --git a/test.c b/test.c index d3132e2..e4873e0 100644 --- a/test.c +++ b/test.c @@ -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 -- 2.39.2