From 17e371fffe3d0a25936e64f8b2f87b9f5d73c0a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Nov 2018 21:48:45 +0200 Subject: [PATCH] More InnoDB preprocessor cleanup Remove unnecessary #include. Remove references to UNIV_MATERIALIZE, UNIV_INLINE_ORIGINAL, UNIV_NONINL that are never defined. --- extra/innochecksum.cc | 16 +--------------- storage/innobase/buf/buf0buf.cc | 14 +++----------- storage/innobase/fil/fil0crypt.cc | 10 +++++----- storage/innobase/include/buf0buddy.h | 5 ----- storage/innobase/include/buf0buddy.ic | 10 ---------- storage/innobase/include/fil0crypt.h | 2 -- storage/innobase/include/fil0fil.h | 3 ++- storage/innobase/include/fsp0fsp.h | 8 ++++---- storage/innobase/include/fsp0types.h | 7 +------ storage/innobase/include/fut0fut.h | 1 - storage/innobase/include/fut0lst.h | 9 +++++---- storage/innobase/include/page0cur.ic | 5 ----- storage/innobase/include/page0page.h | 20 +++++--------------- storage/innobase/include/page0page.ic | 13 ------------- storage/innobase/include/page0zip.h | 23 +---------------------- storage/innobase/include/page0zip.ic | 10 ---------- storage/innobase/include/srv0srv.h | 1 - storage/innobase/include/ut0ut.h | 12 ++++++------ storage/innobase/page/page0page.cc | 1 + storage/innobase/page/page0zip.cc | 14 ++++++-------- 20 files changed, 40 insertions(+), 144 deletions(-) diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index e4b81dff34c..0eb2b9aba71 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2014, 2017, MariaDB Corporation. + Copyright (c) 2014, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,15 +45,7 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */ typedef void fil_space_t; #include "page0size.h" - -#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE) -#define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE) -#define FSEG_PAGE_DATA FIL_PAGE_DATA -#define FSEG_HEADER_SIZE 10 -#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8) - #include "ut0ut.h" -#include "ut0byte.h" #include "mtr0types.h" #include "mach0data.h" #include "fsp0types.h" @@ -72,12 +64,6 @@ typedef void fil_space_t; #include -#ifdef UNIV_NONINL -# include "fsp0fsp.ic" -# include "mach0data.ic" -# include "ut0rnd.ic" -#endif - #ifndef PRIuMAX #define PRIuMAX "llu" #endif diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index de97964cf53..e7775b0d893 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -35,12 +35,9 @@ Created 11/5/1995 Heikki Tuuri #include "mach0data.h" #include "page0size.h" #include "buf0buf.h" +#include "buf0checksum.h" #include -#ifdef UNIV_NONINL -#include "buf0buf.ic" -#endif - #ifndef UNIV_INNOCHECKSUM #include "mem0mem.h" #include "btr0btr.h" @@ -60,19 +57,14 @@ Created 11/5/1995 Heikki Tuuri #include "dict0dict.h" #include "log0recv.h" #include "srv0mon.h" +#include "fil0pagecompress.h" +#include "fsp0pagecompress.h" #endif /* !UNIV_INNOCHECKSUM */ #include "page0zip.h" #include "sync0sync.h" #include "buf0dump.h" -#include #include #include -#ifndef UNIV_INNOCHECKSUM -#include "fil0pagecompress.h" -#include "fsp0pagecompress.h" -#endif -#include "ut0byte.h" -#include #ifdef UNIV_LINUX #include diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 6a190a35b17..3bd93aea0c4 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -23,16 +23,16 @@ Created Jonas Oreland Google Modified Jan Lindström jan.lindstrom@mariadb.com *******************************************************/ -#include "fil0fil.h" +#include "fil0crypt.h" #include "mtr0types.h" #include "mach0data.h" -#include "page0size.h" #include "page0zip.h" -#ifndef UNIV_INNOCHECKSUM -#include "fil0crypt.h" +#include "buf0checksum.h" +#ifdef UNIV_INNOCHECKSUM +# include "buf0buf.h" +#else #include "srv0srv.h" #include "srv0start.h" -#include "log0recv.h" #include "mtr0mtr.h" #include "mtr0log.h" #include "ut0ut.h" diff --git a/storage/innobase/include/buf0buddy.h b/storage/innobase/include/buf0buddy.h index 7ee837d6d2e..ed275ab1870 100644 --- a/storage/innobase/include/buf0buddy.h +++ b/storage/innobase/include/buf0buddy.h @@ -26,11 +26,6 @@ Created December 2006 by Marko Makela #ifndef buf0buddy_h #define buf0buddy_h -#ifdef UNIV_MATERIALIZE -# undef UNIV_INLINE -# define UNIV_INLINE -#endif - #include "buf0types.h" /**********************************************************************//** diff --git a/storage/innobase/include/buf0buddy.ic b/storage/innobase/include/buf0buddy.ic index d166ab8441c..7eb739a99db 100644 --- a/storage/innobase/include/buf0buddy.ic +++ b/storage/innobase/include/buf0buddy.ic @@ -23,11 +23,6 @@ Binary buddy allocator for compressed pages Created December 2006 by Marko Makela *******************************************************/ -#ifdef UNIV_MATERIALIZE -# undef UNIV_INLINE -# define UNIV_INLINE -#endif - #include "buf0buf.h" #include "buf0buddy.h" @@ -132,8 +127,3 @@ buf_buddy_free( buf_buddy_free_low(buf_pool, buf, buf_buddy_get_slot(size)); } - -#ifdef UNIV_MATERIALIZE -# undef UNIV_INLINE -# define UNIV_INLINE UNIV_INLINE_ORIGINAL -#endif diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h index 5238213135f..6b8bd53b5ed 100644 --- a/storage/innobase/include/fil0crypt.h +++ b/storage/innobase/include/fil0crypt.h @@ -26,11 +26,9 @@ Created 04/01/2015 Jan Lindström #ifndef fil0crypt_h #define fil0crypt_h -#ifndef UNIV_INNOCHECKSUM #include "os0event.h" #include "my_crypt.h" #include "fil0fil.h" -#endif /*! UNIV_INNOCHECKSUM */ /** * Magic pattern in start of crypt data on page 0 diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index b1b30a53580..fa4d3c12aa9 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -27,11 +27,12 @@ Created 10/25/1995 Heikki Tuuri #ifndef fil0fil_h #define fil0fil_h +#include "page0size.h" + #ifndef UNIV_INNOCHECKSUM #include "log0recv.h" #include "dict0types.h" -#include "page0size.h" // Forward declaration extern my_bool srv_use_doublewrite_buf; diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 76c7762fac3..9b502f1f546 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -28,15 +28,15 @@ Created 12/18/1995 Heikki Tuuri #define fsp0fsp_h #include "fsp0types.h" +#include "fut0lst.h" +#include "ut0byte.h" #ifndef UNIV_INNOCHECKSUM - -#include "fut0lst.h" #include "mtr0mtr.h" #include "page0types.h" #include "rem0types.h" -#include "ut0byte.h" - +#else +# include "mach0data.h" #endif /* !UNIV_INNOCHECKSUM */ /** @return the PAGE_SSIZE flags for the current innodb_page_size */ diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h index 642bd20e67e..d99ca14fe9a 100644 --- a/storage/innobase/include/fsp0types.h +++ b/storage/innobase/include/fsp0types.h @@ -27,10 +27,6 @@ Created May 26, 2009 Vasil Dimov #ifndef fsp0types_h #define fsp0types_h -#include "univ.i" - -#ifndef UNIV_INNOCHECKSUM - /** The fil_space_t::id of the redo log. All persistent tablespaces have a smaller fil_space_t::id. */ #define SRV_LOG_SPACE_FIRST_ID 0xFFFFFFF0U @@ -50,7 +46,6 @@ fseg_alloc_free_page) */ #define FSP_NO_DIR ((byte)113) /*!< no order */ /* @} */ -#endif /* !UNIV_INNOCHECKSUM */ /** File space extent size in pages page size | file space extent size ----------+----------------------- @@ -73,7 +68,6 @@ page size | file space extent size offset */ #define FSEG_PAGE_DATA FIL_PAGE_DATA -#ifndef UNIV_INNOCHECKSUM /** @name File segment header The file segment header points to the inode describing the file segment. */ /* @{ */ @@ -88,6 +82,7 @@ typedef byte fseg_header_t; header, in bytes */ /* @} */ +#ifndef UNIV_INNOCHECKSUM #ifdef UNIV_DEBUG struct mtr_t; diff --git a/storage/innobase/include/fut0fut.h b/storage/innobase/include/fut0fut.h index 497b6ac5114..d8072708089 100644 --- a/storage/innobase/include/fut0fut.h +++ b/storage/innobase/include/fut0fut.h @@ -27,7 +27,6 @@ Created 12/13/1995 Heikki Tuuri #ifndef fut0fut_h #define fut0fut_h -#include "fil0fil.h" #include "mtr0mtr.h" /** Gets a pointer to a file address and latches the page. diff --git a/storage/innobase/include/fut0lst.h b/storage/innobase/include/fut0lst.h index d38b450085c..7432df20034 100644 --- a/storage/innobase/include/fut0lst.h +++ b/storage/innobase/include/fut0lst.h @@ -27,8 +27,9 @@ Created 11/28/1995 Heikki Tuuri #ifndef fut0lst_h #define fut0lst_h -#ifndef UNIV_INNOCHECKSUM - +#ifdef UNIV_INNOCHECKSUM +# include "fil0fil.h" +#else #include "fut0fut.h" #include "mtr0log.h" @@ -39,10 +40,10 @@ applied to these types! */ typedef byte flst_base_node_t; typedef byte flst_node_t; -/* The physical size of a list base node in bytes */ -#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE) #endif /* !UNIV_INNOCHECKSUM */ +/* The physical size of a list base node in bytes */ +#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE) /* The physical size of a list node in bytes */ #define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE) diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic index 1ba85d93fb4..b5812560093 100644 --- a/storage/innobase/include/page0cur.ic +++ b/storage/innobase/include/page0cur.ic @@ -24,12 +24,7 @@ The page cursor Created 10/4/1994 Heikki Tuuri *************************************************************************/ -#include "page0page.h" -#include "buf0types.h" - #ifdef UNIV_DEBUG -# include "rem0cmp.h" - /*********************************************************//** Gets pointer to the page frame where the cursor is positioned. @return page */ diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 1ec3cf7b6a4..d5f31f8764f 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -27,28 +27,23 @@ Created 2/2/1994 Heikki Tuuri #define page0page_h #include "page0types.h" -#ifndef UNIV_INNOCHECKSUM +#include "fsp0fsp.h" #include "fil0fil.h" #include "buf0buf.h" -#include "data0data.h" -#include "dict0dict.h" #include "rem0rec.h" -#endif /* !UNIV_INNOCHECKSUM*/ -#include "fsp0fsp.h" #ifndef UNIV_INNOCHECKSUM +#include "dict0dict.h" +#include "data0data.h" #include "mtr0mtr.h" -#ifdef UNIV_MATERIALIZE -#undef UNIV_INLINE -#define UNIV_INLINE -#endif - /* PAGE HEADER =========== Index page header starts at the first offset left free by the FIL-module */ typedef byte page_header_t; +#else +# include "mach0data.h" #endif /* !UNIV_INNOCHECKSUM */ #define PAGE_HEADER FSEG_PAGE_DATA /* index page header starts at this @@ -1351,11 +1346,6 @@ page_warn_strict_checksum( srv_checksum_algorithm_t page_checksum, const page_id_t page_id); -#ifdef UNIV_MATERIALIZE -#undef UNIV_INLINE -#define UNIV_INLINE UNIV_INLINE_ORIGINAL -#endif - #endif /* !UNIV_INNOCHECKSUM */ #include "page0page.ic" diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index 7567853667c..ad0ea913af9 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -29,18 +29,10 @@ Created 2/2/1994 Heikki Tuuri #ifndef UNIV_INNOCHECKSUM #include "mach0data.h" -#ifdef UNIV_DEBUG -# include "log0recv.h" -#endif /* !UNIV_DEBUG */ #include "rem0cmp.h" #include "mtr0log.h" #include "page0zip.h" -#ifdef UNIV_MATERIALIZE -#undef UNIV_INLINE -#define UNIV_INLINE -#endif - /*************************************************************//** Returns the max trx id field value. */ UNIV_INLINE @@ -1100,9 +1092,4 @@ page_get_instant(const page_t* page) } #endif /* !UNIV_INNOCHECKSUM */ -#ifdef UNIV_MATERIALIZE -#undef UNIV_INLINE -#define UNIV_INLINE UNIV_INLINE_ORIGINAL -#endif - #endif diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h index 60b6b46d7ab..00761d5e782 100644 --- a/storage/innobase/include/page0zip.h +++ b/storage/innobase/include/page0zip.h @@ -28,27 +28,11 @@ Created June 2005 by Marko Makela #ifndef page0zip_h #define page0zip_h -#ifdef UNIV_MATERIALIZE -# undef UNIV_INLINE -# define UNIV_INLINE -#endif - -#ifdef UNIV_INNOCHECKSUM -#include "buf0buf.h" -#include "ut0crc32.h" -#include "buf0checksum.h" -#include "mach0data.h" -#include "zlib.h" -#endif /* UNIV_INNOCHECKSUM */ +#include "buf0types.h" #ifndef UNIV_INNOCHECKSUM #include "mtr0types.h" #include "page0types.h" -#endif /* !UNIV_INNOCHECKSUM */ - -#include "buf0types.h" - -#ifndef UNIV_INNOCHECKSUM #include "dict0types.h" #include "srv0srv.h" #include "trx0types.h" @@ -563,11 +547,6 @@ void page_zip_reset_stat_per_index(); /*===========================*/ -#ifdef UNIV_MATERIALIZE -# undef UNIV_INLINE -# define UNIV_INLINE UNIV_INLINE_ORIGINAL -#endif - #include "page0zip.ic" #endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic index eefe7c8f0f7..10a311089dc 100644 --- a/storage/innobase/include/page0zip.ic +++ b/storage/innobase/include/page0zip.ic @@ -25,11 +25,6 @@ Compressed page interface Created June 2005 by Marko Makela *******************************************************/ -#ifdef UNIV_MATERIALIZE -# undef UNIV_INLINE -# define UNIV_INLINE -#endif - #include "page0zip.h" #include "mtr0log.h" #include "page0page.h" @@ -437,8 +432,3 @@ page_zip_reset_stat_per_index() mutex_exit(&page_zip_stat_per_index_mutex); } - -#ifdef UNIV_MATERIALIZE -# undef UNIV_INLINE -# define UNIV_INLINE UNIV_INLINE_ORIGINAL -#endif diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 451959a5ab8..3af456b4b1a 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -47,7 +47,6 @@ Created 10/10/1995 Heikki Tuuri #include "que0types.h" #include "trx0types.h" #include "srv0conc.h" -#include "buf0checksum.h" #include "fil0fil.h" #include "mysql/psi/mysql_stage.h" diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 1614d3ead6d..813b5f5c198 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -175,12 +175,6 @@ ut_2_power_up( ulint n) /*!< in: number != 0 */ MY_ATTRIBUTE((const)); -/** Determine how many bytes (groups of 8 bits) are needed to -store the given number of bits. -@param b in: bits -@return number of bytes (octets) needed to represent b */ -#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8) - /**********************************************************//** Returns system time. We do not specify the format of the time returned: the only way to manipulate it is to use the function ut_difftime. @@ -239,6 +233,12 @@ ut_difftime( #endif /* !UNIV_INNOCHECKSUM */ +/** Determine how many bytes (groups of 8 bits) are needed to +store the given number of bits. +@param b in: bits +@return number of bytes (octets) needed to represent b */ +#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8) + /** Determines if a number is zero or a power of two. @param[in] n number @return nonzero if n is zero or a power of two; zero otherwise */ diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index 1b6567ad9a4..8c02a85d471 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -29,6 +29,7 @@ Created 2/2/1994 Heikki Tuuri #include "page0cur.h" #include "page0zip.h" #include "buf0buf.h" +#include "buf0checksum.h" #include "btr0btr.h" #include "srv0srv.h" #include "lock0lock.h" diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index cef492ca511..44fa44339e7 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -25,33 +25,31 @@ Compressed page interface Created June 2005 by Marko Makela *******************************************************/ -#include "page0size.h" #include "page0zip.h" +#include "page0size.h" +#include "page0page.h" +#include "buf0checksum.h" /** A BLOB field reference full of zero, for use in assertions and tests. Initially, BLOB field references are set to zero, in dtuple_convert_big_rec(). */ const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, }; +#include "ut0crc32.h" +#include "zlib.h" + #ifndef UNIV_INNOCHECKSUM -#include "page0page.h" #include "mtr0log.h" #include "dict0dict.h" #include "btr0cur.h" -#include "page0types.h" #include "log0recv.h" #include "row0row.h" -#include "zlib.h" -#include "buf0buf.h" -#include "buf0types.h" -#include "buf0checksum.h" #include "btr0sea.h" #include "dict0boot.h" #include "lock0lock.h" #include "srv0srv.h" #include "buf0lru.h" #include "srv0mon.h" -#include "ut0crc32.h" #include #include