forked from alex-eg/sex
do not mangle an include's target
A target is a filename, and the ː separator turned GL/gl.h into GLːgl.h, so every program including a header from a subdirectory stopped compiling the moment qualified names got their separator.
This commit is contained in:
@@ -492,6 +492,9 @@ forms, and what remains."
|
||||
((or ('struct . _)
|
||||
('union . _)) (walk-struct form))
|
||||
(('enum . _) (walk-enum form))
|
||||
;; A target is a filename and not an identifier: GL/gl.h is a path,
|
||||
;; and unkebabify would spell it GLːgl.h
|
||||
(('include target) (list '%include target))
|
||||
(('define name . rest) `(%define ,(atom-to-fmt-c name) ,@rest))
|
||||
(else (walk-expr form))))
|
||||
|
||||
|
||||
@@ -394,6 +394,16 @@ compiles."
|
||||
(fn f ((c (closure ((int)) int))) int (return (g c)))"
|
||||
"g(c)")))
|
||||
|
||||
;; An include target is a path, so none of the identifier mangling
|
||||
;; applies to it: GL/gl.h is a file and GLːgl.h is not.
|
||||
(test-group "include targets are paths"
|
||||
(test-assert "a slash survives"
|
||||
(emits? "(include SDL3/SDL.h)" "#include <SDL3/SDL.h>"))
|
||||
(test-assert "and so does a dash"
|
||||
(emits? "(include my-header.h)" "#include <my-header.h>"))
|
||||
(test-assert "pub include emits the same"
|
||||
(emits? "(pub include GL/gl.h)" "#include <GL/gl.h>")))
|
||||
|
||||
;; The walker offered WALK-FN the cdr of every form as well as the
|
||||
;; form, so the tail (t) of (fn g () t) read as a call to a macro
|
||||
;; named t, and any function returning a type that shared a name
|
||||
|
||||
Reference in New Issue
Block a user