From: MaartenBrock Date: Mon, 12 Jun 2006 21:22:45 +0000 (+0000) Subject: * link/z80/lkgb.c, X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5db7b152dddfeac2395417a253993f63e21e0fe5;p=fw%2Fsdcc * link/z80/lkgb.c, * link/z80/lkgg.c, * src/pic16/gen.c, * src/pic16/main.c, * src/pic16/pcode.c, * src/pic/main.c, * src/pic/pcoderegs.c, * src/SDCCicode.c, * src/SDCCmain.c, * src/SDCCsymt.c: replaced all exit(-1) by exit(EXIT_FAILURE) to fix bug 1504689 on minGW git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4222 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index ca9b1fe3..84f92289 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-06-12 Maarten Brock + + * link/z80/lkgb.c, + * link/z80/lkgg.c, + * src/pic16/gen.c, + * src/pic16/main.c, + * src/pic16/pcode.c, + * src/pic/main.c, + * src/pic/pcoderegs.c, + * src/SDCCicode.c, + * src/SDCCmain.c, + * src/SDCCsymt.c: replaced all exit(-1) by exit(EXIT_FAILURE) to fix + bug 1504689 on minGW + 2006-06-12 Frieder Ferlemann * device/lib/printf_tiny.c: fixed bug #1465675 (%x format specifier) diff --git a/link/z80/lkgb.c b/link/z80/lkgb.c index 63af393f..55ae41ff 100644 --- a/link/z80/lkgb.c +++ b/link/z80/lkgb.c @@ -45,7 +45,7 @@ VOID gb(int in) for(i = 0; i < NBSEG; i++) { if((cart[i] = malloc(SEGSIZE)) == NULL) { fprintf(stderr, "ERROR: can't allocate %dth segment of memory (%d bytes)\n", i, (int)SEGSIZE); - exit(-1); + exit(EXIT_FAILURE); } memset(cart[i], FILLVALUE, SEGSIZE); } @@ -61,19 +61,19 @@ VOID gb(int in) /* Perform some validity checks */ if(pos >= ROMSIZE) { fprintf(stderr, "ERROR: address overflow (addr %lx >= %lx)\n", pos, ROMSIZE); - exit(-1); + exit(EXIT_FAILURE); } if(current_rom_bank >= nb_rom_banks) { fprintf(stderr, "ERROR: bank overflow (addr %x > %x)\n", current_rom_bank, nb_rom_banks); - exit(-1); + exit(EXIT_FAILURE); } if(current_rom_bank > 0 && pos < BANKSTART) { fprintf(stderr, "ERROR: address underflow (addr %lx < %lx)\n", pos, BANKSTART); - exit(-1); + exit(EXIT_FAILURE); } if(nb_rom_banks == 2 && current_rom_bank > 0) { fprintf(stderr, "ERROR: only 1 32kB segment with 2 bank\n"); - exit(-1); + exit(EXIT_FAILURE); } if(current_rom_bank > 1) pos += (current_rom_bank-1)*BANKSIZE; @@ -85,7 +85,7 @@ VOID gb(int in) cart[pos/SEGSIZE][pos%SEGSIZE] = rtval[i]; } else { fprintf(stderr, "ERROR: cartridge size overflow (addr %lx >= %lx)\n", pos, CARTSIZE); - exit(-1); + exit(EXIT_FAILURE); } pos++; } diff --git a/link/z80/lkgg.c b/link/z80/lkgg.c index d8248d6e..3e8bb37a 100644 --- a/link/z80/lkgg.c +++ b/link/z80/lkgg.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include "aslink.h" @@ -34,7 +33,7 @@ VOID gg(int in) for(i = 0; i < NBSEG; i++) { if((cart[i] = malloc(SEGSIZE)) == NULL) { fprintf(stderr, "ERROR: can't allocate %dth segment of memory (%d bytes)\n", i, (int)SEGSIZE); - exit(-1); + exit(EXIT_FAILURE); } memset(cart[i], 0, SEGSIZE); } @@ -50,7 +49,7 @@ VOID gg(int in) /* Perform some validity checks */ if(pos >= ROMSIZE) { fprintf(stderr, "ERROR: address overflow (addr %lx >= %lx)\n", pos, ROMSIZE); - exit(-1); + exit(EXIT_FAILURE); } if(current_rom_bank > 1) pos += (current_rom_bank-1)*BANKSIZE; @@ -62,7 +61,7 @@ VOID gg(int in) cart[pos/SEGSIZE][pos%SEGSIZE] = rtval[i]; } else { fprintf(stderr, "ERROR: cartridge size overflow (addr %lx >= %lx)\n", pos, CARTSIZE); - exit(-1); + exit(EXIT_FAILURE); } pos++; } diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 30af1cd4..bc5bf842 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -4475,6 +4475,6 @@ operand *validateOpType(operand *op, " expected %s, got %s\n", macro, args, file, line, opTypeToStr(type), op ? opTypeToStr(op->type) : "null op"); - exit(-1); + exit(EXIT_FAILURE); return op; // never reached, makes compiler happy. } diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 770cbff0..df97f511 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -710,7 +710,7 @@ getStringArg(const char *szStart, char **argv, int *pi, int argc) { werror (E_ARGUMENT_MISSING, szStart); /* Die here rather than checking for errors later. */ - exit(-1); + exit(EXIT_FAILURE); } else { @@ -1617,7 +1617,7 @@ linkEdit (char **envp) fprintf(stderr, "Add support for your FLAT24 target in %s @ line %d\n", __FILE__, __LINE__); - exit(-1); + exit(EXIT_FAILURE); } break; case MODEL_PAGE0: @@ -1665,7 +1665,7 @@ linkEdit (char **envp) fprintf(stderr, "Add support for your FLAT24 target in %s @ line %d\n", __FILE__, __LINE__); - exit(-1); + exit(EXIT_FAILURE); } } #endif @@ -2313,7 +2313,7 @@ main (int argc, char **argv, char **envp) atexit(rm_tmpfiles); /* install signal handler; - it's only purpuse is to call exit() to remove temp files */ + it's only purpose is to call exit() to remove temp files */ if (!getenv("SDCC_LEAVE_SIGNALS")) { signal (SIGABRT, sig_handler); diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index 9be6c7f5..8031d9fc 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -1428,8 +1428,7 @@ checkSClass (symbol * sym, int isProto) fprintf (stderr, "checkSClass: %s \n", sym->name); } - /* type is literal can happen for enums change - to auto */ + /* type is literal can happen for enums change to auto */ if (SPEC_SCLS (sym->etype) == S_LITERAL && !SPEC_ENUM (sym->etype)) SPEC_SCLS (sym->etype) = S_AUTO; @@ -3552,7 +3551,7 @@ sym_link *validateLink(sym_link *l, " expected %s, got %s\n", macro, args, file, line, DECLSPEC2TXT(select), l ? DECLSPEC2TXT(l->class) : "null-link"); - exit(-1); + exit(EXIT_FAILURE); return l; // never reached, makes compiler happy. } diff --git a/src/pic/main.c b/src/pic/main.c index a10755af..efca60ea 100644 --- a/src/pic/main.c +++ b/src/pic/main.c @@ -166,7 +166,7 @@ _pic14_parseOptions (int *pargc, char **argv, int *i) if(!strncmp(buf, argv[ *i ], strlen(buf))) { if(strlen(argv[ *i ]) <= strlen(buf)+1) { fprintf(stderr, "WARNING: no `%s' entered\n", buf+2); - exit(-1); + exit(EXIT_FAILURE); } else { udata_section_name = strdup( strchr(argv[*i], '=') + 1 ); } diff --git a/src/pic/pcoderegs.c b/src/pic/pcoderegs.c index 7b4d095a..0c8f4beb 100644 --- a/src/pic/pcoderegs.c +++ b/src/pic/pcoderegs.c @@ -1287,7 +1287,7 @@ static int pCodeRemove (pCode *pc, const char *comment) else { fprintf (stderr, "Cannot move a label...\n"); - exit(-1); + exit(EXIT_FAILURE); } if (comment) diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 19d1290b..1b16d206 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -6047,7 +6047,7 @@ static void genCmp (operand *left, operand *right, pic16_emitcode("anl","c,/%s",AOP(left)->aopu.aop_dir); werror(W_POSSBUG2, __FILE__, __LINE__); - exit(-1); + exit(EXIT_FAILURE); } /* if literal is on the right then swap with left */ @@ -10719,7 +10719,7 @@ static void genUnpackBits (operand *result, operand *left, char *rname, int ptyp fprintf(stderr, "SDCC pic16 port error: the port currently does not support *reading*\n"); fprintf(stderr, "bitfields of size >=8. Instead of generating wrong code, bailling out...\n"); - exit(-1); + exit(EXIT_FAILURE); return ; } @@ -11526,7 +11526,7 @@ static void genPackBits (sym_link *etype , operand *result, #if 0 fprintf(stderr, "SDCC pic16 port error: the port currently does not support\n"); fprintf(stderr, "bitfields of size >=8. Instead of generating wrong code, bailling out...\n"); - exit(-1); + exit(EXIT_FAILURE); #endif diff --git a/src/pic16/main.c b/src/pic16/main.c index c27a2bdf..7b064565 100644 --- a/src/pic16/main.c +++ b/src/pic16/main.c @@ -233,7 +233,7 @@ _process_pragma(const char *sz) if (stackPos+stackLen > pic16->RAMsize) { fprintf (stderr, "%s:%u: error: stack [0x%03X,0x%03X] is placed outside available memory [0x000,0x%03X]!\n", filename, lineno-1, stackPos, stackPos+stackLen-1, pic16->RAMsize-1); - exit(-1); + exit(EXIT_FAILURE); return 1; /* considered an error, but this reports "invalid pragma stack"... */ } } @@ -266,7 +266,7 @@ _process_pragma(const char *sz) if (!symname || !location) { fprintf (stderr, "%s:%d: #pragma code [symbol] [location] -- symbol or location missing\n", filename, lineno-1); - exit (-1); + exit (EXIT_FAILURE); return 1; /* considered an error, but this reports "invalid pragma code"... */ } @@ -300,7 +300,7 @@ _process_pragma(const char *sz) if (!symname || !sectname) { fprintf (stderr, "%s:%d: #pragma udata [section-name] [symbol] -- section-name or symbol missing!\n", filename, lineno-1); - exit (-1); + exit (EXIT_FAILURE); return 1; /* considered an error, but this reports "invalid pragma code"... */ } @@ -516,7 +516,7 @@ _pic16_parseOptions (int *pargc, char **argv, int *i) else if(!STRCASECMP(stkmodel, "large"))pic16_options.stack_model = 1; else { fprintf(stderr, "Unknown stack model: %s", stkmodel); - exit(-1); + exit(EXIT_FAILURE); } return TRUE; } @@ -555,7 +555,7 @@ _pic16_parseOptions (int *pargc, char **argv, int *i) else if(!STRCASECMP(tmp, "crlf"))pic16_nl = 1; else { fprintf(stderr, "invalid termination character id\n"); - exit(-1); + exit(EXIT_FAILURE); } return TRUE; } diff --git a/src/pic16/pcode.c b/src/pic16/pcode.c index 84947452..baec7f29 100644 --- a/src/pic16/pcode.c +++ b/src/pic16/pcode.c @@ -4286,7 +4286,7 @@ pCodeOp *pic16_newpCodeOpReg(int rIdx) if(!r) { fprintf(stderr, "%s:%d Could not find a free GPR register\n", __FUNCTION__, __LINE__); - exit(-1); + exit(EXIT_FAILURE); } } @@ -4959,7 +4959,7 @@ char *pic16_pCode2str(char *str, size_t size, pCode *pc) if(isPCI(pc) && (PCI(pc)->pci_magic != PCI_MAGIC)) { fprintf(stderr, "%s:%d: pCodeInstruction initialization error in instruction %s, magic is %x (defaut: %x)\n", __FILE__, __LINE__, PCI(pc)->mnemonic, PCI(pc)->pci_magic, PCI_MAGIC); -// exit(-1); +// exit(EXIT_FAILURE); } #endif