aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorRamsay Jones <ramsay@ramsayjones.plus.com>2018-11-19 20:51:33 +0000
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-11-24 18:29:01 +0100
commit5607ba28a4e67dd549cd2b7420f4bbe251d85a88 (patch)
treeb0680e82919e982f88c30c72e0569531d1a71d16 /validation
parentea3b2526d48aba9e5f3d30e1ce6e81cb12e9cacc (diff)
downloadsparse-dev-5607ba28a4e67dd549cd2b7420f4bbe251d85a88.tar.gz
pre-process: print variable argument macros correctly
The dump_macros() function fails to correctly output the definition of macros that have a variable argument list. For example, the following macros: #define unlocks(...) annotate(unlock_func(__VA_ARGS__)) #define apply(x,...) x(__VA_ARGS__) are output like so: #define unlocks(__VA_ARGS__) annotate(unlock_func(__VA_ARGS__)) #define apply(x,__VA_ARGS__) x(__VA_ARGS__) Add the code necessary to print the ellipsis in the argument list to the dump_macros() function and add the above macros to the 'dump-macros.c' test file. Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/preprocessor/dump-macros.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/validation/preprocessor/dump-macros.c b/validation/preprocessor/dump-macros.c
index f8983d82..6940a20c 100644
--- a/validation/preprocessor/dump-macros.c
+++ b/validation/preprocessor/dump-macros.c
@@ -9,6 +9,9 @@
#define STRING(x) #x
#define CONCAT(x,y) x ## y
+
+#define unlocks(...) annotate(unlock_func(__VA_ARGS__))
+#define apply(x,...) x(__VA_ARGS__)
/*
* check-name: dump-macros
* check-command: sparse -E -dD -DIJK=ijk -UNDEF -UNYDEF $file
@@ -20,4 +23,6 @@ check-output-contains: #define DEF xyz
check-output-contains: #define NYDEF ydef
check-output-contains: #define STRING(x) #x
check-output-contains: #define CONCAT(x,y) x ## y
+check-output-contains: #define unlocks(...) annotate(unlock_func(__VA_ARGS__))
+check-output-contains: #define apply(x,...) x(__VA_ARGS__)
*/