From 112dd72c01a25b57748dba74fc4cbbd31e7fc63c Mon Sep 17 00:00:00 2001 From: Greg Tucker Date: Wed, 9 Jun 2021 16:25:30 -0700 Subject: [PATCH] build: Remove unneeded file types.h The file types.h has long been misnamed and overlaps with functionality in the test helper routines. Change-Id: I774047d3a0074198b67a6b4e909f1e2ce1938195 Signed-off-by: Greg Tucker --- Doxyfile | 2 +- Makefile.am | 2 +- crc/Makefile.am | 2 +- crc/crc16_t10dif_test.c | 2 +- crc/crc32_funcs_test.c | 2 +- crc/crc64_funcs_test.c | 2 +- erasure_code/Makefile.am | 3 +- erasure_code/erasure_code_base_test.c | 2 +- erasure_code/erasure_code_test.c | 2 +- erasure_code/erasure_code_update_perf.c | 1 - erasure_code/erasure_code_update_test.c | 2 +- erasure_code/gf_vect_dot_prod_base_test.c | 2 +- erasure_code/gf_vect_dot_prod_test.c | 2 +- erasure_code/gf_vect_mad_test.c | 2 +- igzip/checksum32_funcs_test.c | 2 +- include/test.h | 32 ++++++++++ include/types.h | 77 ----------------------- make.inc | 1 - mem/Makefile.am | 3 +- mem/mem_zero_detect_perf.c | 1 - mem/mem_zero_detect_test.c | 2 +- raid/Makefile.am | 2 +- raid/pq_check_test.c | 2 +- raid/pq_gen_test.c | 2 +- raid/xor_check_test.c | 2 +- raid/xor_example.c | 1 - raid/xor_gen_test.c | 2 +- 27 files changed, 53 insertions(+), 104 deletions(-) delete mode 100644 include/types.h diff --git a/Doxyfile b/Doxyfile index d49b079..df80484 100644 --- a/Doxyfile +++ b/Doxyfile @@ -17,7 +17,7 @@ INPUT = isa-l.h \ doc/test.md \ doc/build.md -EXCLUDE = include/test.h include/types.h include/unaligned.h +EXCLUDE = include/test.h include/unaligned.h EXCLUDE_PATTERNS = */include/*_multibinary.h EXAMPLE_PATH = . crc raid erasure_code igzip PAPER_TYPE = letter diff --git a/Makefile.am b/Makefile.am index 646b855..7eaeb93 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ CLEANFILES = LDADD = AM_MAKEFLAGS = --no-print-directory noinst_HEADERS = -pkginclude_HEADERS = include/test.h include/types.h +pkginclude_HEADERS = include/test.h noinst_LTLIBRARIES = bin_PROGRAMS = INCLUDE = -I $(srcdir)/include/ diff --git a/crc/Makefile.am b/crc/Makefile.am index f12441c..1ce7a40 100644 --- a/crc/Makefile.am +++ b/crc/Makefile.am @@ -72,7 +72,7 @@ lsrc_x86_64 += \ src_include += -I $(srcdir)/crc extern_hdrs += include/crc.h include/crc64.h -other_src += include/reg_sizes.asm include/types.h include/test.h \ +other_src += include/reg_sizes.asm include/test.h \ crc/crc_ref.h crc/crc64_ref.h check_tests += crc/crc16_t10dif_test \ diff --git a/crc/crc16_t10dif_test.c b/crc/crc16_t10dif_test.c index ceb9aab..e0027de 100644 --- a/crc/crc16_t10dif_test.c +++ b/crc/crc16_t10dif_test.c @@ -32,8 +32,8 @@ #include #include #include "crc.h" -#include "types.h" #include "crc_ref.h" +#include "test.h" #ifndef TEST_SEED # define TEST_SEED 0x1234 diff --git a/crc/crc32_funcs_test.c b/crc/crc32_funcs_test.c index e28da40..17f8f53 100644 --- a/crc/crc32_funcs_test.c +++ b/crc/crc32_funcs_test.c @@ -32,8 +32,8 @@ #include #include #include "crc.h" -#include "types.h" #include "crc_ref.h" +#include "test.h" #ifndef TEST_SEED # define TEST_SEED 0x1234 diff --git a/crc/crc64_funcs_test.c b/crc/crc64_funcs_test.c index 7e4ee2b..b1b22f9 100644 --- a/crc/crc64_funcs_test.c +++ b/crc/crc64_funcs_test.c @@ -32,8 +32,8 @@ #include #include #include "crc64.h" -#include "types.h" #include "crc64_ref.h" +#include "test.h" #ifndef TEST_SEED # define TEST_SEED 0x1234 diff --git a/erasure_code/Makefile.am b/erasure_code/Makefile.am index f1d0d1d..f82b2f1 100644 --- a/erasure_code/Makefile.am +++ b/erasure_code/Makefile.am @@ -149,5 +149,4 @@ perf_tests += erasure_code/gf_vect_mul_perf \ other_tests += erasure_code/gen_rs_matrix_limits -other_src += include/test.h \ - include/types.h +other_src += include/test.h diff --git a/erasure_code/erasure_code_base_test.c b/erasure_code/erasure_code_base_test.c index 81e1b57..e327b30 100644 --- a/erasure_code/erasure_code_base_test.c +++ b/erasure_code/erasure_code_base_test.c @@ -31,7 +31,7 @@ #include #include // for memset, memcmp #include "erasure_code.h" -#include "types.h" +#include "test.h" #define TEST_LEN 8192 #define TEST_SIZE (TEST_LEN/2) diff --git a/erasure_code/erasure_code_test.c b/erasure_code/erasure_code_test.c index a1736af..b831abb 100644 --- a/erasure_code/erasure_code_test.c +++ b/erasure_code/erasure_code_test.c @@ -31,7 +31,7 @@ #include #include // for memset, memcmp #include "erasure_code.h" -#include "types.h" +#include "test.h" #define TEST_LEN 8192 #define TEST_SIZE (TEST_LEN/2) diff --git a/erasure_code/erasure_code_update_perf.c b/erasure_code/erasure_code_update_perf.c index 909e894..b600d21 100644 --- a/erasure_code/erasure_code_update_perf.c +++ b/erasure_code/erasure_code_update_perf.c @@ -31,7 +31,6 @@ #include #include // for memset, memcmp #include "erasure_code.h" -#include "types.h" #include "test.h" //By default, test multibinary version diff --git a/erasure_code/erasure_code_update_test.c b/erasure_code/erasure_code_update_test.c index f30a6a2..e48c536 100644 --- a/erasure_code/erasure_code_update_test.c +++ b/erasure_code/erasure_code_update_test.c @@ -31,7 +31,7 @@ #include #include // for memset, memcmp #include "erasure_code.h" -#include "types.h" +#include "test.h" #ifndef ALIGN_SIZE # define ALIGN_SIZE 16 diff --git a/erasure_code/gf_vect_dot_prod_base_test.c b/erasure_code/gf_vect_dot_prod_base_test.c index 2b4dfbb..675734a 100644 --- a/erasure_code/gf_vect_dot_prod_base_test.c +++ b/erasure_code/gf_vect_dot_prod_base_test.c @@ -31,7 +31,7 @@ #include #include // for memset, memcmp #include "erasure_code.h" -#include "types.h" +#include "test.h" #define TEST_LEN 8192 #define TEST_SIZE (TEST_LEN/2) diff --git a/erasure_code/gf_vect_dot_prod_test.c b/erasure_code/gf_vect_dot_prod_test.c index 1c0232c..754455a 100644 --- a/erasure_code/gf_vect_dot_prod_test.c +++ b/erasure_code/gf_vect_dot_prod_test.c @@ -31,7 +31,7 @@ #include #include // for memset, memcmp #include "erasure_code.h" -#include "types.h" +#include "test.h" #ifndef FUNCTION_UNDER_TEST # define FUNCTION_UNDER_TEST gf_vect_dot_prod diff --git a/erasure_code/gf_vect_mad_test.c b/erasure_code/gf_vect_mad_test.c index cecbc16..1db38c2 100644 --- a/erasure_code/gf_vect_mad_test.c +++ b/erasure_code/gf_vect_mad_test.c @@ -31,7 +31,7 @@ #include #include // for memset, memcmp #include "erasure_code.h" -#include "types.h" +#include "test.h" #ifndef ALIGN_SIZE # define ALIGN_SIZE 32 diff --git a/igzip/checksum32_funcs_test.c b/igzip/checksum32_funcs_test.c index cbb5d1b..c017288 100644 --- a/igzip/checksum32_funcs_test.c +++ b/igzip/checksum32_funcs_test.c @@ -33,7 +33,7 @@ #include #include "igzip_checksums.h" #include "checksum_test_ref.h" -#include "types.h" +#include "test.h" #ifndef TEST_SEED # define TEST_SEED 0x1234 diff --git a/include/test.h b/include/test.h index 31ccc67..2f4794d 100644 --- a/include/test.h +++ b/include/test.h @@ -30,6 +30,15 @@ #ifndef _TEST_H #define _TEST_H +/** + * @file test.h + * @brief Test helper include for common perf and test macros + * + * This is a helper file to enable short and simple tests. Not intended for use + * in library functions or production. Includes helper routines for alignment, + * benchmark timing, and filesize. + */ + #ifdef __cplusplus extern "C" { #endif @@ -41,6 +50,29 @@ extern "C" { # define inline __inline #endif +/* Make os-independent alignment attribute, alloc and free. */ +#if defined __unix__ || defined __APPLE__ +# define DECLARE_ALIGNED(decl, alignval) decl __attribute__((aligned(alignval))) +# define __forceinline static inline +# define aligned_free(x) free(x) +#else +# ifdef __MINGW32__ +# define DECLARE_ALIGNED(decl, alignval) decl __attribute__((aligned(alignval))) +# define posix_memalign(p, algn, len) (NULL == (*((char**)(p)) = (void*) _aligned_malloc(len, algn))) +# define aligned_free(x) _aligned_free(x) +# else +# define DECLARE_ALIGNED(decl, alignval) __declspec(align(alignval)) decl +# define posix_memalign(p, algn, len) (NULL == (*((char**)(p)) = (void*) _aligned_malloc(len, algn))) +# define aligned_free(x) _aligned_free(x) +# endif +#endif + +#ifdef DEBUG +# define DEBUG_PRINT(x) printf x +#else +# define DEBUG_PRINT(x) do {} while (0) +#endif + /* Decide wether to use benchmark time as an approximation or a minimum. Fewer * calls to the timer are required for the approximation case.*/ #define BENCHMARK_MIN_TIME 0 diff --git a/include/types.h b/include/types.h deleted file mode 100644 index 531c797..0000000 --- a/include/types.h +++ /dev/null @@ -1,77 +0,0 @@ -/********************************************************************** - Copyright(c) 2011-2015 Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**********************************************************************/ - - -/** - * @file types.h - * @brief Defines standard width types. - * - */ - -#ifndef __TYPES_H -#define __TYPES_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _WIN32 -#ifdef __MINGW32__ -# include <_mingw.h> -#endif -#endif - - -#if defined __unix__ || defined __APPLE__ -# define DECLARE_ALIGNED(decl, alignval) decl __attribute__((aligned(alignval))) -# define __forceinline static inline -# define aligned_free(x) free(x) -#else -# ifdef __MINGW32__ -# define DECLARE_ALIGNED(decl, alignval) decl __attribute__((aligned(alignval))) -# define posix_memalign(p, algn, len) (NULL == (*((char**)(p)) = (void*) _aligned_malloc(len, algn))) -# define aligned_free(x) _aligned_free(x) -# else -# define DECLARE_ALIGNED(decl, alignval) __declspec(align(alignval)) decl -# define posix_memalign(p, algn, len) (NULL == (*((char**)(p)) = (void*) _aligned_malloc(len, algn))) -# define aligned_free(x) _aligned_free(x) -# endif -#endif - -#ifdef DEBUG -# define DEBUG_PRINT(x) printf x -#else -# define DEBUG_PRINT(x) do {} while (0) -#endif - -#ifdef __cplusplus -} -#endif - -#endif //__TYPES_H diff --git a/make.inc b/make.inc index debdbf7..99e7fc0 100644 --- a/make.inc +++ b/make.inc @@ -333,7 +333,6 @@ install: $(sort $(extern_hdrs)) | $(install_dirs) $(lib_name) $(so_lib_name) isa install -m 644 $(lib_name) $(prefix)/lib/libisal.a install -m 644 $^ $(prefix)/include/isa-l/. install -m 664 isa-l.h $(prefix)/include/. - install -m 664 include/types.h $(prefix)/include/isa-l/. install -m 664 $(so_lib_name) $(prefix)/lib/$(so_lib_ver) (cd $(prefix)/lib && ln -f -s $(so_lib_ver) $(soname) && ln -f -s $(so_lib_ver) $(so_lib_inst)) ifeq ($(shell uname),Darwin) diff --git a/mem/Makefile.am b/mem/Makefile.am index c864f66..ed5acfc 100644 --- a/mem/Makefile.am +++ b/mem/Makefile.am @@ -40,8 +40,7 @@ lsrc_x86_64 += mem/mem_zero_detect_avx.asm \ extern_hdrs += include/mem_routines.h -other_src += include/test.h \ - include/types.h +other_src += include/test.h check_tests += mem/mem_zero_detect_test diff --git a/mem/mem_zero_detect_perf.c b/mem/mem_zero_detect_perf.c index 90a3088..abdc0b0 100644 --- a/mem/mem_zero_detect_perf.c +++ b/mem/mem_zero_detect_perf.c @@ -32,7 +32,6 @@ #include #include "mem_routines.h" #include "test.h" -#include "types.h" #define TEST_LEN 8*1024 #define TEST_TYPE_STR "_warm" diff --git a/mem/mem_zero_detect_test.c b/mem/mem_zero_detect_test.c index 12d5f4b..292fc68 100644 --- a/mem/mem_zero_detect_test.c +++ b/mem/mem_zero_detect_test.c @@ -32,7 +32,7 @@ #include #include #include "mem_routines.h" -#include "types.h" +#include "test.h" #define TEST_MEM 10*1024*1024 #define TEST_LEN 8*1024 diff --git a/raid/Makefile.am b/raid/Makefile.am index 5f98668..854f258 100644 --- a/raid/Makefile.am +++ b/raid/Makefile.am @@ -56,7 +56,7 @@ lsrc_x86_32 += \ extern_hdrs += include/raid.h -other_src += include/test.h include/types.h +other_src += include/test.h check_tests += raid/xor_gen_test raid/pq_gen_test raid/xor_check_test raid/pq_check_test diff --git a/raid/pq_check_test.c b/raid/pq_check_test.c index 27d0203..71c29b5 100644 --- a/raid/pq_check_test.c +++ b/raid/pq_check_test.c @@ -32,7 +32,7 @@ #include #include #include "raid.h" -#include "types.h" +#include "test.h" #define TEST_SOURCES 16 #define TEST_LEN 1024 diff --git a/raid/pq_gen_test.c b/raid/pq_gen_test.c index 3469f7e..7b97ebf 100644 --- a/raid/pq_gen_test.c +++ b/raid/pq_gen_test.c @@ -33,7 +33,7 @@ #include #include #include "raid.h" -#include "types.h" +#include "test.h" #define TEST_SOURCES 16 #define TEST_LEN 1024 diff --git a/raid/xor_check_test.c b/raid/xor_check_test.c index c753207..b0397d5 100644 --- a/raid/xor_check_test.c +++ b/raid/xor_check_test.c @@ -32,7 +32,7 @@ #include #include #include "raid.h" -#include "types.h" +#include "test.h" #define TEST_SOURCES 16 #define TEST_LEN 1024 diff --git a/raid/xor_example.c b/raid/xor_example.c index 48145ac..1a38ac0 100644 --- a/raid/xor_example.c +++ b/raid/xor_example.c @@ -29,7 +29,6 @@ #include #include #include "raid.h" -#include "types.h" #define TEST_SOURCES 16 #define TEST_LEN 16*1024 diff --git a/raid/xor_gen_test.c b/raid/xor_gen_test.c index ee922bf..b624ba1 100644 --- a/raid/xor_gen_test.c +++ b/raid/xor_gen_test.c @@ -32,7 +32,7 @@ #include #include #include "raid.h" -#include "types.h" +#include "test.h" #define TEST_SOURCES 16 #define TEST_LEN 1024