Make unknown preprocessor directives a warning rather than an error.
This is what the "old" preprocessor does; it's more useful at the moment.
This commit is contained in:
parent
1fc6dcd0e9
commit
065df28bbc
|
@ -88,7 +88,12 @@ type DirectiveFunc = Meta -> [String] -> PassM ([Token] -> [Token])
|
||||||
handleDirective :: Meta -> String -> PassM ([Token] -> [Token])
|
handleDirective :: Meta -> String -> PassM ([Token] -> [Token])
|
||||||
handleDirective m s = lookup s directives
|
handleDirective m s = lookup s directives
|
||||||
where
|
where
|
||||||
lookup s [] = dieP m "Unknown preprocessor directive"
|
-- FIXME: This should really be an error rather than a warning, but
|
||||||
|
-- currently we support so few preprocessor directives that this is more
|
||||||
|
-- useful.
|
||||||
|
lookup s []
|
||||||
|
= do addWarning m "Unknown preprocessor directive ignored"
|
||||||
|
return id
|
||||||
lookup s ((re, func):ds)
|
lookup s ((re, func):ds)
|
||||||
= case matchRegex re s of
|
= case matchRegex re s of
|
||||||
Just fields -> func m fields
|
Just fields -> func m fields
|
||||||
|
|
Loading…
Reference in New Issue
Block a user