From 715485a0de0655c91f6c24edb2b15c7abeb00965 Mon Sep 17 00:00:00 2001 From: tecodev Date: Tue, 30 Dec 2008 13:27:20 +0000 Subject: [PATCH] * as/link/hc08/lkelf.c, as/link/lkaomf51.c, as/link/lklibr.c, as/link/z80/lkgb.c, debugger/mcs51/cmd.c, sim/ucsim/utils.cc, src/SDCCasm.c, support/Util/dbuf_string.c, support/cpp/c-ppoutput.c, support/cpp/libcpp/lex.c, support/cpp/libcpp/macro.c, support/librarian/sdcclib.c, support/makebin/makebin.c: partially revert changes from r5293..r5295 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5310 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 9 +++++++++ as/link/hc08/lkelf.c | 9 ++------- as/link/lkaomf51.c | 9 ++------- as/link/lklibr.c | 36 ++++++++++-------------------------- as/link/z80/lkgb.c | 8 ++------ debugger/mcs51/cmd.c | 10 ++-------- sim/ucsim/utils.cc | 6 ++---- src/SDCCasm.c | 4 +--- support/Util/dbuf_string.c | 5 +---- support/cpp/c-ppoutput.c | 5 +---- support/cpp/libcpp/lex.c | 8 ++------ support/cpp/libcpp/macro.c | 4 ++-- support/librarian/sdcclib.c | 9 --------- support/makebin/makebin.c | 13 ++++--------- 14 files changed, 40 insertions(+), 95 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1da4128..34d809ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-12-30 Raphael Neider + + * as/link/hc08/lkelf.c, as/link/lkaomf51.c, as/link/lklibr.c, + as/link/z80/lkgb.c, debugger/mcs51/cmd.c, sim/ucsim/utils.cc, + src/SDCCasm.c, support/Util/dbuf_string.c, support/cpp/c-ppoutput.c, + support/cpp/libcpp/lex.c, support/cpp/libcpp/macro.c, + support/librarian/sdcclib.c, support/makebin/makebin.c: + partially revert changes from r5293..r5295 + 2008-12-29 Philipp Klaus Krause * src/z80/peeph-z80.def: diff --git a/as/link/hc08/lkelf.c b/as/link/hc08/lkelf.c index d37bfa51..3cc602fd 100644 --- a/as/link/hc08/lkelf.c +++ b/as/link/hc08/lkelf.c @@ -18,7 +18,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -------------------------------------------------------------------------*/ -#include #include #include #include @@ -481,7 +480,6 @@ elfGenerateAbs (struct area *ap, listHeader * segments, listHeader * sections) Elf32_Word size; Elf32_Phdr * phdrp; Elf32_Shdr * shdrp; - size_t res; if (!ap->a_image) { @@ -539,8 +537,7 @@ elfGenerateAbs (struct area *ap, listHeader * segments, listHeader * sections) shdrp->sh_entsize = 0; listAdd (sections, shdrp); - res = fwrite (&ap->a_image[addr-ap->a_addr], 1, size, ofp); - assert(res == size); + fwrite (&ap->a_image[addr-ap->a_addr], 1, size, ofp); } } @@ -552,7 +549,6 @@ elfGenerateRel (struct area *ap, listHeader * segments, listHeader * sections) { Elf32_Phdr * phdrp; Elf32_Shdr * shdrp; - size_t res; if (!ap->a_image) { @@ -594,8 +590,7 @@ elfGenerateRel (struct area *ap, listHeader * segments, listHeader * sections) shdrp->sh_entsize = 0; listAdd (sections, shdrp); - res = fwrite (ap->a_image, 1, ap->a_size, ofp); - assert(res == ap->a_size); + fwrite (ap->a_image, 1, ap->a_size, ofp); } /*--------------------------------------------------------------------------*/ diff --git a/as/link/lkaomf51.c b/as/link/lkaomf51.c index 7a52f4ef..80284782 100644 --- a/as/link/lkaomf51.c +++ b/as/link/lkaomf51.c @@ -18,7 +18,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -------------------------------------------------------------------------*/ -#include #include #include #include @@ -200,10 +199,8 @@ void FreeAll(void) void OutputByte(unsigned char value) { - size_t res; GlobalChkSum+=value; - res = fwrite( &value, 1, 1, aomf51out ); - assert(res == 1); + fwrite( &value, 1, 1, aomf51out ); } void OutputWord(int value) @@ -570,9 +567,7 @@ void CollectInfoFromCDB(void) CurrentModule=0; /*Set the active module as the first one*/ while(!feof(CDBin)) { - char *res; - res = fgets(buff, sizeof(buff)-1, CDBin); - assert(res == buff); + fgets(buff, sizeof(buff)-1, CDBin); if(!feof(CDBin)) switch(buff[0]) { diff --git a/as/link/lklibr.c b/as/link/lklibr.c index b56340a9..31d2e897 100644 --- a/as/link/lklibr.c +++ b/as/link/lklibr.c @@ -22,7 +22,6 @@ #define EQ(A,B) !strcmp((A),(B)) #define MAXLINE 254 /*when using fgets*/ -#include #include #include #include @@ -393,7 +392,6 @@ void LoadRel(char * libfname, FILE * libfp, char * ModName) { char str[NINPUT+2]; int state=0; - char *res; while (fgets(str, NINPUT, libfp) != NULL) { @@ -404,8 +402,7 @@ void LoadRel(char * libfname, FILE * libfp, char * ModName) case 0: if(EQ(str, "")) { - res = fgets(str, NINPUT, libfp); - assert(res == str); + fgets(str, NINPUT, libfp); str[NINPUT+1] = '\0'; chop_crlf(str); if(EQ(str, ModName)) state=1; @@ -441,9 +438,7 @@ int LoadAdb(FILE * libfp) while (fgets(str, MAXLINE, libfp) != NULL) { - if (NINPUT < MAXLINE) - str[NINPUT+1] = '\0'; - + str[NINPUT+1] = '\0'; chop_crlf(str); switch(state) { @@ -472,13 +467,11 @@ int SdccLib(char * PathLib, FILE * libfp, char * DirLib, char * SymName) char FLine[MAXLINE+1]; int state=0; long IndexOffset=0, FileOffset; - char *res; while(!feof(libfp)) { FLine[0]=0; - res = fgets(FLine, MAXLINE, libfp); - assert(res == FLine); + fgets(FLine, MAXLINE, libfp); chop_crlf(FLine); switch(state) @@ -488,8 +481,7 @@ int SdccLib(char * PathLib, FILE * libfp, char * DirLib, char * SymName) { /*The next line has the size of the index*/ FLine[0]=0; - res = fgets(FLine, MAXLINE, libfp); - assert(res == FLine); + fgets(FLine, MAXLINE, libfp); chop_crlf(FLine); IndexOffset=atol(FLine); state=1; @@ -501,8 +493,7 @@ int SdccLib(char * PathLib, FILE * libfp, char * DirLib, char * SymName) /*The next line has the name of the module and the offset of the corresponding embedded file in the library*/ FLine[0]=0; - res = fgets(FLine, MAXLINE, libfp); - assert(res == FLine); + fgets(FLine, MAXLINE, libfp); chop_crlf(FLine); sscanf(FLine, "%s %ld", ModName, &FileOffset); state=2; @@ -747,11 +738,8 @@ int fndsym( char *name ) for(j=0; absPath1[j]!=0; j++) absPath1[j]=tolower((unsigned char)absPath1[j]); for(j=0; absPath2[j]!=0; j++) absPath2[j]=tolower((unsigned char)absPath2[j]); #else - char *res; - res = realpath(FirstFound->libspc, absPath1); - assert(res == absPath1); - res = realpath(ThisLibr->libspc, absPath2); - assert(res == absPath2); + realpath(FirstFound->libspc, absPath1); + realpath(ThisLibr->libspc, absPath2); #endif if( !( EQ(absPath1, absPath2) && EQ(FirstFound->relfil, ThisLibr->relfil) ) ) { @@ -783,13 +771,11 @@ pmlibraryfile buildlibraryindex_SdccLib(char * PathLib, FILE * libfp, char * Dir int state=0; long IndexOffset=0, FileOffset; pmlibrarysymbol ThisSym = NULL; - char *res; while(!feof(libfp)) { FLine[0]=0; - res = fgets(FLine, MAXLINE, libfp); - assert(res == FLine); + fgets(FLine, MAXLINE, libfp); chop_crlf(FLine); switch(state) @@ -799,8 +785,7 @@ pmlibraryfile buildlibraryindex_SdccLib(char * PathLib, FILE * libfp, char * Dir { /*The next line has the size of the index*/ FLine[0]=0; - res = fgets(FLine, MAXLINE, libfp); - assert(res == FLine); + fgets(FLine, MAXLINE, libfp); chop_crlf(FLine); IndexOffset=atol(FLine); state=1; @@ -812,8 +797,7 @@ pmlibraryfile buildlibraryindex_SdccLib(char * PathLib, FILE * libfp, char * Dir /*The next line has the name of the module and the offset of the corresponding embedded file in the library*/ FLine[0]=0; - res = fgets(FLine, MAXLINE, libfp); - assert(res == FLine); + fgets(FLine, MAXLINE, libfp); chop_crlf(FLine); sscanf(FLine, "%s %ld", ModName, &FileOffset); state=2; diff --git a/as/link/z80/lkgb.c b/as/link/z80/lkgb.c index fca7cd1e..55ae41ff 100644 --- a/as/link/z80/lkgb.c +++ b/as/link/z80/lkgb.c @@ -6,7 +6,6 @@ #ifdef GAMEBOY -#include #include #include #include @@ -183,11 +182,8 @@ VOID gb(int in) cart[0x014E/SEGSIZE][0x014E%SEGSIZE] = (unsigned char)((chk>>8)&0xFF); cart[0x014F/SEGSIZE][0x014F%SEGSIZE] = (unsigned char)(chk&0xFF); - for(i = 0; i < NBSEG; i++) { - size_t res; - res = fwrite(cart[i], 1, SEGSIZE, ofp); - assert(res == SEGSIZE); - } + for(i = 0; i < NBSEG; i++) + fwrite(cart[i], 1, SEGSIZE, ofp); } } diff --git a/debugger/mcs51/cmd.c b/debugger/mcs51/cmd.c index 332ee2ed..4bfc16fd 100644 --- a/debugger/mcs51/cmd.c +++ b/debugger/mcs51/cmd.c @@ -21,7 +21,6 @@ what you give them. Help stamp out software-hoarding! -------------------------------------------------------------------------*/ -#include #include "sdcdb.h" #include "symtab.h" #include "simi.h" @@ -1410,12 +1409,9 @@ int cmdDelUserBp (char *s, context *cctxt) if (!*s ) { if (userBpPresent) { char buffer[10]; - char *res; - fprintf (stdout,"Delete all breakpoints? (y or n) "); fflush(stdout); - res = fgets(buffer,sizeof(buffer),stdin); - assert(res == &buffer[0]); + fgets(buffer,sizeof(buffer),stdin); if (toupper(buffer[0]) == 'Y') deleteUSERbp(-1); } @@ -1636,15 +1632,13 @@ int cmdRun (char *s, context *cctxt) resetHitCount(); simGo(0); } else { - char *res; fprintf(stdout, "The program being debugged has been started already.\n"); fprintf(stdout,"Start it from the beginning? (y or n) "); fflush(stdout); - res = fgets(buff,sizeof(buff),stdin); - assert(res == &buff[0]); + fgets(buff,sizeof(buff),stdin); if (toupper(buff[0]) == 'Y') { simReset(); resetHitCount(); diff --git a/sim/ucsim/utils.cc b/sim/ucsim/utils.cc index ba5f57c7..eb648e7f 100644 --- a/sim/ucsim/utils.cc +++ b/sim/ucsim/utils.cc @@ -116,14 +116,12 @@ format_string(const char *format, ...) va_start(ap, format); #ifdef HAVE_VASPRINTF - int res; char *msg= NULL; - res = vasprintf(&msg, format, ap); + vasprintf(&msg, format, ap); return(msg); #elif defined HAVE_VSNPRINTF - int res; char *msg= (char*)malloc(80*25); - res = vsnprintf(msg, 80*25, format, ap); + vsnprintf(msg, 80*25, format, ap); return(msg); #elif defined HAVE__VSNPRINTF char *msg= (char*)malloc(80*25); diff --git a/src/SDCCasm.c b/src/SDCCasm.c index 383c40a4..08d37303 100644 --- a/src/SDCCasm.c +++ b/src/SDCCasm.c @@ -212,7 +212,6 @@ tfprintf (FILE *fp, const char *szFormat, ...) va_list ap; struct dbuf_s dbuf; size_t len; - size_t res; dbuf_init (&dbuf, INITIAL_INLINEASM); @@ -221,8 +220,7 @@ tfprintf (FILE *fp, const char *szFormat, ...) va_end (ap); len = dbuf_get_length (&dbuf); - res = fwrite(dbuf_get_buf (&dbuf), 1, len, fp); - assert(res == len); + fwrite(dbuf_get_buf (&dbuf), 1, len, fp); dbuf_destroy (&dbuf); } diff --git a/support/Util/dbuf_string.c b/support/Util/dbuf_string.c index 61e125e4..c2de470d 100644 --- a/support/Util/dbuf_string.c +++ b/support/Util/dbuf_string.c @@ -282,10 +282,7 @@ dbuf_chomp (struct dbuf_s *dbuf) void dbuf_write (struct dbuf_s *dbuf, FILE *dest) { - size_t res; - size_t len = dbuf_get_length (dbuf); - res = fwrite (dbuf_get_buf (dbuf), 1, len, dest); - assert(res == len); + fwrite (dbuf_get_buf (dbuf), 1, dbuf_get_length (dbuf), dest); } diff --git a/support/cpp/c-ppoutput.c b/support/cpp/c-ppoutput.c index 812c91ad..90855835 100644 --- a/support/cpp/c-ppoutput.c +++ b/support/cpp/c-ppoutput.c @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include #include "config.h" #include "system.h" #include "cpplib.h" @@ -194,11 +193,9 @@ scan_translation_unit_trad (cpp_reader *pfile) { while (_cpp_read_logical_line_trad (pfile)) { - size_t res; size_t len = pfile->out.cur - pfile->out.base; maybe_print_line (pfile->out.first_line); - res = fwrite (pfile->out.base, 1, len, print.outf); - assert(res == len); + fwrite (pfile->out.base, 1, len, print.outf); print.printed = 1; if (!CPP_OPTION (pfile, discard_comments)) account_for_newlines (pfile->out.base, len); diff --git a/support/cpp/libcpp/lex.c b/support/cpp/libcpp/lex.c index 7c7c03a2..ab04177e 100644 --- a/support/cpp/libcpp/lex.c +++ b/support/cpp/libcpp/lex.c @@ -1782,8 +1782,6 @@ cpp_type2name (enum cpp_ttype type) void cpp_output_token (const cpp_token *token, FILE *fp) { - size_t res; - switch (TOKEN_SPELL (token)) { case SPELL_OPERATOR: @@ -1817,8 +1815,7 @@ cpp_output_token (const cpp_token *token, FILE *fp) { unsigned char buffer[10]; i += utf8_to_ucn (buffer, name + i) - 1; - res = fwrite (buffer, 1, 10, fp); - assert (10 == res); + fwrite (buffer, 1, 10, fp); } else fputc (NODE_NAME (token->val.node)[i], fp); @@ -1826,8 +1823,7 @@ cpp_output_token (const cpp_token *token, FILE *fp) break; case SPELL_LITERAL: - res = fwrite (token->val.str.text, 1, token->val.str.len, fp); - assert (token->val.str.len == res); + fwrite (token->val.str.text, 1, token->val.str.len, fp); break; case SPELL_NONE: diff --git a/support/cpp/libcpp/macro.c b/support/cpp/libcpp/macro.c index 26e5f03a..764d5e3a 100644 --- a/support/cpp/libcpp/macro.c +++ b/support/cpp/libcpp/macro.c @@ -1657,7 +1657,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro) function-like macros, but not at the end. */ if (following_paste_op) { - cpp_error (pfile, CPP_DL_ERROR, "%s", paste_op_error_msg); + cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg); return false; } break; @@ -1670,7 +1670,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro) function-like macros, but not at the beginning. */ if (macro->count == 1) { - cpp_error (pfile, CPP_DL_ERROR, "%s", paste_op_error_msg); + cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg); return false; } diff --git a/support/librarian/sdcclib.c b/support/librarian/sdcclib.c index 5ab4c4a5..8537cba3 100644 --- a/support/librarian/sdcclib.c +++ b/support/librarian/sdcclib.c @@ -48,15 +48,6 @@ int NumRelFiles=0; #define EQ(A,B) !strcmp((A),(B)) #define NEQ(A,B) strcmp((A),(B)) -#if 1 -#include - -#define system(CMD) do { \ - int __res4568 = system(CMD); \ - assert(-1 != __res4568); \ -} while (0) -#endif - int action=OPT_NONE; FILE *lib, *newlib, *rel, *adb, *libindex; char FLine[MAXLINE+1]; diff --git a/support/makebin/makebin.c b/support/makebin/makebin.c index b6acaf4c..83d4ec69 100644 --- a/support/makebin/makebin.c +++ b/support/makebin/makebin.c @@ -1,6 +1,5 @@ /** @name makebin - turn a .ihx file into a binary image. */ -#include #include #include #include @@ -49,7 +48,6 @@ int main(int argc, char **argv) { int size = 32768, pack = 0, real_size = 0; BYTE *rom; - size_t res; char line[256]; char *p; @@ -114,13 +112,10 @@ int main(int argc, char **argv) real_size = addr; } - if (pack) { - res = fwrite(rom, 1, real_size, stdout); - assert(res == real_size); - } else { - res = fwrite(rom, 1, size, stdout); - assert(res == size); - } + if (pack) + fwrite(rom, 1, real_size, stdout); + else + fwrite(rom, 1, size, stdout); return 0; } -- 2.30.2