mirror of
https://github.com/uffejakobsen/acme.git
synced 2025-02-16 19:32:16 +00:00
throwing of some errors can now be delayed until symbol changes are done
git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@415 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
134ba39638
commit
a037bcc41e
12
src/acme.c
12
src/acme.c
@ -330,7 +330,7 @@ static void save_output_file(void)
|
||||
|
||||
|
||||
// definitions for pass flags:
|
||||
#define PF_COMPLAIN_ABOUT_UNDEFINEDS (1u << 0) // throw "Symbol not defined" errors
|
||||
#define PF_IS_ERROR_PASS (1u << 0) // throw "Symbol not defined" and other errors that could be suppressed
|
||||
#define PF_THROW_SEGMENT_MESSAGES (1u << 1) // throw segment warnings/errors
|
||||
#define PF_GENERATE_OUTPUT (1u << 2) // generate output and/or report file
|
||||
#define PF_IS_FINAL_PASS (1u << 3) // mostly for special warnings
|
||||
@ -347,7 +347,9 @@ static void perform_pass(bits passflags)
|
||||
pass.counters.symbolchanges = 0;
|
||||
pass.counters.errors = 0;
|
||||
pass.counters.warnings = 0;
|
||||
pass.flags.complain_about_undefined = !!(passflags & PF_COMPLAIN_ABOUT_UNDEFINEDS);
|
||||
pass.counters.suppressed_errors = 0;
|
||||
pass.flags.complain_about_undefined = !!(passflags & PF_IS_ERROR_PASS);
|
||||
pass.flags.throw_all_errors = !!(passflags & PF_IS_ERROR_PASS);
|
||||
pass.flags.is_final_pass = !!(passflags & PF_IS_FINAL_PASS);
|
||||
pass.flags.throw_segment_messages = !!(passflags & PF_THROW_SEGMENT_MESSAGES);
|
||||
pass.flags.generate_output = !!(passflags & PF_GENERATE_OUTPUT);
|
||||
@ -437,10 +439,12 @@ static void do_actual_work(void)
|
||||
// ...or maybe do one additional pass where all errors are reported, including "not defined" and "value has changed".
|
||||
}
|
||||
}
|
||||
// FIXME - do an optional extra pass, as a debugging aid?
|
||||
|
||||
// final pass:
|
||||
// any errors left?
|
||||
if (pass.counters.undefineds == 0) { // FIXME - use pass.counters.needvalue instead!
|
||||
// FIXME - use pass.counters.needvalue instead of pass.counters.undefineds?
|
||||
if ((pass.counters.undefineds == 0) && (pass.counters.suppressed_errors == 0)) {
|
||||
// victory lap
|
||||
if (config.process_verbosity >= 2)
|
||||
puts("Extra pass to generate output.");
|
||||
@ -450,7 +454,7 @@ static void do_actual_work(void)
|
||||
// so perform additional pass to find and show them.
|
||||
if (config.process_verbosity >= 2)
|
||||
puts("Extra pass to display errors.");
|
||||
perform_pass(PF_IS_FINAL_PASS | PF_COMPLAIN_ABOUT_UNDEFINEDS); // perform pass, but now show "value undefined"
|
||||
perform_pass(PF_IS_FINAL_PASS | PF_IS_ERROR_PASS); // perform pass, but now show "value undefined" and others
|
||||
// FIXME - perform_pass() calls exit() when there were errors,
|
||||
// so if controls returns here, call BUG()!
|
||||
// (this can be triggered using ifdef/ifndef)
|
||||
|
14
src/global.c
14
src/global.c
@ -663,11 +663,17 @@ void BUG(const char *message, int code)
|
||||
// otherwise just increment counter to let mainloop know this pass wasn't successful.
|
||||
void countorthrow_value_error(const char *msg)
|
||||
{
|
||||
// atm we just mimic the old behaviour. in future, do something like this:
|
||||
//if (pass.is_error_pass)
|
||||
boolean complain;
|
||||
|
||||
if (config.dialect >= V0_98__PATHS_AND_SYMBOLCHANGE)
|
||||
complain = pass.flags.throw_all_errors;
|
||||
else
|
||||
complain = TRUE; // mimic the old behavior
|
||||
|
||||
if (complain)
|
||||
throw_error(msg);
|
||||
//else
|
||||
//++pass.counters.suppressed_errors;
|
||||
else
|
||||
++pass.counters.suppressed_errors;
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@ struct pass {
|
||||
int symbolchanges; // count symbol changes (if nonzero, another pass is needed)
|
||||
int errors; // if nonzero -> stop after this pass
|
||||
int warnings; // this is needed for showing macro call stack
|
||||
//int suppressed_errors; // FIXME - this is for
|
||||
int suppressed_errors; // this is for
|
||||
// "errors not reported because pass flags said so", because
|
||||
// then we can read the value after all symbol changes have
|
||||
// finally settled and know if the next pass is a victory lap or
|
||||
@ -125,6 +125,7 @@ struct pass {
|
||||
} counters;
|
||||
struct {
|
||||
boolean complain_about_undefined; // will be FALSE until error pass is needed
|
||||
boolean throw_all_errors; // will be FALSE until error pass is needed
|
||||
boolean is_final_pass; // needed for warnings like "converted float to int for xor"
|
||||
boolean throw_segment_messages; // atm only used in pass 1, should be used in _last_ pass!
|
||||
boolean generate_output; // create output and/or report file
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#define RELEASE "0.97" // update before release FIXME
|
||||
#define CODENAME "Zem" // update before release
|
||||
#define CHANGE_DATE "17 Aug" // update before release FIXME
|
||||
#define CHANGE_DATE "18 Aug" // update before release FIXME
|
||||
#define CHANGE_YEAR "2024" // update before release
|
||||
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
||||
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
||||
|
Loading…
x
Reference in New Issue
Block a user