diff options
author | Daiki Ueno <dueno@redhat.com> | 2018-01-31 10:27:43 +0100 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2018-01-31 15:51:28 +0100 |
commit | 3a88f2ed573a5bb04d2397c626f6bcf3b1a814da (patch) | |
tree | 70afbb882307a7cf447bff109e5b48a31cfe9cec | |
parent | 57697eda68a3343c2e54e5f8f3f4ce65a99383f5 (diff) |
build: Split out generated code from p11-kit/virtual.c
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | p11-kit/Makefile.am | 34 | ||||
-rw-r--r-- | p11-kit/virtual-fixed.h | 3 | ||||
-rw-r--r-- | p11-kit/virtual.c | 197 |
6 files changed, 51 insertions, 199 deletions
@@ -103,6 +103,7 @@ x86_64-w64-mingw32 /p11-kit/p11-kit-1.pc /p11-kit/pkcs11.conf.example /p11-kit/p11-kit-remote@.service +/p11-kit/virtual-fixed.c /po/POTFILES /po/stamp-po diff --git a/Makefile.am b/Makefile.am index 94d1bea..b6d3fb8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,8 @@ check_PROGRAMS = $(c_tests) check_SCRIPTS = $(sh_tests) check_LTLIBRARIES = +BUILT_SOURCES = + CLEANFILES = EXTRA_DIST = HACKING diff --git a/configure.ac b/configure.ac index 6f49ed4..dde92b4 100644 --- a/configure.ac +++ b/configure.ac @@ -217,6 +217,19 @@ fi AM_CONDITIONAL(WITH_FFI, test "$with_libffi" = "yes") +AC_ARG_WITH([closures], + [AS_HELP_STRING([--with-closures[=NUM]], + [the number of precompiled closures, used when libffi is unavailable])], + [closures=$withval], + [closures=64]) + +if test "$closures" -lt 1; then + AC_MSG_ERROR([at least one closure must be compiled in]) +fi + +AC_DEFINE_UNQUOTED(P11_VIRTUAL_MAX_FIXED, [$closures], [the number of closures]) +AC_SUBST(closures) + # -------------------------------------------------------------------- # Hash implementation diff --git a/p11-kit/Makefile.am b/p11-kit/Makefile.am index 303fe06..243ee54 100644 --- a/p11-kit/Makefile.am +++ b/p11-kit/Makefile.am @@ -28,6 +28,40 @@ COMMON_SRCS = \ p11-kit/virtual-fixed.h \ $(inc_HEADERS) +BUILT_SOURCES += \ + p11-kit/virtual-fixed.c \ + $(NULL) + +CLEANFILES += \ + p11-kit/virtual-fixed.c \ + $(NULL) + +p11-kit/virtual-fixed.c: Makefile + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + echo; \ + counter=0; \ + while test $$counter -lt $(closures); do \ + echo "P11_VIRTUAL_FIXED_FUNCTIONS($$counter)"; \ + counter=`expr $$counter + 1`; \ + done; \ + echo; \ + echo "CK_FUNCTION_LIST p11_virtual_fixed[P11_VIRTUAL_MAX_FIXED] = {"; \ + counter=0; \ + while test $$counter -lt $(closures); do \ + echo " P11_VIRTUAL_FIXED_INITIALIZER($$counter),"; \ + counter=`expr $$counter + 1`; \ + done; \ + echo '};'; \ + echo; \ + counter=0; \ + while test $$counter -lt $(closures); do \ + echo "P11_VIRTUAL_FIXED_GET_FUNCTION_LIST($$counter)"; \ + counter=`expr $$counter + 1`; \ + done; \ + } > $@-t && \ + mv -f $@-t $@ + lib_LTLIBRARIES += \ libp11-kit.la diff --git a/p11-kit/virtual-fixed.h b/p11-kit/virtual-fixed.h index 1357522..bd74d8e 100644 --- a/p11-kit/virtual-fixed.h +++ b/p11-kit/virtual-fixed.h @@ -35,9 +35,6 @@ #ifndef __P11_VIRTUAL_FIXED_H__ #define __P11_VIRTUAL_FIXED_H__ -/* The maximum number of precompiled closures. */ -#define P11_VIRTUAL_MAX_FIXED 64 - #define P11_VIRTUAL_FIXED_FUNCTIONS(fixed_index) \ static CK_RV \ fixed ## fixed_index ## _C_Initialize (CK_VOID_PTR init_args) \ diff --git a/p11-kit/virtual.c b/p11-kit/virtual.c index a2853bb..67b3eed 100644 --- a/p11-kit/virtual.c +++ b/p11-kit/virtual.c @@ -3045,202 +3045,7 @@ CK_X_FUNCTION_LIST p11_virtual_base = { base_C_WaitForSlotEvent }; -P11_VIRTUAL_FIXED_FUNCTIONS(0) -P11_VIRTUAL_FIXED_FUNCTIONS(1) -P11_VIRTUAL_FIXED_FUNCTIONS(2) -P11_VIRTUAL_FIXED_FUNCTIONS(3) -P11_VIRTUAL_FIXED_FUNCTIONS(4) -P11_VIRTUAL_FIXED_FUNCTIONS(5) -P11_VIRTUAL_FIXED_FUNCTIONS(6) -P11_VIRTUAL_FIXED_FUNCTIONS(7) -P11_VIRTUAL_FIXED_FUNCTIONS(8) -P11_VIRTUAL_FIXED_FUNCTIONS(9) -P11_VIRTUAL_FIXED_FUNCTIONS(10) -P11_VIRTUAL_FIXED_FUNCTIONS(11) -P11_VIRTUAL_FIXED_FUNCTIONS(12) -P11_VIRTUAL_FIXED_FUNCTIONS(13) -P11_VIRTUAL_FIXED_FUNCTIONS(14) -P11_VIRTUAL_FIXED_FUNCTIONS(15) -P11_VIRTUAL_FIXED_FUNCTIONS(16) -P11_VIRTUAL_FIXED_FUNCTIONS(17) -P11_VIRTUAL_FIXED_FUNCTIONS(18) -P11_VIRTUAL_FIXED_FUNCTIONS(19) -P11_VIRTUAL_FIXED_FUNCTIONS(20) -P11_VIRTUAL_FIXED_FUNCTIONS(21) -P11_VIRTUAL_FIXED_FUNCTIONS(22) -P11_VIRTUAL_FIXED_FUNCTIONS(23) -P11_VIRTUAL_FIXED_FUNCTIONS(24) -P11_VIRTUAL_FIXED_FUNCTIONS(25) -P11_VIRTUAL_FIXED_FUNCTIONS(26) -P11_VIRTUAL_FIXED_FUNCTIONS(27) -P11_VIRTUAL_FIXED_FUNCTIONS(28) -P11_VIRTUAL_FIXED_FUNCTIONS(29) -P11_VIRTUAL_FIXED_FUNCTIONS(30) -P11_VIRTUAL_FIXED_FUNCTIONS(31) -P11_VIRTUAL_FIXED_FUNCTIONS(32) -P11_VIRTUAL_FIXED_FUNCTIONS(33) -P11_VIRTUAL_FIXED_FUNCTIONS(34) -P11_VIRTUAL_FIXED_FUNCTIONS(35) -P11_VIRTUAL_FIXED_FUNCTIONS(36) -P11_VIRTUAL_FIXED_FUNCTIONS(37) -P11_VIRTUAL_FIXED_FUNCTIONS(38) -P11_VIRTUAL_FIXED_FUNCTIONS(39) -P11_VIRTUAL_FIXED_FUNCTIONS(40) -P11_VIRTUAL_FIXED_FUNCTIONS(41) -P11_VIRTUAL_FIXED_FUNCTIONS(42) -P11_VIRTUAL_FIXED_FUNCTIONS(43) -P11_VIRTUAL_FIXED_FUNCTIONS(44) -P11_VIRTUAL_FIXED_FUNCTIONS(45) -P11_VIRTUAL_FIXED_FUNCTIONS(46) -P11_VIRTUAL_FIXED_FUNCTIONS(47) -P11_VIRTUAL_FIXED_FUNCTIONS(48) -P11_VIRTUAL_FIXED_FUNCTIONS(49) -P11_VIRTUAL_FIXED_FUNCTIONS(50) -P11_VIRTUAL_FIXED_FUNCTIONS(51) -P11_VIRTUAL_FIXED_FUNCTIONS(52) -P11_VIRTUAL_FIXED_FUNCTIONS(53) -P11_VIRTUAL_FIXED_FUNCTIONS(54) -P11_VIRTUAL_FIXED_FUNCTIONS(55) -P11_VIRTUAL_FIXED_FUNCTIONS(56) -P11_VIRTUAL_FIXED_FUNCTIONS(57) -P11_VIRTUAL_FIXED_FUNCTIONS(58) -P11_VIRTUAL_FIXED_FUNCTIONS(59) -P11_VIRTUAL_FIXED_FUNCTIONS(60) -P11_VIRTUAL_FIXED_FUNCTIONS(61) -P11_VIRTUAL_FIXED_FUNCTIONS(62) -P11_VIRTUAL_FIXED_FUNCTIONS(63) - -CK_FUNCTION_LIST p11_virtual_fixed[P11_VIRTUAL_MAX_FIXED] = { - P11_VIRTUAL_FIXED_INITIALIZER(0), \ - P11_VIRTUAL_FIXED_INITIALIZER(1), \ - P11_VIRTUAL_FIXED_INITIALIZER(2), \ - P11_VIRTUAL_FIXED_INITIALIZER(3), \ - P11_VIRTUAL_FIXED_INITIALIZER(4), \ - P11_VIRTUAL_FIXED_INITIALIZER(5), \ - P11_VIRTUAL_FIXED_INITIALIZER(6), \ - P11_VIRTUAL_FIXED_INITIALIZER(7), \ - P11_VIRTUAL_FIXED_INITIALIZER(8), \ - P11_VIRTUAL_FIXED_INITIALIZER(9), \ - P11_VIRTUAL_FIXED_INITIALIZER(10), \ - P11_VIRTUAL_FIXED_INITIALIZER(11), \ - P11_VIRTUAL_FIXED_INITIALIZER(12), \ - P11_VIRTUAL_FIXED_INITIALIZER(13), \ - P11_VIRTUAL_FIXED_INITIALIZER(14), \ - P11_VIRTUAL_FIXED_INITIALIZER(15), \ - P11_VIRTUAL_FIXED_INITIALIZER(16), \ - P11_VIRTUAL_FIXED_INITIALIZER(17), \ - P11_VIRTUAL_FIXED_INITIALIZER(18), \ - P11_VIRTUAL_FIXED_INITIALIZER(19), \ - P11_VIRTUAL_FIXED_INITIALIZER(20), \ - P11_VIRTUAL_FIXED_INITIALIZER(21), \ - P11_VIRTUAL_FIXED_INITIALIZER(22), \ - P11_VIRTUAL_FIXED_INITIALIZER(23), \ - P11_VIRTUAL_FIXED_INITIALIZER(24), \ - P11_VIRTUAL_FIXED_INITIALIZER(25), \ - P11_VIRTUAL_FIXED_INITIALIZER(26), \ - P11_VIRTUAL_FIXED_INITIALIZER(27), \ - P11_VIRTUAL_FIXED_INITIALIZER(28), \ - P11_VIRTUAL_FIXED_INITIALIZER(29), \ - P11_VIRTUAL_FIXED_INITIALIZER(30), \ - P11_VIRTUAL_FIXED_INITIALIZER(31), \ - P11_VIRTUAL_FIXED_INITIALIZER(32), \ - P11_VIRTUAL_FIXED_INITIALIZER(33), \ - P11_VIRTUAL_FIXED_INITIALIZER(34), \ - P11_VIRTUAL_FIXED_INITIALIZER(35), \ - P11_VIRTUAL_FIXED_INITIALIZER(36), \ - P11_VIRTUAL_FIXED_INITIALIZER(37), \ - P11_VIRTUAL_FIXED_INITIALIZER(38), \ - P11_VIRTUAL_FIXED_INITIALIZER(39), \ - P11_VIRTUAL_FIXED_INITIALIZER(40), \ - P11_VIRTUAL_FIXED_INITIALIZER(41), \ - P11_VIRTUAL_FIXED_INITIALIZER(42), \ - P11_VIRTUAL_FIXED_INITIALIZER(43), \ - P11_VIRTUAL_FIXED_INITIALIZER(44), \ - P11_VIRTUAL_FIXED_INITIALIZER(45), \ - P11_VIRTUAL_FIXED_INITIALIZER(46), \ - P11_VIRTUAL_FIXED_INITIALIZER(47), \ - P11_VIRTUAL_FIXED_INITIALIZER(48), \ - P11_VIRTUAL_FIXED_INITIALIZER(49), \ - P11_VIRTUAL_FIXED_INITIALIZER(50), \ - P11_VIRTUAL_FIXED_INITIALIZER(51), \ - P11_VIRTUAL_FIXED_INITIALIZER(52), \ - P11_VIRTUAL_FIXED_INITIALIZER(53), \ - P11_VIRTUAL_FIXED_INITIALIZER(54), \ - P11_VIRTUAL_FIXED_INITIALIZER(55), \ - P11_VIRTUAL_FIXED_INITIALIZER(56), \ - P11_VIRTUAL_FIXED_INITIALIZER(57), \ - P11_VIRTUAL_FIXED_INITIALIZER(58), \ - P11_VIRTUAL_FIXED_INITIALIZER(59), \ - P11_VIRTUAL_FIXED_INITIALIZER(60), \ - P11_VIRTUAL_FIXED_INITIALIZER(61), \ - P11_VIRTUAL_FIXED_INITIALIZER(62), \ - P11_VIRTUAL_FIXED_INITIALIZER(63) -}; - -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(0) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(1) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(2) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(3) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(4) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(5) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(6) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(7) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(8) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(9) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(10) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(11) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(12) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(13) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(14) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(15) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(16) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(17) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(18) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(19) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(20) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(21) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(22) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(23) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(24) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(25) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(26) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(27) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(28) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(29) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(30) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(31) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(32) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(33) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(34) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(35) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(36) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(37) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(38) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(39) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(40) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(41) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(42) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(43) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(44) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(45) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(46) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(47) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(48) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(49) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(50) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(51) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(52) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(53) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(54) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(55) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(56) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(57) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(58) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(59) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(60) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(61) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(62) -P11_VIRTUAL_FIXED_GET_FUNCTION_LIST(63) +#include "p11-kit/virtual-fixed.c" static CK_FUNCTION_LIST * p11_virtual_wrap_fixed (p11_virtual *virt, |