Clean up some warnings by making sis_fatal_error a macro, and let it take an

argument of a message to print.  Make some assert(0)s use sis_fatal_error.
This commit is contained in:
Eric Anholt
2004-05-24 20:48:27 +00:00
parent 8c805fed0f
commit bbd557fc53
7 changed files with 16 additions and 28 deletions
+2 -8
View File
@@ -151,10 +151,7 @@ sisAllocZStencilBuffer( sisContextPtr smesa )
addr = sisAllocFB( smesa, totalBytes, &smesa->zbFree );
if (addr == NULL)
{
fprintf (stderr, "SIS driver : out of video memory\n");
sis_fatal_error ();
}
sis_fatal_error("Failure to allocate Z buffer.\n");
if (SIS_VERBOSE & VERBOSE_SIS_BUFFER) {
fprintf(stderr, "sis_alloc_z_stencil_buffer: addr=%p\n", addr);
@@ -210,10 +207,7 @@ sisAllocBackbuffer( sisContextPtr smesa )
/* Fixme: unique context alloc/free back-buffer? */
addr = sisAllocFB( smesa, size, &smesa->bbFree );
if (addr == NULL)
{
fprintf (stderr, "SIS driver : out of video memory\n");
sis_fatal_error ();
}
sis_fatal_error("Failure to allocate back buffer.\n");
addr = (char *)ALIGNMENT( (unsigned long)addr, DRAW_BUFFER_HW_ALIGNMENT );
+2 -2
View File
@@ -66,7 +66,7 @@ set_color_pattern( sisContextPtr smesa, GLubyte red, GLubyte green,
smesa->clearColorPattern |= smesa->clearColorPattern << 16;
break;
default:
assert(0);
sis_fatal_error("Bad dst color format\n");
}
}
@@ -89,7 +89,7 @@ sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil )
zPattern = FLOAT_TO_UINT(z);
break;
default:
assert(0);
sis_fatal_error("Bad Z format\n");
}
smesa->clearZStencilPattern = zPattern;
}
+1 -9
View File
@@ -182,7 +182,7 @@ sisCreateContext( const __GLcontextModes *glVisual,
smesa->colorFormat = DST_FORMAT_RGB_565;
break;
default:
assert (0);
sis_fatal_error("Bad bytesPerPixel.\n");
}
/* Parse configuration files */
@@ -508,11 +508,3 @@ sis_update_texture_state (sisContextPtr smesa)
smesa->GlobalFlag &= ~GFLAG_TEXTURE_STATES;
}
void
sis_fatal_error (void)
{
/* free video memory, or the framebuffer device will do it automatically */
fprintf(stderr, "Fatal errors in sis_dri.so\n");
exit (-1);
}
+6 -2
View File
@@ -395,6 +395,12 @@ struct sis_context
*(GLint *)(GET_IOBase(smesa) + 0x8b60) = (GLint)(-1); \
}
#define sis_fatal_error(msg) \
do { \
fprintf(stderr, "[%s:%d]: %s", __FILE__, __LINE__, msg); \
exit(-1); \
} while (0)
/* Lock required */
#define mWait3DCmdQueue(wLen) \
/* Update the mirrored queue pointer if it doesn't indicate enough space */ \
@@ -431,6 +437,4 @@ void WaitingFor3dIdle(sisContextPtr smesa, int wLen);
extern void sis_update_texture_state( sisContextPtr smesa );
extern void sis_update_render_state( sisContextPtr smesa );
void sis_fatal_error (void);
#endif
+1 -1
View File
@@ -146,7 +146,7 @@ sisUpdateBufferSize( sisContextPtr smesa )
z_depth = 4;
break;
default:
assert( 0 );
sis_fatal_error("Bad Z format\n");
}
current->hwZ &= ~MASK_ZBufferPitch;
+1 -1
View File
@@ -294,7 +294,7 @@ sisDDInitSpanFuncs( GLcontext *ctx )
swdd->ReadRGBAPixels = sisReadRGBAPixels_8888;
break;
default:
assert(0);
sis_fatal_error("Bad bytesPerPixel.\n");
break;
}
+3 -5
View File
@@ -85,7 +85,7 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level,
t->hwformat = TEXEL_ARGB_0888_32;
break;
default:
assert(0);
sis_fatal_error("Bad texture format.\n");
}
}
assert(t->format == image->Format);
@@ -96,10 +96,8 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level,
addr = sisAllocFB( smesa, size, &t->image[level].handle );
if (addr == NULL) {
addr = sisAllocAGP( smesa, size, &t->image[level].handle );
if (addr == NULL) {
fprintf (stderr, "SIS driver : out of video/agp memory\n");
sis_fatal_error();
}
if (addr == NULL)
sis_fatal_error("Failure to allocate texture memory.\n");
t->image[level].memType = AGP_TYPE;
}
else