Error on #ifdef/#ifhave without argument
This commit is contained in:
parent
8f74a27b90
commit
ab5475172e
1 changed files with 6 additions and 0 deletions
|
@ -1323,6 +1323,9 @@ bool preprocessor_data::get_chunk()
|
|||
const bool negate = command[2] == 'n';
|
||||
skip_spaces();
|
||||
const std::string& symbol = read_word();
|
||||
if(symbol.empty()) {
|
||||
parent_.error("No macro argument found after #ifdef/#ifndef directive", linenum_);
|
||||
}
|
||||
bool found = parent_.defines_->count(symbol) != 0;
|
||||
DBG_PREPROC << "testing for macro " << symbol << ": " << (found ? "defined" : "not defined");
|
||||
conditional_skip(negate ? found : !found);
|
||||
|
@ -1330,6 +1333,9 @@ bool preprocessor_data::get_chunk()
|
|||
const bool negate = command[2] == 'n';
|
||||
skip_spaces();
|
||||
const std::string& symbol = read_word();
|
||||
if(symbol.empty()) {
|
||||
parent_.error("No path argument found after #ifhave/#ifnhave directive", linenum_);
|
||||
}
|
||||
bool found = !filesystem::get_wml_location(symbol, directory_).empty();
|
||||
DBG_PREPROC << "testing for file or directory " << symbol << ": " << (found ? "found" : "not found");
|
||||
conditional_skip(negate ? found : !found);
|
||||
|
|
Loading…
Add table
Reference in a new issue