diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-03-24 22:58:54 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-03-24 22:58:54 -0700 |
commit | 7ff3eec770fec644870762c31f433c497ee93f05 (patch) | |
tree | f6fb8368601cbb67f6ca3158189dfe017a3291c4 | |
parent | f7dd08d2791fa4cdb45e494fe604e2017bfcb49b (diff) | |
download | cppawk-7ff3eec770fec644870762c31f433c497ee93f05.tar.gz cppawk-7ff3eec770fec644870762c31f433c497ee93f05.tar.bz2 cppawk-7ff3eec770fec644870762c31f433c497ee93f05.zip |
New --dump-macros option.
-rwxr-xr-x | cppawk | 5 | ||||
-rw-r--r-- | cppawk.1 | 7 | ||||
-rw-r--r-- | testcases | 5 |
3 files changed, 17 insertions, 0 deletions
@@ -30,6 +30,7 @@ # site configuration prepro=cpp incopt=-iquote # GNU extension: must be changed to -I for traditional cpp +dumpopt=-dM # GNU cpp option to dump macros awk=gawk prepro_opts="-D__gawk__=1 -D__cppawk_ver=20220324" @@ -137,6 +138,10 @@ while [ $# -gt 0 ] ; do --nobash ) bash= ;; + --dump-macros ) + prepro_opts="$prepro_opts $dumpopt" + prepro_only=y + ;; -U* | -D* | -I* | -iquote* ) prepro_opts="$prepro_opts $(quote "$1")" ;; @@ -90,6 +90,13 @@ Pretend that the shell which executes isn't GNU Bash, even if it is. This has the effect of disabling the use of process substitution in favor of the use of a temporary file. +.IP "\fB\-\-dump-macros\fR" +Instruct the preprocessor to dump all of the +.BI #define +directives instead of the preprocessed output. Since this is only useful with +.BI --prepro-only +that option is implied. + .IP "\fB\-M\fR, \fB\--bignum\fR" These two equivalent GNU Awk options are passed through to .BR awk , @@ -240,3 +240,8 @@ BEGIN { print __LINE__ $cppawk -f testdir/name.cwk : testdir/name.cwk +-- +42: +$cppawk --dump-macros '#define foo_bar 42' | grep foo_bar +: +#define foo_bar 42 |