summaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-11-06 16:22:57 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-11-06 16:37:14 -0500
commit096884c4fe1fb922eab2797d4583ca2ae8ae2600 (patch)
tree850e214301a5fd94b7f2a3e94bd90a390739581f /src/util.h
parent46387a7dcda93e7df9f5baa3ead753c0feeff122 (diff)
downloadbfs-096884c4fe1fb922eab2797d4583ca2ae8ae2600.tar.xz
config: Split out some of util.h into a new header
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h134
1 files changed, 0 insertions, 134 deletions
diff --git a/src/util.h b/src/util.h
index 0fbcdaa..2d99152 100644
--- a/src/util.h
+++ b/src/util.h
@@ -30,101 +30,6 @@
// Some portability concerns
-#ifndef __has_feature
-# define __has_feature(feat) false
-#endif
-
-#ifndef __has_c_attribute
-# define __has_c_attribute(attr) false
-#endif
-
-#ifndef __has_attribute
-# define __has_attribute(attr) false
-#endif
-
-#ifdef __has_include
-
-#if __has_include(<mntent.h>)
-# define BFS_HAS_MNTENT_H true
-#endif
-#if __has_include(<paths.h>)
-# define BFS_HAS_PATHS_H true
-#endif
-#if __has_include(<sys/acl.h>)
-# define BFS_HAS_SYS_ACL_H true
-#endif
-#if __has_include(<sys/capability.h>)
-# define BFS_HAS_SYS_CAPABILITY_H true
-#endif
-#if __has_include(<sys/extattr.h>)
-# define BFS_HAS_SYS_EXTATTR_H true
-#endif
-#if __has_include(<sys/mkdev.h>)
-# define BFS_HAS_SYS_MKDEV_H true
-#endif
-#if __has_include(<sys/param.h>)
-# define BFS_HAS_SYS_PARAM_H true
-#endif
-#if __has_include(<sys/sysmacros.h>)
-# define BFS_HAS_SYS_SYSMACROS_H true
-#endif
-#if __has_include(<sys/xattr.h>)
-# define BFS_HAS_SYS_XATTR_H true
-#endif
-#if __has_include(<util.h>)
-# define BFS_HAS_UTIL_H true
-#endif
-
-#else // !__has_include
-
-#define BFS_HAS_MNTENT_H __GLIBC__
-#define BFS_HAS_PATHS_H true
-#define BFS_HAS_SYS_ACL_H true
-#define BFS_HAS_SYS_CAPABILITY_H __linux__
-#define BFS_HAS_SYS_EXTATTR_H __FreeBSD__
-#define BFS_HAS_SYS_MKDEV_H false
-#define BFS_HAS_SYS_PARAM_H true
-#define BFS_HAS_SYS_SYSMACROS_H __GLIBC__
-#define BFS_HAS_SYS_XATTR_H __linux__
-#define BFS_HAS_UTIL_H __NetBSD__
-
-#endif // !__has_include
-
-#ifndef BFS_USE_MNTENT_H
-# define BFS_USE_MNTENT_H BFS_HAS_MNTENT_H
-#endif
-#ifndef BFS_USE_PATHS_H
-# define BFS_USE_PATHS_H BFS_HAS_PATHS_H
-#endif
-#ifndef BFS_USE_SYS_ACL_H
-# define BFS_USE_SYS_ACL_H BFS_HAS_SYS_ACL_H
-#endif
-#ifndef BFS_USE_SYS_CAPABILITY_H
-# define BFS_USE_SYS_CAPABILITY_H BFS_HAS_SYS_CAPABILITY_H
-#endif
-#ifndef BFS_USE_SYS_EXTATTR_H
-# define BFS_USE_SYS_EXTATTR_H BFS_HAS_SYS_EXTATTR_H
-#endif
-#ifndef BFS_USE_SYS_MKDEV_H
-# define BFS_USE_SYS_MKDEV_H BFS_HAS_SYS_MKDEV_H
-#endif
-#ifndef BFS_USE_SYS_PARAM_H
-# define BFS_USE_SYS_PARAM_H BFS_HAS_SYS_PARAM_H
-#endif
-#ifndef BFS_USE_SYS_SYSMACROS_H
-# define BFS_USE_SYS_SYSMACROS_H BFS_HAS_SYS_SYSMACROS_H
-#endif
-#ifndef BFS_USE_SYS_XATTR_H
-# define BFS_USE_SYS_XATTR_H BFS_HAS_SYS_XATTR_H
-#endif
-#ifndef BFS_USE_UTIL_H
-# define BFS_USE_UTIL_H BFS_HAS_UTIL_H
-#endif
-
-#ifndef __GLIBC_PREREQ
-# define __GLIBC_PREREQ(maj, min) false
-#endif
-
#if !defined(FNM_CASEFOLD) && defined(FNM_IGNORECASE)
# define FNM_CASEFOLD FNM_IGNORECASE
#endif
@@ -133,45 +38,6 @@
# define O_DIRECTORY 0
#endif
-#if __has_c_attribute(fallthrough)
-# define BFS_FALLTHROUGH [[fallthrough]]
-#elif __has_attribute(fallthrough)
-# define BFS_FALLTHROUGH __attribute__((fallthrough))
-#else
-# define BFS_FALLTHROUGH ((void)0)
-#endif
-
-/**
- * Adds compiler warnings for bad printf()-style function calls, if supported.
- */
-#if __has_attribute(format)
-# define BFS_FORMATTER(fmt, args) __attribute__((format(printf, fmt, args)))
-#else
-# define BFS_FORMATTER(fmt, args)
-#endif
-
-// Lower bound on BFS_FLEX_SIZEOF()
-#define BFS_FLEX_LB(type, member, length) (offsetof(type, member) + sizeof(((type *)NULL)->member[0]) * (length))
-
-// Maximum macro for BFS_FLEX_SIZE()
-#define BFS_FLEX_MAX(a, b) ((a) > (b) ? (a) : (b))
-
-/**
- * Computes the size of a struct containing a flexible array member of the given
- * length.
- *
- * @param type
- * The type of the struct containing the flexible array.
- * @param member
- * The name of the flexible array member.
- * @param length
- * The length of the flexible array.
- */
-#define BFS_FLEX_SIZEOF(type, member, length) \
- (sizeof(type) <= BFS_FLEX_LB(type, member, 0) \
- ? BFS_FLEX_LB(type, member, length) \
- : BFS_FLEX_MAX(sizeof(type), BFS_FLEX_LB(type, member, length)))
-
/**
* readlinkat() wrapper that dynamically allocates the result.
*