From 0c6786cc7caf7eb08400984fc7bde714f2d44cf4 Mon Sep 17 00:00:00 2001 From: relnev Date: Sat, 1 Jun 2002 07:12:34 +0000 Subject: [PATCH] a few NDEBUG updates. removed a few warnings. --- Makefile | 3 +++ include/exceptionhandler.h | 11 ++++++++-- include/pstypes.h | 20 ++++++++++++------ include/unix.h | 4 ++++ src/freespace2/freespace.cpp | 30 ++++++++++++++++++--------- src/graphics/gropengl.cpp | 9 ++++++-- src/hud/hudconfig.cpp | 11 ++++++++++ src/mission/missionbriefcommon.cpp | 10 ++++++++- src/mission/missionhotkey.cpp | 10 +++++++++ src/missionui/missionscreencommon.cpp | 7 ++++++- src/model/modelread.cpp | 10 ++++++++- src/network/multi_xfer.cpp | 7 ++++++- src/network/multiui.cpp | 7 ++++++- src/object/collideshipship.cpp | 7 ++++++- src/ship/aibig.cpp | 7 +++++++ src/ship/aicode.cpp | 7 +++++++ 16 files changed, 134 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index c463dd0..1239ace 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,9 @@ CODE_BINARY=code.a FS_BINARY=freespace2 LDFLAGS=$(shell sdl-config --libs) -lGL CFLAGS=-Wall -g -DPLAT_UNIX -O2 $(shell sdl-config --cflags) -Iinclude/ -fwritable-strings +#CFLAGS+=-DNDEBUG # Not yet stable! +#CFLAGS+=-funroll-loops # -fomit-frame-pointer +#CFLAGS+=-march=pentiumpro -mcpu=pentiumpro %.o: %.cpp $(CC) -c -o $@ $< $(CFLAGS) diff --git a/include/exceptionhandler.h b/include/exceptionhandler.h index 055ef74..0fb0e68 100644 --- a/include/exceptionhandler.h +++ b/include/exceptionhandler.h @@ -7,8 +7,13 @@ * Header file for program exception handling * * $Log$ - * Revision 1.1 2002/05/03 03:28:11 root - * Initial revision + * Revision 1.2 2002/06/01 07:12:32 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * + * Revision 1.1.1.1 2002/05/03 03:28:11 root + * Initial import. * * * 1 6/29/99 7:42p Dave @@ -20,7 +25,9 @@ * $NoKeywords: $ */ +#ifndef PLAT_UNIX #pragma once // Include this file only once +#endif #ifndef __EXCEPTION_HANDLER_H #define __EXCEPTION_HANDLER_H diff --git a/include/pstypes.h b/include/pstypes.h index 4fd7e59..f9c6f87 100644 --- a/include/pstypes.h +++ b/include/pstypes.h @@ -7,6 +7,11 @@ * Header file containg global typedefs, constants and macros * * $Log$ + * Revision 1.3 2002/06/01 07:12:32 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.2 2002/05/28 06:28:20 theoddone33 * Filesystem mods, actually reads some data files now * @@ -671,13 +676,13 @@ template void CAP( T& v, T mn, T mx ) int vm_init(int min_heap_size); // Allocates some RAM. - void *vm_malloc( int size ); +// void *vm_malloc( int size ); // - char *vm_strdup( const char *ptr ); +// char *vm_strdup( const char *ptr ); // Frees some RAM. - void vm_free( void *ptr ); +// void vm_free( void *ptr ); // Frees all RAM. void vm_free_all(); @@ -686,9 +691,12 @@ template void CAP( T& v, T mn, T mx ) #define VM_MALLOC(size) vm_malloc(size) #define VM_FREE(ptr) vm_free(ptr) - #define malloc(size) vm_malloc(size) - #define free(ptr) vm_free(ptr) - #define strdup(ptr) vm_strdup(ptr) +// #define malloc(size) vm_malloc(size) +// #define free(ptr) vm_free(ptr) +// #define strdup(ptr) vm_strdup(ptr) + #define vm_malloc(size) malloc(size) + #define vm_free(ptr) free(ptr) + #define vm_strdup(ptr) strdup(ptr) #endif diff --git a/include/unix.h b/include/unix.h index 1e69a37..c4dfd49 100644 --- a/include/unix.h +++ b/include/unix.h @@ -69,7 +69,11 @@ extern int filelength (int fd); extern int MulDiv (int, int, int); #define CRITICAL_SECTION SDL_mutex* +#ifndef NDEBUG #define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid()) +#else +#define STUB_FUNCTION +#endif #define closesocket(A) close(A) #define CopyMemory(A,B,C) memcpy(A,B,C) diff --git a/src/freespace2/freespace.cpp b/src/freespace2/freespace.cpp index f1b183a..ac206a7 100644 --- a/src/freespace2/freespace.cpp +++ b/src/freespace2/freespace.cpp @@ -7,6 +7,11 @@ * Freespace main body * * $Log$ + * Revision 1.10 2002/06/01 07:12:32 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.9 2002/05/31 03:05:59 relnev * sane default * @@ -2211,7 +2216,8 @@ void game_init() } int trying_d3d = 0; - + +#ifndef PLAT_UNIX if (!Is_standalone && ptr && (strstr(ptr, NOX("3DFX Glide")))) { #ifdef E3_BUILD // always 640 for E3 @@ -2255,24 +2261,28 @@ void game_init() if ( Use_fullscreen_at_startup && !Is_standalone) { gr_init(GR_640, GR_DIRECTDRAW); } else { -#ifdef PLAT_UNIX - gr_init(GR_640, GR_OPENGL); -#else gr_init(GR_640, GR_SOFTWARE); -#endif } #else if ( !Is_standalone ) { gr_init(GR_640, GR_DIRECTDRAW); } else { -#ifdef PLAT_UNIX - gr_init(GR_640, GR_OPENGL); -#else - gr_init(GR_640, GR_SOFTWAREL); -#endif + gr_init(GR_640, GR_SOFTWARE); } #endif } +#else + if (!Is_standalone /* && ptr && (strstr(ptr, NOX("OpenGL"))) */) { + if(strstr(ptr, NOX("(1024x768)"))){ + gr_init(GR_1024, GR_OPENGL); + } else { + gr_init(GR_640, GR_OPENGL); + } + } else { + STUB_FUNCTION; + gr_init(GR_640, GR_SOFTWARE); + } +#endif // tried d3d ? extern int Gr_inited; diff --git a/src/graphics/gropengl.cpp b/src/graphics/gropengl.cpp index b407982..2893fcb 100644 --- a/src/graphics/gropengl.cpp +++ b/src/graphics/gropengl.cpp @@ -7,6 +7,11 @@ * Code that uses the OpenGL graphics library * * $Log$ + * Revision 1.40 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.39 2002/06/01 05:33:15 relnev * copied more code over. * @@ -1527,10 +1532,10 @@ void gr_opengl_tmapper_internal( int nv, vertex ** verts, uint flags, int is_sca if ( flags & TMAP_FLAG_TEXTURED ) { tu = va->u*u_scale; tv = va->v*v_scale; - glTexCoord2d(tu, tv); + glTexCoord2f(tu, tv); } - glVertex4d(sx/rhw, sy/rhw, -sz/rhw, 1.0/rhw); + glVertex4f(sx/rhw, sy/rhw, -sz/rhw, 1.0/rhw); } glEnd(); } diff --git a/src/hud/hudconfig.cpp b/src/hud/hudconfig.cpp index dd7f69a..6dd497b 100644 --- a/src/hud/hudconfig.cpp +++ b/src/hud/hudconfig.cpp @@ -7,6 +7,11 @@ * C module to handle HUD configuration * * $Log$ + * Revision 1.3 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.2 2002/05/07 03:16:45 theoddone33 * The Great Newline Fix * @@ -415,7 +420,9 @@ int HC_select_all = 0; // Module Globals ////////////////////////////////////////////////////////////////////////////// +#ifndef PLAT_UNIX #pragma warning(disable:4710) +#endif char *Hud_config_fname[GR_NUM_RESOLUTIONS] = { "HUDConfig", @@ -533,7 +540,9 @@ struct HC_gauge_region HC_gauge_regions[GR_NUM_RESOLUTIONS][NUM_HUD_GAUGES] = } }; +#ifndef PLAT_UNIX #pragma warning(default:4710) +#endif int HC_gauge_description_coords[GR_NUM_RESOLUTIONS][3] = { { // GR_640 @@ -652,7 +661,9 @@ char *HC_gauge_descriptions(int n) #define HCB_RESET 18 #define HCB_ACCEPT 19 +#ifndef PLAT_UNIX #pragma warning(disable : 4710) +#endif ui_button_info HC_buttons[GR_NUM_RESOLUTIONS][NUM_HUD_BUTTONS] = { { // GR_640 diff --git a/src/mission/missionbriefcommon.cpp b/src/mission/missionbriefcommon.cpp index bd7ef81..2a4772e 100644 --- a/src/mission/missionbriefcommon.cpp +++ b/src/mission/missionbriefcommon.cpp @@ -7,6 +7,11 @@ * C module for briefing code common to FreeSpace and FRED * * $Log$ + * Revision 1.3 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.2 2002/05/07 03:16:46 theoddone33 * The Great Newline Fix * @@ -878,8 +883,9 @@ void brief_init_map() Num_fade_icons=0; } - +#ifndef PLAT_UNIX #pragma optimize("", off) +#endif // render fade-out anim frame static int Fade_frame_count[128]; // for debug @@ -1192,7 +1198,9 @@ void brief_render_icon(int stage_num, int icon_num, float frametime, int selecte } // end if vertex is projected } +#ifndef PLAT_UNIX #pragma optimize("", on) +#endif // ------------------------------------------------------------------------------------- // brief_render_icons() diff --git a/src/mission/missionhotkey.cpp b/src/mission/missionhotkey.cpp index c3db15b..bef2e25 100644 --- a/src/mission/missionhotkey.cpp +++ b/src/mission/missionhotkey.cpp @@ -7,6 +7,11 @@ * C module for the Hotkey selection screen * * $Log$ + * Revision 1.3 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.2 2002/05/07 03:16:46 theoddone33 * The Great Newline Fix * @@ -333,9 +338,11 @@ static int Hotkey_ship_x[GR_NUM_RESOLUTIONS] = { 448 // GR_1024 }; +#ifndef PLAT_UNIX // pragma pair put into place because of compiler warnings about being unable to inline // the constructor function of the hotkey_buttons set. #pragma warning(disable: 4710) +#endif struct hotkey_buttons { char *filename; @@ -377,7 +384,10 @@ static hotkey_buttons Buttons[GR_NUM_RESOLUTIONS][NUM_BUTTONS] = { } //XSTR:ON }; + +#ifndef PLAT_UNIX #pragma warning(default: 4710) +#endif #define HOTKEY_NUM_TEXT 6 static UI_XSTR Hotkey_text[GR_NUM_RESOLUTIONS][HOTKEY_NUM_TEXT] = { diff --git a/src/missionui/missionscreencommon.cpp b/src/missionui/missionscreencommon.cpp index 4bfeb9c..fe455dc 100644 --- a/src/missionui/missionscreencommon.cpp +++ b/src/missionui/missionscreencommon.cpp @@ -5,6 +5,11 @@ * $Author$ * * $Log$ + * Revision 1.3 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.2 2002/05/07 03:16:46 theoddone33 * The Great Newline Fix * @@ -933,7 +938,7 @@ void common_check_keys(int k) case KEY_ESC: { if ( Current_screen == ON_BRIEFING_SELECT ) { - if ( brief_get_closeup_icon() != NULL ) { + if ( brief_get_closeup_icon() != 0 ) { brief_turn_off_closeup_icon(); break; } diff --git a/src/model/modelread.cpp b/src/model/modelread.cpp index bf83090..c63dd26 100644 --- a/src/model/modelread.cpp +++ b/src/model/modelread.cpp @@ -7,6 +7,11 @@ * file which reads and deciphers POF information * * $Log$ + * Revision 1.3 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.2 2002/05/07 03:16:47 theoddone33 * The Great Newline Fix * @@ -2622,8 +2627,10 @@ void model_get_rotating_submodel_axis(vector *model_axis, vector *world_axis, in // Does stepped rotation of a submodel +#ifndef PLAT_UNIX #pragma warning ( push ) #pragma warning (disable : 4701) +#endif void submodel_stepped_rotate(model_subsystem *psub, submodel_instance_info *sii) { Assert(psub->flags & MSS_FLAG_STEPPED_ROTATE); @@ -2715,8 +2722,9 @@ void submodel_stepped_rotate(model_subsystem *psub, submodel_instance_info *sii) sii->cur_turn_rate = 0.0f; } } +#ifndef PLAT_UNIX #pragma warning ( pop ) - +#endif // Rotates the angle of a submodel. Use this so the right unlocked axis // gets stuffed. diff --git a/src/network/multi_xfer.cpp b/src/network/multi_xfer.cpp index 9c562ef..2ecfba0 100644 --- a/src/network/multi_xfer.cpp +++ b/src/network/multi_xfer.cpp @@ -5,6 +5,11 @@ * $Author$ * * $Log$ + * Revision 1.4 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.3 2002/05/26 20:22:48 theoddone33 * Most of network/ works * @@ -1202,7 +1207,7 @@ void multi_xfer_send_next(xfer_entry *xe) ADD_DATA(data_size); // copy in the data - if(cfread(data+packet_size,1,(int)data_size,xe->file) == NULL){ + if(cfread(data+packet_size,1,(int)data_size,xe->file) == 0){ // send a nack to the receiver multi_xfer_send_nak(xe->file_socket, xe->sig); diff --git a/src/network/multiui.cpp b/src/network/multiui.cpp index 4007cbf..25d9f3e 100644 --- a/src/network/multiui.cpp +++ b/src/network/multiui.cpp @@ -7,6 +7,11 @@ * C file for all the UI controls of the mulitiplayer screens * * $Log$ + * Revision 1.4 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.3 2002/05/26 20:49:54 theoddone33 * More progress * @@ -5457,7 +5462,7 @@ int multi_create_ok_to_commit() if(Net_players[idx].player != NULL){ sprintf(err_string, "%s %s", Net_players[idx].player->callsign, XSTR("has hacked tables/data", 1271)); } else { - sprintf(err_string, "%s", Net_players[idx].player->callsign, XSTR("has hacked tables/data", 1271)); + sprintf(err_string, "somebody %s", XSTR("has hacked tables/data", 1271)); } send_game_chat_packet(Net_player, err_string, MULTI_MSG_ALL, NULL, NULL, 1); } diff --git a/src/object/collideshipship.cpp b/src/object/collideshipship.cpp index ae22a08..37099a1 100644 --- a/src/object/collideshipship.cpp +++ b/src/object/collideshipship.cpp @@ -7,6 +7,11 @@ * Routines to detect collisions and do physics, damage, etc for ships and ships * * $Log$ + * Revision 1.3 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.2 2002/05/07 03:16:48 theoddone33 * The Great Newline Fix * @@ -1393,7 +1398,7 @@ void mcp_1(object *player_objp, object *planet_objp) // Hack: Just checking first six letters of name. int is_planet(object *objp) { - return (strnicmp(Ships[objp->instance].ship_name, NOX("planet"), 6) == NULL); + return (strnicmp(Ships[objp->instance].ship_name, NOX("planet"), 6) == 0); } diff --git a/src/ship/aibig.cpp b/src/ship/aibig.cpp index a78d7aa..cb0fd24 100644 --- a/src/ship/aibig.cpp +++ b/src/ship/aibig.cpp @@ -7,6 +7,11 @@ * C module for AI code related to large ships * * $Log$ + * Revision 1.3 2002/06/01 07:12:33 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.2 2002/05/07 03:16:51 theoddone33 * The Great Newline Fix * @@ -358,8 +363,10 @@ #include "shiphit.h" #include "missionparse.h" +#ifndef PLAT_UNIX #pragma optimize("", off) #pragma auto_inline(off) +#endif #define SCAN_FIGHTERS_INTERVAL 2000 // how often an AI fighter/bomber should scan for enemy fighter/bombers // if sitting still and pounding on a big ship. If enemy fighters are diff --git a/src/ship/aicode.cpp b/src/ship/aicode.cpp index 3cffd89..063bd9b 100644 --- a/src/ship/aicode.cpp +++ b/src/ship/aicode.cpp @@ -7,6 +7,11 @@ * AI code that does interesting stuff * * $Log$ + * Revision 1.3 2002/06/01 07:12:34 relnev + * a few NDEBUG updates. + * + * removed a few warnings. + * * Revision 1.2 2002/05/03 13:34:33 theoddone33 * More stuff compiles * @@ -443,8 +448,10 @@ #include "awacs.h" #include "fvi.h" +#ifndef PLAT_UNIX #pragma optimize("", off) #pragma auto_inline(off) +#endif #define UNINITIALIZED_VALUE -99999.9f -- 2.39.2