diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-13 10:51:31 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-13 10:51:31 +0200 |
commit | f9e11b40856ec26d721d174384e6e3261d23e30d (patch) | |
tree | 642957dee8b58abdfcc31b30f4840d4f019731ba | |
parent | work (diff) | |
download | calp-f9e11b40856ec26d721d174384e6e3261d23e30d.tar.gz calp-f9e11b40856ec26d721d174384e6e3261d23e30d.tar.xz |
Ensure #error works.
-rw-r--r-- | module/c/preprocessor2.scm | 3 | ||||
-rw-r--r-- | tests/test/cpp/preprocessor2.scm | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/module/c/preprocessor2.scm b/module/c/preprocessor2.scm index d7bf3b64..ee6f2d9f 100644 --- a/module/c/preprocessor2.scm +++ b/module/c/preprocessor2.scm @@ -642,7 +642,8 @@ ((define) resolve-define) ((undef) (lambda (env body) (remove-identifier env (identifier-token? (car body))))) ((line) handle-line-directive) - ((error) (lambda (_ body) (throw 'cpp-error body))) + ((error) (lambda (_ tokens) + (throw 'cpp-error-directive (unlex tokens)))) ((pragma) handle-pragma) (else (err "Unknown preprocessing directive: ~s" (list line-tokens)))))) diff --git a/tests/test/cpp/preprocessor2.scm b/tests/test/cpp/preprocessor2.scm index 39bbd39c..9b71e1ca 100644 --- a/tests/test/cpp/preprocessor2.scm +++ b/tests/test/cpp/preprocessor2.scm @@ -762,8 +762,9 @@ X ") ) -;; TODO -;; #error +(test-error "#error directive" + 'cpp-error-directive + (run "#error anything goes here")) (test-group "Pragma" (test-group "#pragma" |