From: Shamus Hammons Date: Wed, 7 Oct 2015 03:23:59 +0000 (-0500) Subject: Fixed WARNING macro to be system agnostic, added doco for -p switch. X-Git-Tag: v2.1.0~202 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=commitdiff_plain;h=f4e9bcd703852c51c97d2586872b9b26389899e6 Fixed WARNING macro to be system agnostic, added doco for -p switch. --- diff --git a/macro.c b/macro.c index 4232f1a..e7d51dd 100644 --- a/macro.c +++ b/macro.c @@ -40,7 +40,6 @@ void InitMacro(void) { macuniq = 0; macnum = 1; -// argp = NULL; argp = 0; } @@ -53,11 +52,7 @@ void InitMacro(void) // int ExitMacro(void) { -#ifndef _MSC_VER -#pragma message !!! Bad macro exiting !!! -#else -#pragma WARNING(!!! Bad macro exiting !!!) -#endif +WARNING(!!! Bad macro exiting !!!) /* This is a problem. Currently, the argument logic just keeps the current @@ -253,11 +248,7 @@ int defr1(char * ln, int kwno) rptlevel++; default: //MORE stupidity here... -#ifndef _MSC_VER -#pragma warning "!!! Casting (char *) as LONG !!!" -#else -#pragma WARNING(!!! Casting (char *) as LONG !!!) -#endif +WARNING(!!! Casting (char *) as LONG !!!) addln: // Allocate length of line + 1('\0') + LONG len = strlen(ln) + 1 + sizeof(LONG); diff --git a/object.c b/object.c index 3412740..2702c54 100644 --- a/object.c +++ b/object.c @@ -187,7 +187,7 @@ char * constr_symtab(register char * buf, SYM * sym, int globflag) // int WriteObject(int fd) { -// LONG t; // Scratch long + LONG t; // Scratch long LONG tds; // TEXT & DATA segment size int i; // Temporary int CHUNK * cp; // Chunk (for gather) diff --git a/rmac.c b/rmac.c index a7d1770..0c663b4 100644 --- a/rmac.c +++ b/rmac.c @@ -132,6 +132,7 @@ void DisplayHelp(void) " -l[filename] Create an output listing file\n" " -n Don't do things behind your back in RISC assembler\n" " -o file Output file name\n" + " -p[n] Create an ST .prg (1=normal, 2=w/symbols)\n" " -r[size] Pad segments to boundary size specified\n" " w: word (2 bytes, default alignment)\n" " l: long (4 bytes)\n" diff --git a/rmac.h b/rmac.h index 5ef9953..62fb542 100644 --- a/rmac.h +++ b/rmac.h @@ -23,13 +23,13 @@ #pragma warning(disable:4996) #endif - //Makes warnings double clickable on visual studio + // Makes warnings double clickable on visual studio (ggn) #define STRINGIZE_HELPER(x) #x #define STRINGIZE(x) STRINGIZE_HELPER(x) - #define WARNING(desc) message(__FILE__ "(" STRINGIZE(__LINE__) ") : Warning: " #desc) + #define WARNING(desc) __pragma(message(__FILE__ "(" STRINGIZE(__LINE__) ") : Warning: " #desc)) // usage: - //#pragma WARNING(FIXME: Code removed because...) + // WARNING(FIXME: Code removed because...) #endif #include @@ -48,6 +48,9 @@ #define _OPEN_FLAGS O_TRUNC|O_CREAT|O_RDWR #define _OPEN_INC O_RDONLY #define _PERM_MODE S_IREAD|S_IWRITE + // WARNING WARNING WARNING + #define DO_PRAGMA(x) _Pragma (#x) + #define WARNING(desc) DO_PRAGMA(message (#desc)) #include #include #include @@ -62,6 +65,9 @@ #define _OPEN_FLAGS O_TRUNC|O_CREAT|O_RDWR #define _OPEN_INC O_RDONLY #define _PERM_MODE S_IREAD|S_IWRITE + // Defined here, even though the platfrom may not support it... + #define DO_PRAGMA(x) _Pragma (#x) + #define WARNING(desc) DO_PRAGMA(message (#desc)) #include #include #include diff --git a/sect.c b/sect.c index 64ccb44..5690b1b 100644 --- a/sect.c +++ b/sect.c @@ -274,11 +274,7 @@ int AddFixup(WORD attr, LONG loc, TOKEN * fexpr) SECT * p; // Shamus: Expression lengths are voodoo ATM (variable "i"). Need to fix // this. -#ifndef _MSC_VER -#pragma warning "!!! AddFixup() is filled with VOODOO !!!" -#else -#pragma WARNING(!!! AddFixup() is filled with VOODOO !!!) -#endif +WARNING(!!! AddFixup() is filled with VOODOO !!!) DEBUG printf("FIXUP@$%X: $%X\n", loc, attr); // Compute length of expression (could be faster); determine if it's the @@ -613,45 +609,6 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); } else reg2 = (signed)((eval - (loc + 2)) / 2);// & 0x1F; -#if 0 - if ((w & 0x0F00) == FU_MJR) - { - // Main code destination alignment checking here for - // forward declared labels - address = (oaddr) ? oaddr : loc; - - if (((address >= 0xF03000) && (address < 0xF04000) - && (eval < 0xF03000)) || ((eval >= 0xF03000) - && (eval < 0xF04000) && (address < 0xF03000))) - { - warni("* \'jr\' at $%08X - cannot jump relative between " - "main memory and local gpu ram", address); - } - else - { - page_jump = (address & 0xFFFFFF00) - (eval & 0xFFFFFF00); - - if (page_jump) - { - // This jump is to a page outside of the - // current 256 byte page - if (eval % 4) - { - warni("* \'jr\' at $%08X - destination address not aligned for long page jump, insert a \'nop\' before the destination address", address); - } - } - else - { - // This jump is in the current 256 byte page - if ((eval - 2) % 4) - { - warni("* \'jr\' at $%08X - destination address not aligned for short page jump, insert a \'nop\' before the destination address", address); - } - } - } - } -#endif - if ((reg2 < -16) || (reg2 > 15)) { error("relative jump out of range"); @@ -778,58 +735,6 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); } case FU_LONG: if ((w & FUMASKRISC) == FU_MOVEI) { -#if 0 - address = loc + 4; - - if (eattr & DEFINED) - { - for(j=0; j 0) - ship_ln(buf); - - if (err_flag) - write(err_fd, buf, (LONG)strlen(buf)); - else - printf("%s\n", buf); - } - } - else - { - if (!(eval & 0x0000000F) || ((eval - 2) % 4)) - { - err_setup(); - sprintf(buf, "* \'jump\' at $%08X - destination address not aligned for short page jump, insert a \'nop\' before the destination address", address); - - if (listing > 0) - ship_ln(buf); - - if (err_flag) - write(err_fd, buf, (LONG)strlen(buf)); - else - printf("%s\n", buf); - } - } - - // Clear this jump as it has been checked - fwdjump[j] = 0; - j = fwindex; - } - } - } -#endif - // Long constant in MOVEI # is word-swapped, so fix it here eval = ((eval >> 16) & 0x0000FFFF) | ((eval << 16) & 0xFFFF0000); flags = (MLONG | MMOVEI); diff --git a/token.c b/token.c index 1cd9eba..cc754ab 100644 --- a/token.c +++ b/token.c @@ -1547,11 +1547,7 @@ int d_goto(WORD unused) // Compare names (sleazo string compare) // This string compare is not right. Doesn't check for lengths. // (actually it does, but in a crappy, unclear way.) -#ifndef _MSC_VER - #warning "!!! Bad string comparison !!!" -#else - #pragma WARNING(!!!! Bad string comparison !!!) -#endif +WARNING(!!!! Bad string comparison !!!) s1 = sym; // s2 = (char *)(defln + 1) + 1; s2 = defln->line; diff --git a/version.h b/version.h index 31ce821..64a0c5e 100644 --- a/version.h +++ b/version.h @@ -13,6 +13,6 @@ #define MAJOR 1 // Major version number #define MINOR 3 // Minor version number -#define PATCH 7 // Patch release number +#define PATCH 8 // Patch release number #endif // __VERSION_H__