mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Allow OPT to toggle -h
This commit is contained in:
@@ -14,6 +14,7 @@ struct OptStackEntry {
|
|||||||
char binary[2];
|
char binary[2];
|
||||||
char gbgfx[4];
|
char gbgfx[4];
|
||||||
int32_t fillByte;
|
int32_t fillByte;
|
||||||
|
bool haltnop;
|
||||||
bool optimizeLoads;
|
bool optimizeLoads;
|
||||||
bool warningsAreErrors;
|
bool warningsAreErrors;
|
||||||
enum WarningState warningStates[NB_WARNINGS];
|
enum WarningState warningStates[NB_WARNINGS];
|
||||||
@@ -37,6 +38,11 @@ void opt_P(uint8_t fill)
|
|||||||
fillByte = fill;
|
fillByte = fill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void opt_h(bool halt)
|
||||||
|
{
|
||||||
|
haltnop = halt;
|
||||||
|
}
|
||||||
|
|
||||||
void opt_L(bool optimize)
|
void opt_L(bool optimize)
|
||||||
{
|
{
|
||||||
optimizeLoads = optimize;
|
optimizeLoads = optimize;
|
||||||
@@ -79,6 +85,13 @@ void opt_Parse(char *s)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
if (s[1] == '\0')
|
||||||
|
opt_h(false);
|
||||||
|
else
|
||||||
|
error("Option 'h' does not take an argument\n");
|
||||||
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
if (s[1] == '\0')
|
if (s[1] == '\0')
|
||||||
opt_L(false);
|
opt_L(false);
|
||||||
@@ -95,6 +108,13 @@ void opt_Parse(char *s)
|
|||||||
|
|
||||||
case '!': // negates flag options that do not take an argument
|
case '!': // negates flag options that do not take an argument
|
||||||
switch (s[1]) {
|
switch (s[1]) {
|
||||||
|
case 'h':
|
||||||
|
if (s[2] == '\0')
|
||||||
|
opt_h(true);
|
||||||
|
else
|
||||||
|
error("Option '!h' does not take an argument\n");
|
||||||
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
if (s[2] == '\0')
|
if (s[2] == '\0')
|
||||||
opt_L(true);
|
opt_L(true);
|
||||||
@@ -132,6 +152,8 @@ void opt_Push(void)
|
|||||||
|
|
||||||
entry->fillByte = fillByte; // Pulled from section.h
|
entry->fillByte = fillByte; // Pulled from section.h
|
||||||
|
|
||||||
|
entry->haltnop = haltnop; // Pulled from main.h
|
||||||
|
|
||||||
entry->optimizeLoads = optimizeLoads; // Pulled from main.h
|
entry->optimizeLoads = optimizeLoads; // Pulled from main.h
|
||||||
|
|
||||||
// Both of these pulled from warning.h
|
// Both of these pulled from warning.h
|
||||||
@@ -154,6 +176,7 @@ void opt_Pop(void)
|
|||||||
opt_B(entry->binary);
|
opt_B(entry->binary);
|
||||||
opt_G(entry->gbgfx);
|
opt_G(entry->gbgfx);
|
||||||
opt_P(entry->fillByte);
|
opt_P(entry->fillByte);
|
||||||
|
opt_h(entry->haltnop);
|
||||||
opt_L(entry->optimizeLoads);
|
opt_L(entry->optimizeLoads);
|
||||||
|
|
||||||
// opt_W does not apply a whole warning state; it processes one flag string
|
// opt_W does not apply a whole warning state; it processes one flag string
|
||||||
|
|||||||
@@ -1957,15 +1957,18 @@ POPO
|
|||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
The options that OPT can modify are currently:
|
The options that OPT can modify are currently:
|
||||||
.Cm b , g , p , L ,
|
.Cm b , g , p , h , L ,
|
||||||
and
|
and
|
||||||
.Cm W .
|
.Cm W .
|
||||||
The Boolean flag option
|
The Boolean flag options
|
||||||
|
.Cm h
|
||||||
|
and
|
||||||
.Cm L
|
.Cm L
|
||||||
can be specified as
|
can be negated as
|
||||||
.Ql OPT L
|
.Ql OPT !h
|
||||||
or
|
and
|
||||||
.Ql OPT !L .
|
.Ql OPT !L
|
||||||
|
to act like omitting them from the command-line.
|
||||||
.Pp
|
.Pp
|
||||||
.Ic POPO
|
.Ic POPO
|
||||||
and
|
and
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
SECTION "test", ROM0
|
SECTION "test", ROM0
|
||||||
|
|
||||||
opt !L ; already the default, but tests parsing "!L"
|
opt !h, !L ; already the default, but tests parsing "!"
|
||||||
|
|
||||||
pusho
|
pusho
|
||||||
opt p42, L, Wno-div
|
opt p42, h, L, Wno-div
|
||||||
ds 1
|
ds 1
|
||||||
ld [$ff88], a
|
ld [$ff88], a
|
||||||
|
halt
|
||||||
println $8000_0000 / -1
|
println $8000_0000 / -1
|
||||||
popo
|
popo
|
||||||
|
|
||||||
ds 1
|
ds 1
|
||||||
ld [$ff88], a
|
ld [$ff88], a
|
||||||
|
halt
|
||||||
println $8000_0000 / -1
|
println $8000_0000 / -1
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
warning: opt.asm(14): [-Wdiv]
|
warning: opt.asm(16): [-Wdiv]
|
||||||
Division of -2147483648 by -1 yields -2147483648
|
Division of -2147483648 by -1 yields -2147483648
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user