From 185026706d926d1f94bd1c42a11dd83e6b8e74ec Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 31 Jan 2019 23:50:25 -0500 Subject: stat: Work around msan not knowing about statx() --- util.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'util.h') diff --git a/util.h b/util.h index d96b79d..6a51806 100644 --- a/util.h +++ b/util.h @@ -1,6 +1,6 @@ /**************************************************************************** * bfs * - * Copyright (C) 2016-2018 Tavian Barnes * + * Copyright (C) 2016-2019 Tavian Barnes * * * * Permission to use, copy, modify, and/or distribute this software for any * * purpose with or without fee is hereby granted. * @@ -27,6 +27,12 @@ // Some portability concerns +#ifdef __has_feature +# define BFS_HAS_FEATURE(feature, fallback) __has_feature(feature) +#else +# define BFS_HAS_FEATURE(feature, fallback) fallback +#endif + #ifdef __has_include # define BFS_HAS_INCLUDE(header, fallback) __has_include(header) #else -- cgit v1.2.3 From 33d320ab80aebb89dc63931684ef2e748b5fb91c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 1 Feb 2019 11:01:42 -0500 Subject: util: Allow configuration macros to be specified with -D In case we need to override them at build time. --- posix1e.h | 2 +- util.h | 29 +++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'util.h') diff --git a/posix1e.h b/posix1e.h index ad6a9e9..8950498 100644 --- a/posix1e.h +++ b/posix1e.h @@ -21,7 +21,7 @@ #include "util.h" #include -#if BFS_HAS_SYS_CAPABILITY && !__FreeBSD__ +#if !defined(BFS_HAS_POSIX1E_CAPABILITIES) && BFS_HAS_SYS_CAPABILITY && !__FreeBSD__ # include # ifdef CAP_CHOWN # define BFS_HAS_POSIX1E_CAPABILITIES true diff --git a/util.h b/util.h index 6a51806..332fb79 100644 --- a/util.h +++ b/util.h @@ -39,12 +39,29 @@ # define BFS_HAS_INCLUDE(header, fallback) fallback #endif -#define BFS_HAS_MNTENT BFS_HAS_INCLUDE(, __GLIBC__) -#define BFS_HAS_SYS_ACL BFS_HAS_INCLUDE(, true) -#define BFS_HAS_SYS_CAPABILITY BFS_HAS_INCLUDE(, __linux__) -#define BFS_HAS_SYS_MKDEV BFS_HAS_INCLUDE(, false) -#define BFS_HAS_SYS_PARAM BFS_HAS_INCLUDE(, true) -#define BFS_HAS_SYS_SYSMACROS BFS_HAS_INCLUDE(, __GLIBC__) +#ifndef BFS_HAS_MNTENT +# define BFS_HAS_MNTENT BFS_HAS_INCLUDE(, __GLIBC__) +#endif + +#ifndef BFS_HAS_SYS_ACL +# define BFS_HAS_SYS_ACL BFS_HAS_INCLUDE(, true) +#endif + +#ifndef BFS_HAS_SYS_CAPABILITY +# define BFS_HAS_SYS_CAPABILITY BFS_HAS_INCLUDE(, __linux__) +#endif + +#ifndef BFS_HAS_SYS_MKDEV +# define BFS_HAS_SYS_MKDEV BFS_HAS_INCLUDE(, false) +#endif + +#ifndef BFS_HAS_SYS_PARAM +# define BFS_HAS_SYS_PARAM BFS_HAS_INCLUDE(, true) +#endif + +#ifndef BFS_HAS_SYS_SYSMACROS +# define BFS_HAS_SYS_SYSMACROS BFS_HAS_INCLUDE(, __GLIBC__) +#endif #if !defined(FNM_CASEFOLD) && defined(FNM_IGNORECASE) # define FNM_CASEFOLD FNM_IGNORECASE -- cgit v1.2.3 From 36330d7aab63ef2c202efb0d551f104ed6cefa17 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 1 Feb 2019 00:02:59 -0500 Subject: util: Remove some unused macros --- util.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index 332fb79..4f70c1b 100644 --- a/util.h +++ b/util.h @@ -67,18 +67,6 @@ # define FNM_CASEFOLD FNM_IGNORECASE #endif -#ifndef S_ISDOOR -# define S_ISDOOR(mode) false -#endif - -#ifndef S_ISPORT -# define S_ISPORT(mode) false -#endif - -#ifndef S_ISWHT -# define S_ISWHT(mode) false -#endif - #ifndef O_DIRECTORY # define O_DIRECTORY 0 #endif -- cgit v1.2.3