1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-18 08:35:22 +00:00

Valid compilation when CLEAN is set.

Use assert() and robust fallback instead of exit() to handle 'impossible' cases.
This commit is contained in:
Renaud 2015-02-15 14:41:35 +08:00
parent 115d9babae
commit c10c550bdd
4 changed files with 9 additions and 6 deletions

View File

@ -153,7 +153,7 @@ execute.o: execute.c execute.h estruct.h bind.h random.h display.h file.h \
buffer.h crypt.h line.h retcode.h utf8.h mlout.h window.h defines.h buffer.h crypt.h line.h retcode.h utf8.h mlout.h window.h defines.h
file.o: file.c file.h buffer.h crypt.h line.h retcode.h utf8.h defines.h \ file.o: file.c file.h buffer.h crypt.h line.h retcode.h utf8.h defines.h \
estruct.h execute.h fileio.h input.h bind.h lock.h mlout.h window.h estruct.h execute.h fileio.h input.h bind.h lock.h mlout.h window.h
fileio.o: fileio.c fileio.h crypt.h retcode.h defines.h fileio.o: fileio.c fileio.h crypt.h retcode.h defines.h utf8.h
flook.o: flook.c flook.h retcode.h defines.h fileio.h crypt.h flook.o: flook.c flook.h retcode.h defines.h fileio.h crypt.h
input.o: input.c input.h bind.h estruct.h bindable.h display.h exec.h \ input.o: input.c input.h bind.h estruct.h bindable.h display.h exec.h \
retcode.h names.h terminal.h defines.h utf8.h wrapper.h retcode.h names.h terminal.h defines.h utf8.h wrapper.h

View File

@ -297,7 +297,7 @@ void release( void *ptr) ;
#if CLEAN #if CLEAN
#define exit(a) cexit(a) #define exit(a) cexit(a)
int cexit( int status) ; void cexit( int status) ;
#endif #endif
#endif #endif

8
eval.c
View File

@ -9,6 +9,7 @@
* modified by Petri Kutvonen * modified by Petri Kutvonen
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -587,7 +588,8 @@ static char *gtfun( char *fname) {
retstr = xlat( arg1, arg2, argx) ; retstr = xlat( arg1, arg2, argx) ;
break ; break ;
default: default:
exit(-11); /* never should get here */ assert( FALSE) ; /* never should get here */
retstr = errorm ;
} }
if( arg2) if( arg2)
@ -748,7 +750,9 @@ static char *gtenv( char *vname) {
return ltos(0); return ltos(0);
#endif #endif
} }
exit(-12); /* again, we should never get here */
assert( FALSE) ; /* again, we should never get here */
return errorm ;
} }
/* /*

3
main.c
View File

@ -592,8 +592,7 @@ static void dspram( void)
* *
* int status; return status of emacs * int status; return status of emacs
*/ */
int cexit(int status) void cexit( int status) {
{
struct buffer *bp; /* buffer list pointer */ struct buffer *bp; /* buffer list pointer */
struct window *wp; /* window list pointer */ struct window *wp; /* window list pointer */
struct window *tp; /* temporary window pointer */ struct window *tp; /* temporary window pointer */