summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-02 08:33:10 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-02 08:33:10 +0000
commit2c8432b4fe1c4e900706ee5a4fbd6015f85becea (patch)
tree00863d3afb0eba2db3a3961f50d9cf737dd75936 /gcc/testsuite
parent5a51daf4801c63c652aa604071bf3b0f9e3bea87 (diff)
downloadgcc-2c8432b4fe1c4e900706ee5a4fbd6015f85becea.tar.gz
2014-10-02 Basile Starynkevitch <basile@starynkevitch.net>
* testsuite/melt/tletmacro-3.melt: New file. * testsuite/melt/tletmacro-3-loaded.melt: New file. * melt/warmelt-macro.melt (mexpand_load): More debug. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@215797 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/melt/tletmacro-3-loaded.melt6
-rw-r--r--gcc/testsuite/melt/tletmacro-3.melt39
2 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/melt/tletmacro-3-loaded.melt b/gcc/testsuite/melt/tletmacro-3-loaded.melt
new file mode 100644
index 00000000000..bd2e855a36d
--- /dev/null
+++ b/gcc/testsuite/melt/tletmacro-3-loaded.melt
@@ -0,0 +1,6 @@
+;; file tletmacro-3-loaded.melt in -*- Lisp -*-
+;; see file tletmacro-3.melt which loads this file
+(loadedmac aa)
+(loadedmac bb)
+(loadedmac cc)
+;; eof tletmacro-3-loaded.melt
diff --git a/gcc/testsuite/melt/tletmacro-3.melt b/gcc/testsuite/melt/tletmacro-3.melt
new file mode 100644
index 00000000000..bdcd283a094
--- /dev/null
+++ b/gcc/testsuite/melt/tletmacro-3.melt
@@ -0,0 +1,39 @@
+;; file tletmacro-3.melt -*- lisp -*-
+;; this sample code is in the public domain
+#| run in buildir/gcc
+ ln -sv $GCCMELT_SOURCE/gcc/testsuite/melt/tletmacro-3.melt
+ ln -sv $GCCMELT_SOURCE/gcc/testsuite/melt/tletmacro-3-loaded.melt
+
+ ./cc1 -fmelt-mode=runfile @meltbuild-common.args -Iinclude/ \
+ -fmelt-init=@warmelt.quicklybuilt -fmelt-arg=tletmacro-3.melt \
+ /dev/null -o /dev/null
+## perhaps also: -fmelt-debugging=all -fmelt-out-descr-comment
+
+or in a MELT module
+
+gcc -fplugin=melt -fplugin-arg-melt-mode=runfile @meltbuild-common.args \
+ -fplugin-arg-melt-init=@melt-default-modules.quicklybuilt -fplugin-arg-melt-arg=tletmacro-3.melt \
+ -c -x c /dev/null -o /dev/null
+|#
+(module_is_gpl_compatible "public domain")
+
+(let (
+ (the_stdout (unsafe_get_field :sysdata_stdout initial_system_data))
+ (:macro loadedmac (sexp env mexpander modctx)
+ (debug "macro loadedmac" " sexp=" sexp)
+ (let ( (arg1 (list_nth (usafe_get_field :sexp_contents sexp) 1))
+ (sloc (unsafe_get_field :loca_location sexp))
+ (sline (get_int sloc))
+ (res (instance class_source_apply
+ :loca_location sloc
+ :sapp_fun 'add2out
+ :sargop_args (tuple 'the_stdout "loadedmac@" sline ":" arg1)))
+ )
+ (debug "macro loadedmac" " arg1=" arg1 " sline=" sline
+ "\n.. res=" res)
+ res))
+ )
+ (debug "before loading tletmacro-3-loaded")
+ (load "tletmacro-3-loaded.melt")
+ (debug "after loading tletmacro-3-loaded")
+ )