commit 2cfcb7b364541c27749ae0df73eabd7a56797f93 Author: Nick Mathewson nickm@torproject.org Date: Thu Jun 21 09:53:08 2018 -0400
Extract error functionality into a new lowest-level library. --- .gitignore | 4 ++++ Makefile.am | 2 ++ src/common/include.am | 4 ---- src/include.am | 3 ++- src/{common => lib/err}/backtrace.c | 0 src/{common => lib/err}/backtrace.h | 0 src/lib/err/include.am | 17 +++++++++++++++++ src/{common => lib/err}/torerr.c | 0 src/{common => lib/err}/torerr.h | 0 src/rust/build.rs | 3 ++- 10 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/.gitignore b/.gitignore index b3b13694a..517022399 100644 --- a/.gitignore +++ b/.gitignore @@ -166,6 +166,10 @@ uptime-*.json /src/ext/keccak-tiny/libkeccak-tiny.a /src/ext/keccak-tiny/libkeccak-tiny.lib
+# /src/lib +/src/lib/libtor-err.a +/src/lib/libtor-err-testing.a + # /src/or/ /src/or/Makefile /src/or/Makefile.in diff --git a/Makefile.am b/Makefile.am index 579b9a089..6c60de111 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,12 +40,14 @@ endif # "Common" libraries used to link tor's utility code. TOR_UTIL_LIBS = \ src/common/libor.a \ + src/lib/libtor-err.a \ src/common/libor-ctime.a
# Variants of the above for linking the testing variant of tor (for coverage # and tests) TOR_UTIL_TESTING_LIBS = \ src/common/libor-testing.a \ + src/lib/libtor-err-testing.a \ src/common/libor-ctime-testing.a
# Internal crypto libraries used in Tor diff --git a/src/common/include.am b/src/common/include.am index 8afec9c05..533703486 100644 --- a/src/common/include.am +++ b/src/common/include.am @@ -82,7 +82,6 @@ src_common_libor_ctime_testing_a_CFLAGS = @CFLAGS_CONSTTIME@ $(TEST_CFLAGS) LIBOR_A_SRC = \ src/common/address.c \ src/common/address_set.c \ - src/common/backtrace.c \ src/common/buffers.c \ src/common/compat.c \ src/common/compat_threads.c \ @@ -99,7 +98,6 @@ LIBOR_A_SRC = \ src/common/sandbox.c \ src/common/storagedir.c \ src/common/token_bucket.c \ - src/common/torerr.c \ src/common/workqueue.c \ $(libor_extra_source) \ $(threads_impl_source) \ @@ -161,7 +159,6 @@ src_common_libor_event_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) COMMONHEADERS = \ src/common/address.h \ src/common/address_set.h \ - src/common/backtrace.h \ src/common/buffers.h \ src/common/buffers_tls.h \ src/common/aes.h \ @@ -203,7 +200,6 @@ COMMONHEADERS = \ src/common/testsupport.h \ src/common/timers.h \ src/common/token_bucket.h \ - src/common/torerr.h \ src/common/torint.h \ src/common/torlog.h \ src/common/tortls.h \ diff --git a/src/include.am b/src/include.am index 90ecf90d4..424481485 100644 --- a/src/include.am +++ b/src/include.am @@ -1,6 +1,7 @@ include src/ext/include.am -include src/trunnel/include.am +include src/lib/err/include.am include src/common/include.am +include src/trunnel/include.am include src/or/include.am include src/rust/include.am include src/test/include.am diff --git a/src/common/backtrace.c b/src/lib/err/backtrace.c similarity index 100% rename from src/common/backtrace.c rename to src/lib/err/backtrace.c diff --git a/src/common/backtrace.h b/src/lib/err/backtrace.h similarity index 100% rename from src/common/backtrace.h rename to src/lib/err/backtrace.h diff --git a/src/lib/err/include.am b/src/lib/err/include.am new file mode 100644 index 000000000..257ba3004 --- /dev/null +++ b/src/lib/err/include.am @@ -0,0 +1,17 @@ + +noinst_LIBRARIES += src/lib/libtor-err.a + +if UNITTESTS_ENABLED +noinst_LIBRARIES += src/lib/libtor-err-testing.a +endif + +src_lib_libtor_err_a_SOURCES = \ + src/lib/err/backtrace.c \ + src/lib/err/torerr.c + +src_lib_libtor_err_testing_a_SOURCES = \ + $(src_lib_libtor_err_a_SOURCES) + +noinst_HEADERS += \ + src/lib/err/backtrace.h \ + src/lib/err/torerr.h diff --git a/src/common/torerr.c b/src/lib/err/torerr.c similarity index 100% rename from src/common/torerr.c rename to src/lib/err/torerr.c diff --git a/src/common/torerr.h b/src/lib/err/torerr.h similarity index 100% rename from src/common/torerr.h rename to src/lib/err/torerr.h diff --git a/src/rust/build.rs b/src/rust/build.rs index b943aa553..32000b12f 100644 --- a/src/rust/build.rs +++ b/src/rust/build.rs @@ -138,9 +138,9 @@ pub fn main() { cfg.from_cflags("TOR_LDFLAGS_openssl"); cfg.from_cflags("TOR_LDFLAGS_libevent");
+ cfg.link_relpath("src/lib"); cfg.link_relpath("src/common"); cfg.link_relpath("src/ext/keccak-tiny"); - cfg.link_relpath("src/ext/keccak-tiny"); cfg.link_relpath("src/ext/ed25519/ref10"); cfg.link_relpath("src/ext/ed25519/donna"); cfg.link_relpath("src/trunnel"); @@ -152,6 +152,7 @@ pub fn main() { cfg.component("or-crypto-testing"); cfg.component("or-ctime-testing"); cfg.component("or-testing"); + cfg.component("tor-err-testing"); cfg.component("or-event-testing"); cfg.component("or-ctime-testing"); cfg.component("curve25519_donna");
tor-commits@lists.torproject.org