- on win32 in some configurations, code within an assert is completely

removed!  I used this trick sometimes to check that a function returned
  what I expected, like assert (func () == 0), but this caused the
  func() to never get called.  Oops.
This commit is contained in:
Bryce Denney 2001-10-07 18:16:01 +00:00
parent c90e548019
commit d9bde38f33
2 changed files with 16 additions and 10 deletions

View File

@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////
// $Id: control.cc,v 1.35 2001-10-07 00:35:35 bdenney Exp $
// $Id: control.cc,v 1.36 2001-10-07 18:16:01 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
/*
* gui/control.cc
* $Id: control.cc,v 1.35 2001-10-07 00:35:35 bdenney Exp $
* $Id: control.cc,v 1.36 2001-10-07 18:16:01 bdenney Exp $
*
* This is code for a text-mode control panel. Note that this file
* does NOT include bochs.h. Instead, it does all of its contact with
@ -421,8 +421,9 @@ int bx_control_panel (int menu)
case BX_CPANEL_START_OPTS:
{
char prompt[CPANEL_PATH_LEN];
char oldpath[CPANEL_PATH_LEN];
assert (SIM->get_log_file (oldpath, CPANEL_PATH_LEN) >= 0);
char oldpath[CPANEL_PATH_LEN];
int retval = SIM->get_log_file (oldpath, CPANEL_PATH_LEN);
assert (retval >= 0);
sprintf (prompt, startup_options_prompt, oldpath);
if (ask_uint (prompt, 0, 9, 0, &choice, 10) < 0) return -1;
switch (choice) {
@ -594,8 +595,9 @@ int control_panel_notify_callback (int code)
case NOTIFY_CODE_LOGMSG:
{
int level;
char prefix[512], msg[512];
assert (SIM->log_msg_2 (prefix, &level, msg, sizeof(msg)) >= 0);
char prefix[512], msg[512];
int retval = SIM->log_msg_2 (prefix, &level, msg, sizeof(msg)) >= 0;
assert (retval);
fprintf (stderr, "========================================================================\n");
fprintf (stderr, "Event type: %s\n", SIM->get_log_level_name (level));
fprintf (stderr, "Device: %s\n", prefix);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.73 2001-10-07 01:07:59 bdenney Exp $
// $Id: main.cc,v 1.74 2001-10-07 18:16:01 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -749,9 +749,13 @@ static void setupWorkingDirectory (char *path)
c--;
*c = '\0'; /* cut off last part (binary name) */
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */
/* chdir to the binary app's parent */
int n = chdir (parentdir);
if (n) BX_PANIC (("failed to change dir to parent"));
/* chdir to the .app's parent */
int n = chdir ("../../../");
if (n) BX_PANIC (("failed to change to ../../.."));
}
#endif