1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

headers: use configure.h as 1st. header

Ensure configure.h is always 1st. included header.
Maybe we could eventually introduce gcc -include option, but for now
this better uses dependency tracking.

Also move _REENTRANT and _GNU_SOURCE into configure.h so it
doesn't need to be present in various source files.
This ensures consistent compilation of headers like stdio.h since
it may produce different declaration.
This commit is contained in:
Zdenek Kabelac 2018-12-03 18:14:26 +01:00
parent 3c37764333
commit 0b19387dae
27 changed files with 37 additions and 53 deletions

View File

@ -18,6 +18,7 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
//---------------------------------------------------------------- //----------------------------------------------------------------

View File

@ -13,6 +13,8 @@
#ifndef BASE_DATA_STRUCT_RADIX_TREE_H #ifndef BASE_DATA_STRUCT_RADIX_TREE_H
#define BASE_DATA_STRUCT_RADIX_TREE_H #define BASE_DATA_STRUCT_RADIX_TREE_H
#include "configure.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>

View File

@ -13,8 +13,8 @@
#ifndef BASE_MEMORY_ZALLOC_H #ifndef BASE_MEMORY_ZALLOC_H
#define BASE_MEMORY_ZALLOC_H #define BASE_MEMORY_ZALLOC_H
#include "configure.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
//---------------------------------------------------------------- //----------------------------------------------------------------

9
configure vendored
View File

@ -6623,6 +6623,15 @@ fi
$as_echo "#define _GNU_SOURCE 1" >>confdefs.h
$as_echo "#define _REENTRANT 1" >>confdefs.h
################################################################################ ################################################################################
for ac_func in ftruncate gethostname getpagesize gettimeofday localtime_r \ for ac_func in ftruncate gethostname getpagesize gettimeofday localtime_r \
memchr memset mkdir mkfifo munmap nl_langinfo realpath rmdir setenv \ memchr memset mkdir mkfifo munmap nl_langinfo realpath rmdir setenv \

View File

@ -144,6 +144,11 @@ AC_TYPE_UINT64_T
AX_GCC_BUILTIN([__builtin_clz]) AX_GCC_BUILTIN([__builtin_clz])
AX_GCC_BUILTIN([__builtin_clzll]) AX_GCC_BUILTIN([__builtin_clzll])
AC_DEFINE([_GNU_SOURCE], 1, [Define to get access to GNU/Linux extension])
AC_DEFINE([_REENTRANT], 1, [Define to use re-entrant thread safe versions])
################################################################################ ################################################################################
dnl -- Check for functions dnl -- Check for functions
AC_CHECK_FUNCS([ftruncate gethostname getpagesize gettimeofday localtime_r \ AC_CHECK_FUNCS([ftruncate gethostname getpagesize gettimeofday localtime_r \

View File

@ -13,8 +13,6 @@
#ifndef _LVM_CLOG_LOGGING_H #ifndef _LVM_CLOG_LOGGING_H
#define _LVM_CLOG_LOGGING_H #define _LVM_CLOG_LOGGING_H
#define _GNU_SOURCE
#include "configure.h" #include "configure.h"
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>

View File

@ -10,7 +10,6 @@
#define _XOPEN_SOURCE 500 /* pthread */ #define _XOPEN_SOURCE 500 /* pthread */
#define _ISOC99_SOURCE #define _ISOC99_SOURCE
#define _REENTRANT
#include "tools/tool.h" #include "tools/tool.h"

View File

@ -18,8 +18,6 @@
#ifndef _LVM_LVMPOLLD_COMMON_H #ifndef _LVM_LVMPOLLD_COMMON_H
#define _LVM_LVMPOLLD_COMMON_H #define _LVM_LVMPOLLD_COMMON_H
#define _REENTRANT
#include "tools/tool.h" #include "tools/tool.h"
#include "lvmpolld-cmd-utils.h" #include "lvmpolld-cmd-utils.h"

View File

@ -17,6 +17,8 @@
#ifndef LIB_DEVICE_MAPPER_H #ifndef LIB_DEVICE_MAPPER_H
#define LIB_DEVICE_MAPPER_H #define LIB_DEVICE_MAPPER_H
#include "configure.h"
#include "base/data-struct/list.h" #include "base/data-struct/list.h"
#include "base/data-struct/hash.h" #include "base/data-struct/hash.h"
#include "vdo/target.h" #include "vdo/target.h"

View File

@ -19,7 +19,6 @@
#include "device_mapper/ioctl/libdm-targets.h" #include "device_mapper/ioctl/libdm-targets.h"
#include "device_mapper/libdm-common.h" #include "device_mapper/libdm-common.h"
#include <stdio.h> /* getline() */
#include <stddef.h> #include <stddef.h>
#include <fcntl.h> #include <fcntl.h>
#include <dirent.h> #include <dirent.h>

View File

@ -21,11 +21,6 @@
// FIXME: get rid of this whole file // FIXME: get rid of this whole file
#include "configure.h"
#define _REENTRANT
#define _GNU_SOURCE
#include "device_mapper/all.h" #include "device_mapper/all.h"
#include "lib/misc/util.h" #include "lib/misc/util.h"
#include "dm-logging.h" #include "dm-logging.h"

View File

@ -669,6 +669,12 @@
/* Define to 1 to include built-in support for writecache. */ /* Define to 1 to include built-in support for writecache. */
#undef WRITECACHE_INTERNAL #undef WRITECACHE_INTERNAL
/* Define to get access to GNU/Linux extension */
#undef _GNU_SOURCE
/* Define to use re-entrant thread safe versions */
#undef _REENTRANT
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */ #define below would cause a syntax error. */

View File

@ -12,8 +12,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _GNU_SOURCE
#include "lib/device/bcache.h" #include "lib/device/bcache.h"
#include "base/data-struct/radix-tree.h" #include "base/data-struct/radix-tree.h"

View File

@ -15,7 +15,6 @@
#ifndef BCACHE_H #ifndef BCACHE_H
#define BCACHE_H #define BCACHE_H
#include "configure.h"
#include "device_mapper/all.h" #include "device_mapper/all.h"
#include <linux/fs.h> #include <linux/fs.h>

View File

@ -13,8 +13,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _GNU_SOURCE
#include "base/memory/zalloc.h" #include "base/memory/zalloc.h"
#include "lib/misc/lib.h" #include "lib/misc/lib.h"
#include "lib/label/label.h" #include "lib/label/label.h"

View File

@ -19,11 +19,6 @@
#ifndef _LVM_LIB_H #ifndef _LVM_LIB_H
#define _LVM_LIB_H #define _LVM_LIB_H
#include "configure.h"
#define _REENTRANT
#define _GNU_SOURCE
/* /*
* Symbol export control macros * Symbol export control macros
* *
@ -78,10 +73,10 @@
#endif #endif
#include "lib/misc/intl.h"
#include "device_mapper/all.h" #include "device_mapper/all.h"
#include "lib/misc/util.h"
#include "base/memory/zalloc.h" #include "base/memory/zalloc.h"
#include "lib/misc/intl.h"
#include "lib/misc/util.h"
#ifdef DM #ifdef DM
# include "libdm/misc/dm-logging.h" # include "libdm/misc/dm-logging.h"

View File

@ -12,11 +12,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _REENTRANT
#include "tools/tool.h" #include "tools/tool.h"
#include "libdaemon/client/daemon-io.h" #include "daemon-io.h"
#include "device_mapper/misc/dm-logging.h" #include "device_mapper/misc/dm-logging.h"
#include <math.h> /* fabs() */ #include <math.h> /* fabs() */

View File

@ -12,12 +12,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _REENTRANT
#include "tools/tool.h" #include "tools/tool.h"
#include "libdaemon/client/daemon-io.h" #include "daemon-io.h"
#include "libdaemon/client/daemon-client.h" #include "daemon-client.h"
#include "device_mapper/misc/dm-logging.h" #include "device_mapper/misc/dm-logging.h"
#include <sys/un.h> #include <sys/un.h>

View File

@ -12,11 +12,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _REENTRANT
#include "tools/tool.h" #include "tools/tool.h"
#include "libdaemon/client/daemon-io.h" #include "daemon-io.h"
#include <errno.h> #include <errno.h>

View File

@ -10,8 +10,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _REENTRANT
#include "tools/tool.h" #include "tools/tool.h"
#include "daemon-server.h" #include "daemon-server.h"

View File

@ -10,13 +10,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _REENTRANT
#include "tools/tool.h" #include "tools/tool.h"
#include "libdaemon/client/daemon-io.h"
#include "daemon-server.h" #include "daemon-server.h"
#include "daemon-log.h" #include "daemon-log.h"
#include "libdaemon/client/daemon-io.h"
#include <dlfcn.h> #include <dlfcn.h>
#include <errno.h> #include <errno.h>

View File

@ -17,8 +17,6 @@
*/ */
// For canonicalize_file_name() // For canonicalize_file_name()
#define _GNU_SOURCE
#include "configure.h" #include "configure.h"
#include "libdm/misc/dm-logging.h" #include "libdm/misc/dm-logging.h"
#include "libdm/dm-tools/util.h" #include "libdm/dm-tools/util.h"

View File

@ -21,9 +21,6 @@
#include "configure.h" #include "configure.h"
#define _REENTRANT
#define _GNU_SOURCE
/* /*
* Symbol export control macros * Symbol export control macros
* *

View File

@ -12,7 +12,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _GNU_SOURCE #include "configure.h"
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>

View File

@ -12,8 +12,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _GNU_SOURCE
#include "units.h" #include "units.h"
#include "lib/device/bcache.h" #include "lib/device/bcache.h"

View File

@ -12,8 +12,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define _GNU_SOURCE
#include "units.h" #include "units.h"
#include "lib/device/bcache.h" #include "lib/device/bcache.h"

View File

@ -18,14 +18,12 @@
#ifndef _LVM_TOOL_H #ifndef _LVM_TOOL_H
#define _LVM_TOOL_H #define _LVM_TOOL_H
#define _GNU_SOURCE
#include "configure.h" #include "configure.h"
#include <unistd.h>
#include "base/memory/zalloc.h" #include "base/memory/zalloc.h"
#include "device_mapper/all.h" #include "device_mapper/all.h"
#include "lib/misc/util.h" #include "lib/misc/util.h"
#include <unistd.h>
#endif /* _LVM_TOOL_H */ #endif /* _LVM_TOOL_H */