diff --git a/include/asm/main.h b/include/asm/main.h index 36532527..de991922 100644 --- a/include/asm/main.h +++ b/include/asm/main.h @@ -15,7 +15,7 @@ #include "helpers.h" -extern bool haltnop; +extern bool haltNop; extern bool warnOnHaltNop; extern bool optimizeLoads; extern bool warnOnLdOpt; diff --git a/man/rgbasm.1 b/man/rgbasm.1 index a5aecb61..ea7ddc8f 100644 --- a/man/rgbasm.1 +++ b/man/rgbasm.1 @@ -71,24 +71,14 @@ Export all labels, including unreferenced and local labels. Change the four characters used for gfx constants. The defaults are 0123. .It Fl H , Fl Fl nop-after-halt -By default, -.Nm -inserts a -.Ic nop -instruction immediately after any -.Ic halt -instruction, -but this has been deprecated and prints a warning message the first time it occurs. -The -.Fl H -option opts into this insertion, -so no warning will be printed. -.It Fl h , Fl Fl halt-without-nop -Disables inserting a +Inserts a .Ic nop instruction immediately after any .Ic halt instruction. +This option is deprecated and will be removed in the next version. +.It Fl h , Fl Fl halt-without-nop +This option is redundant and will be removed in the next version. .It Fl I Ar path , Fl Fl include Ar path Add a new .Dq include path ; @@ -105,21 +95,13 @@ first looks up the provided path from its working directory; if this fails, it t .Dq include path directories, in the order they were provided. .It Fl L , Fl Fl preserve-ld -By default, -.Nm -optimizes loads of the form -.Ic LD [$FF00+n8],A -into the opcode -.Ic LDH [$FF00+n8],A , -but this has been deprecated and prints a warning message the first time it occurs. -The -.Fl L -option disables this optimization. +This option is redundant and will be removed in the next version. .It Fl l , Fl Fl auto-ldh Optimize loads of the form .Ic LD [$FF00+n8],A into the opcode .Ic LDH [$FF00+n8],A . +This option is deprecated and will be removed in the next version. .It Fl M Ar depend_file , Fl Fl dependfile Ar depend_file Print .Xr make 1 diff --git a/man/rgbasm.5 b/man/rgbasm.5 index 3afc942b..c96ace2a 100644 --- a/man/rgbasm.5 +++ b/man/rgbasm.5 @@ -1249,16 +1249,6 @@ The example above defines as a new macro. String constants are not expanded within the name of the macro. .Pp -(Using the -.Em deprecated -older syntax -.Ql MyMacro: MACRO -instead of -.Ql MACRO MyMacro , -with a single colon -.Ql \&: -following the macro's name, string constants may be expanded for the name.) -.Pp Macros can't be exported or imported. .Pp Plainly nesting macro definitions is not allowed, but this can be worked around using diff --git a/src/asm/lexer.c b/src/asm/lexer.c index 649e045a..d9072fc0 100644 --- a/src/asm/lexer.c +++ b/src/asm/lexer.c @@ -1722,12 +1722,6 @@ static size_t appendStringLiteral(size_t i) c = '\\'; break; - case ',': // `\,` inside a macro arg string literal - warning(WARNING_OBSOLETE, - "`\\,` is deprecated inside strings\n"); - shiftChar(); - break; - default: error("Illegal character escape %s\n", printChar(c)); shiftChar(); diff --git a/src/asm/main.c b/src/asm/main.c index 038dfab2..68dd21b7 100644 --- a/src/asm/main.c +++ b/src/asm/main.c @@ -59,7 +59,7 @@ bool failedOnMissingInclude = false; bool generatePhonyDeps = false; char *targetFileName = NULL; -bool haltnop; +bool haltNop; bool warnOnHaltNop; bool optimizeLoads; bool warnOnLdOpt; @@ -164,9 +164,9 @@ int main(int argc, char *argv[]) opt_G("0123"); opt_P(0); opt_Q(16); - haltnop = true; + haltNop = false; warnOnHaltNop = true; - optimizeLoads = true; + optimizeLoads = false; warnOnLdOpt = true; verbose = false; warnings = true; @@ -209,32 +209,39 @@ int main(int argc, char *argv[]) break; case 'H': - if (!haltnop) + if (warnOnHaltNop) + warning(WARNING_OBSOLETE, + "Automatic `nop` after `halt` is deprecated\n"); + else errx("`-H` and `-h` don't make sense together"); + haltNop = true; warnOnHaltNop = false; break; case 'h': - if (!warnOnHaltNop) + if (haltNop) errx("`-H` and `-h` don't make sense together"); - haltnop = false; break; // `-i` was the only short option for `--include` until `-I` was // introduced to better match the `-I dir` option of gcc and clang. - // `-i` is now undocumented but still supported for now. - case 'I': case 'i': + warning(WARNING_OBSOLETE, "`-i` is deprecated; use `-I`\n"); + // fallthrough + case 'I': fstk_AddIncludePath(musl_optarg); break; case 'L': - if (!warnOnLdOpt) + if (optimizeLoads) errx("`-L` and `-l` don't make sense together"); - optimizeLoads = false; break; case 'l': - if (!optimizeLoads) + if (warnOnLdOpt) + warning(WARNING_OBSOLETE, + "Automatic `ld` to `ldh` optimization is deprecated\n"); + else errx("`-L` and `-l` don't make sense together"); + optimizeLoads = true; warnOnLdOpt = false; break; diff --git a/src/asm/opt.c b/src/asm/opt.c index 6ca764d6..697041b6 100644 --- a/src/asm/opt.c +++ b/src/asm/opt.c @@ -26,7 +26,7 @@ struct OptStackEntry { char gbgfx[4]; uint8_t fixPrecision; uint8_t fillByte; - bool haltnop; + bool haltNop; bool warnOnHaltNop; bool optimizeLoads; bool warnOnLdOpt; @@ -72,7 +72,7 @@ void opt_H(bool warn) void opt_h(bool halt) { - haltnop = halt; + haltNop = halt; } void opt_L(bool optimize) @@ -265,7 +265,7 @@ void opt_Push(void) entry->fillByte = fillByte; // Pulled from section.h - entry->haltnop = haltnop; // Pulled from main.h + entry->haltNop = haltNop; // Pulled from main.h entry->warnOnHaltNop = warnOnHaltNop; entry->optimizeLoads = optimizeLoads; // Pulled from main.h @@ -295,7 +295,7 @@ void opt_Pop(void) opt_P(entry->fillByte); opt_Q(entry->fixPrecision); opt_H(entry->warnOnHaltNop); - opt_h(entry->haltnop); + opt_h(entry->haltNop); opt_L(entry->optimizeLoads); opt_l(entry->warnOnLdOpt); opt_R(entry->maxRecursionDepth); diff --git a/src/asm/parser.y b/src/asm/parser.y index b4f69fe2..9c28a052 100644 --- a/src/asm/parser.y +++ b/src/asm/parser.y @@ -1165,14 +1165,6 @@ macrodef : T_POP_MACRO { sym_AddMacro($3, captureBody.lineNo, captureBody.body, captureBody.size); } - | T_LABEL T_COLON T_POP_MACRO T_NEWLINE { - warning(WARNING_OBSOLETE, "`%s: MACRO` is deprecated; use `MACRO %s`\n", $1, $1); - $$ = lexer_CaptureMacroBody(&captureBody); - } endofline { - if ($5) - sym_AddMacro($1, captureBody.lineNo, captureBody.body, - captureBody.size); - } ; rsset : T_POP_RSSET uconst { sym_AddVar("_RS", $2); } @@ -1905,10 +1897,11 @@ z80_ei : T_Z80_EI { sect_AbsByte(0xFB); } z80_halt : T_Z80_HALT { sect_AbsByte(0x76); - if (haltnop) { + if (haltNop) { if (warnOnHaltNop) { warnOnHaltNop = false; - warning(WARNING_OBSOLETE, "`nop` after `halt` will stop being the default; pass `-H` to opt into it\n"); + warning(WARNING_OBSOLETE, + "Automatic `nop` after `halt` is deprecated\n"); } sect_AbsByte(0x00); } @@ -2021,7 +2014,8 @@ z80_ld_mem : T_Z80_LD op_mem_ind T_COMMA T_MODE_SP { && $2.val >= 0xFF00) { if (warnOnLdOpt) { warnOnLdOpt = false; - warning(WARNING_OBSOLETE, "ld optimization will stop being the default; pass `-l` to opt into it\n"); + warning(WARNING_OBSOLETE, + "Automatic `ld` to `ldh` optimization is deprecated\n"); } sect_AbsByte(0xE0); sect_AbsByte($2.val & 0xFF); @@ -2073,7 +2067,8 @@ z80_ld_a : T_Z80_LD reg_r T_COMMA c_ind { && $4.val >= 0xFF00) { if (warnOnLdOpt) { warnOnLdOpt = false; - warning(WARNING_OBSOLETE, "ld optimization will stop being the default; pass `-l` to opt into it\n"); + warning(WARNING_OBSOLETE, + "Automatic `ld` to `ldh` optimization is deprecated\n"); } sect_AbsByte(0xF0); sect_AbsByte($4.val & 0xFF); diff --git a/src/asm/symbol.c b/src/asm/symbol.c index aa5ba997..15621c90 100644 --- a/src/asm/symbol.c +++ b/src/asm/symbol.c @@ -77,50 +77,6 @@ static int32_t Callback_NARG(void) return macro_NbArgs(); } -static int32_t Callback__LINE__(void) -{ - warning(WARNING_OBSOLETE, "`__LINE__` is deprecated\n"); - - return lexer_GetLineNo(); -} - -static char const *Callback__FILE__(void) -{ - warning(WARNING_OBSOLETE, "`__FILE__` is deprecated\n"); - - // There are only two call sites for this; one copies the contents directly, the other is - // EQUS expansions, which cannot straddle file boundaries. So this should be fine. - static char *buf = NULL; - static size_t bufsize = 0; - char const *fileName = fstk_GetFileName(); - size_t j = 1; - - assert(fileName[0]); - // The assertion above ensures the loop runs at least once - for (size_t i = 0; fileName[i]; i++, j++) { - // Account for the extra backslash inserted below - if (fileName[i] == '"') - j++; - // Ensure there will be enough room; DO NOT PRINT ANYTHING ABOVE THIS! - if (j + 2 >= bufsize) { // Always keep room for 2 tail chars - bufsize = bufsize ? bufsize * 2 : 64; - buf = realloc(buf, bufsize); - if (!buf) - fatalerror("Failed to grow buffer for file name: %s\n", - strerror(errno)); - } - // Escape quotes, since we're returning a string - if (fileName[i] == '"') - buf[j - 1] = '\\'; - buf[j] = fileName[i]; - } - // Write everything after the loop, to ensure the buffer has been allocated - buf[0] = '"'; - buf[j++] = '"'; - buf[j] = '\0'; - return buf; -} - static int32_t CallbackPC(void) { struct Section const *section = sect_GetSymbolSection(); @@ -687,21 +643,13 @@ static struct Symbol *createBuiltinSymbol(char const *symName) void sym_Init(time_t now) { PCSymbol = createBuiltinSymbol("@"); - _NARGSymbol = createBuiltinSymbol("_NARG"); - // __LINE__ is deprecated - struct Symbol *__LINE__Symbol = createBuiltinSymbol("__LINE__"); - // __FILE__ is deprecated - struct Symbol *__FILE__Symbol = createBuiltinSymbol("__FILE__"); - PCSymbol->type = SYM_LABEL; PCSymbol->section = NULL; PCSymbol->numCallback = CallbackPC; + + _NARGSymbol = createBuiltinSymbol("_NARG"); _NARGSymbol->type = SYM_EQU; _NARGSymbol->numCallback = Callback_NARG; - __LINE__Symbol->type = SYM_EQU; - __LINE__Symbol->numCallback = Callback__LINE__; - __FILE__Symbol->type = SYM_EQUS; - __FILE__Symbol->strCallback = Callback__FILE__; sym_AddVar("_RS", 0)->isBuiltin = true; @@ -758,4 +706,5 @@ void sym_Init(time_t now) #undef addSym sym_SetCurrentSymbolScope(NULL); - anonLabelID = 0;} + anonLabelID = 0; +} diff --git a/test/asm/.gitignore b/test/asm/.gitignore index c6f749bf..6590e3a9 100644 --- a/test/asm/.gitignore +++ b/test/asm/.gitignore @@ -1,3 +1,2 @@ -/quote\"file.* /version.asm /version.out diff --git a/test/asm/file-sym.asm b/test/asm/file-sym.asm deleted file mode 100644 index 7b8561b5..00000000 --- a/test/asm/file-sym.asm +++ /dev/null @@ -1 +0,0 @@ -PRINTLN "{__FILE__}" diff --git a/test/asm/file-sym.err b/test/asm/file-sym.err deleted file mode 100644 index bb02ea72..00000000 --- a/test/asm/file-sym.err +++ /dev/null @@ -1,2 +0,0 @@ -warning: file-sym.asm(1): [-Wobsolete] - `__FILE__` is deprecated diff --git a/test/asm/file-sym.out b/test/asm/file-sym.out deleted file mode 100644 index c3259a8b..00000000 --- a/test/asm/file-sym.out +++ /dev/null @@ -1 +0,0 @@ -"file-sym.asm" diff --git a/test/asm/label-indent.asm b/test/asm/label-indent.asm index 480c2531..75f46b46 100644 --- a/test/asm/label-indent.asm +++ b/test/asm/label-indent.asm @@ -1,4 +1,3 @@ - SECTION "Label testing", WRAMX Lab: @@ -7,7 +6,7 @@ SECTION "Label testing", WRAMX : ; anonymous - mac: MACRO + MACRO mac println "\1" ENDM mac : diff --git a/test/asm/label-indent.err b/test/asm/label-indent.err index 147287de..e69de29b 100644 --- a/test/asm/label-indent.err +++ b/test/asm/label-indent.err @@ -1,2 +0,0 @@ -warning: label-indent.asm(10): [-Wobsolete] - `mac: MACRO` is deprecated; use `MACRO mac` diff --git a/test/asm/label-indent.out b/test/asm/label-indent.out index a74014d4..397db75f 100644 --- a/test/asm/label-indent.out +++ b/test/asm/label-indent.out @@ -1 +1 @@ -: +: diff --git a/test/asm/macro-syntax.asm b/test/asm/macro-syntax.asm index 02bcbcc6..71ae9fcb 100644 --- a/test/asm/macro-syntax.asm +++ b/test/asm/macro-syntax.asm @@ -1,15 +1,12 @@ + MACRO new ; comment + println "in with the ", \1 + ENDM ; comment + + new 2 old: MACRO ; comment println "out with the ", \1 ENDM ; comment - MACRO new ; comment - println "in with the ", \1 - ENDM ; comment - old 1 - new 2 - bad1: MACRO bad2 ; comment - println "which?" - ENDM ; comment diff --git a/test/asm/macro-syntax.err b/test/asm/macro-syntax.err index 71bef6c7..b535501b 100644 --- a/test/asm/macro-syntax.err +++ b/test/asm/macro-syntax.err @@ -1,7 +1,7 @@ -warning: macro-syntax.asm(2): [-Wobsolete] - `old: MACRO` is deprecated; use `MACRO old` -error: macro-syntax.asm(13): - syntax error, unexpected identifier, expecting newline -error: macro-syntax.asm(15): +error: macro-syntax.asm(7): + syntax error, unexpected MACRO +error: macro-syntax.asm(8): + Macro argument '\1' not defined +error: macro-syntax.asm(9): syntax error, unexpected ENDM -error: Assembly aborted (2 errors)! +error: Assembly aborted (3 errors)! diff --git a/test/asm/macro-syntax.out b/test/asm/macro-syntax.out index 68bb38c2..29204d7a 100644 --- a/test/asm/macro-syntax.out +++ b/test/asm/macro-syntax.out @@ -1,3 +1,2 @@ -out with the $1 in with the $2 -which? +out with the diff --git a/test/asm/macro-syntax.simple.err b/test/asm/macro-syntax.simple.err index a33a2745..453c1264 100644 --- a/test/asm/macro-syntax.simple.err +++ b/test/asm/macro-syntax.simple.err @@ -1,5 +1,7 @@ -error: macro-syntax.asm(13): +error: macro-syntax.asm(7): syntax error -error: macro-syntax.asm(15): +error: macro-syntax.asm(8): + Macro argument '\1' not defined +error: macro-syntax.asm(9): syntax error -error: Assembly aborted (2 errors)! +error: Assembly aborted (3 errors)! diff --git a/test/link/all-instructions.asm b/test/link/all-instructions.asm index 0f7eb830..3c181e3d 100644 --- a/test/link/all-instructions.asm +++ b/test/link/all-instructions.asm @@ -242,6 +242,7 @@ jrlabel: ei halt nop + nop scf stop FOR BYTE, 256